Skip to content

Commit fd963f6

Browse files
authored
Merge pull request #15 from slp/release-v0.1.6
Release v0.1.6
2 parents ebf3e30 + 718de12 commit fd963f6

File tree

8 files changed

+28
-27
lines changed

8 files changed

+28
-27
lines changed

.github/workflows/code_quality.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ jobs:
2323
override: true
2424
components: rustfmt, clippy
2525

26+
- name: Install asciidoctor
27+
run: sudo apt-get install -y asciidoctor
28+
2629
- name: Formatting (rustfmt)
2730
run: cargo fmt -- --check
2831

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
[package]
22
name = "krunvm"
3-
version = "0.1.5"
3+
version = "0.1.6"
44
authors = ["Sergio Lopez <[email protected]>"]
5+
description = "Create microVMs from OCI images"
6+
repository = "https://github.com/containers/krunvm"
57
license = "Apache-2.0"
68
edition = "2018"
79
build = "build.rs"

src/create.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ pub fn create(cfg: &mut KrunvmConfig, matches: &ArgMatches) {
7474
}
7575
}
7676

77-
let mut args = get_buildah_args(&cfg, BuildahCommand::From);
77+
let mut args = get_buildah_args(cfg, BuildahCommand::From);
7878
args.push(image.to_string());
7979

8080
let output = match Command::new("buildah")
@@ -87,7 +87,7 @@ pub fn create(cfg: &mut KrunvmConfig, matches: &ArgMatches) {
8787
if err.kind() == std::io::ErrorKind::NotFound {
8888
println!("{} requires buildah to manage the OCI images, and it wasn't found on this system.", APP_NAME);
8989
} else {
90-
println!("Error executing buildah: {}", err.to_string());
90+
println!("Error executing buildah: {}", err);
9191
}
9292
std::process::exit(-1);
9393
}
@@ -119,9 +119,9 @@ pub fn create(cfg: &mut KrunvmConfig, matches: &ArgMatches) {
119119
mapped_ports,
120120
};
121121

122-
let rootfs = mount_container(&cfg, &vmcfg).unwrap();
123-
fix_resolv_conf(&rootfs, &dns).unwrap();
124-
umount_container(&cfg, &vmcfg).unwrap();
122+
let rootfs = mount_container(cfg, &vmcfg).unwrap();
123+
fix_resolv_conf(&rootfs, dns).unwrap();
124+
umount_container(cfg, &vmcfg).unwrap();
125125

126126
cfg.vmconfig_map.insert(name.clone(), vmcfg);
127127
confy::store(APP_NAME, cfg).unwrap();

src/delete.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ pub fn delete(cfg: &mut KrunvmConfig, matches: &ArgMatches) {
1616
Some(vmcfg) => vmcfg,
1717
};
1818

19-
umount_container(&cfg, &vmcfg).unwrap();
20-
remove_container(&cfg, &vmcfg).unwrap();
19+
umount_container(cfg, &vmcfg).unwrap();
20+
remove_container(cfg, &vmcfg).unwrap();
2121

2222
confy::store(APP_NAME, &cfg).unwrap();
2323
}

src/main.rs

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -143,11 +143,7 @@ volume.
143143
#[cfg(target_os = "linux")]
144144
fn check_unshare() {
145145
let uid = unsafe { libc::getuid() };
146-
if uid != 0
147-
&& std::env::vars()
148-
.find(|(key, _)| key == "BUILDAH_ISOLATION")
149-
.is_none()
150-
{
146+
if uid != 0 && !std::env::vars().any(|(key, _)| key == "BUILDAH_ISOLATION") {
151147
println!("Please re-run krunvm inside a \"buildah unshare\" session");
152148
std::process::exit(-1);
153149
}
@@ -356,17 +352,17 @@ fn main() {
356352
#[cfg(target_os = "linux")]
357353
check_unshare();
358354

359-
if let Some(ref matches) = matches.subcommand_matches("changevm") {
355+
if let Some(matches) = matches.subcommand_matches("changevm") {
360356
changevm::changevm(&mut cfg, matches);
361-
} else if let Some(ref matches) = matches.subcommand_matches("config") {
357+
} else if let Some(matches) = matches.subcommand_matches("config") {
362358
config::config(&mut cfg, matches);
363-
} else if let Some(ref matches) = matches.subcommand_matches("create") {
359+
} else if let Some(matches) = matches.subcommand_matches("create") {
364360
create::create(&mut cfg, matches);
365-
} else if let Some(ref matches) = matches.subcommand_matches("delete") {
361+
} else if let Some(matches) = matches.subcommand_matches("delete") {
366362
delete::delete(&mut cfg, matches);
367-
} else if let Some(ref matches) = matches.subcommand_matches("list") {
363+
} else if let Some(matches) = matches.subcommand_matches("list") {
368364
list::list(&cfg, matches);
369-
} else if let Some(ref matches) = matches.subcommand_matches("start") {
365+
} else if let Some(matches) = matches.subcommand_matches("start") {
370366
start::start(&cfg, matches);
371367
} else {
372368
app.print_long_help().unwrap();

src/start.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ unsafe fn exec_vm(vmcfg: &VmConfig, rootfs: &str, cmd: &str, args: Vec<CString>)
8484
std::process::exit(-1);
8585
}
8686

87-
map_volumes(ctx, &vmcfg, rootfs);
87+
map_volumes(ctx, vmcfg, rootfs);
8888

8989
let mut ports = Vec::new();
9090
for (host_port, guest_port) in vmcfg.mapped_ports.iter() {
@@ -187,8 +187,8 @@ pub fn start(cfg: &KrunvmConfig, matches: &ArgMatches) {
187187
Some(vmcfg) => vmcfg,
188188
};
189189

190-
umount_container(&cfg, vmcfg).expect("Error unmounting container");
191-
let rootfs = mount_container(&cfg, vmcfg).expect("Error mounting container");
190+
umount_container(cfg, vmcfg).expect("Error unmounting container");
191+
let rootfs = mount_container(cfg, vmcfg).expect("Error mounting container");
192192

193193
let args: Vec<CString> = match matches.values_of("ARGS") {
194194
Some(a) => a.map(|val| CString::new(val).unwrap()).collect(),
@@ -201,5 +201,5 @@ pub fn start(cfg: &KrunvmConfig, matches: &ArgMatches) {
201201

202202
unsafe { exec_vm(vmcfg, &rootfs, cmd, args) };
203203

204-
umount_container(&cfg, vmcfg).expect("Error unmounting container");
204+
umount_container(cfg, vmcfg).expect("Error unmounting container");
205205
}

src/utils.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ pub fn mount_container(cfg: &KrunvmConfig, vmcfg: &VmConfig) -> Result<String, s
147147
if err.kind() == std::io::ErrorKind::NotFound {
148148
println!("{} requires buildah to manage the OCI images, and it wasn't found on this system.", APP_NAME);
149149
} else {
150-
println!("Error executing buildah: {}", err.to_string());
150+
println!("Error executing buildah: {}", err);
151151
}
152152
std::process::exit(-1);
153153
}
@@ -181,7 +181,7 @@ pub fn umount_container(cfg: &KrunvmConfig, vmcfg: &VmConfig) -> Result<(), std:
181181
if err.kind() == std::io::ErrorKind::NotFound {
182182
println!("{} requires buildah to manage the OCI images, and it wasn't found on this system.", APP_NAME);
183183
} else {
184-
println!("Error executing buildah: {}", err.to_string());
184+
println!("Error executing buildah: {}", err);
185185
}
186186
std::process::exit(-1);
187187
}
@@ -214,7 +214,7 @@ pub fn remove_container(cfg: &KrunvmConfig, vmcfg: &VmConfig) -> Result<(), std:
214214
if err.kind() == std::io::ErrorKind::NotFound {
215215
println!("{} requires buildah to manage the OCI images, and it wasn't found on this system.", APP_NAME);
216216
} else {
217-
println!("Error executing buildah: {}", err.to_string());
217+
println!("Error executing buildah: {}", err);
218218
}
219219
std::process::exit(-1);
220220
}

0 commit comments

Comments
 (0)