diff options
author | Lars Wirzenius <liw@liw.fi> | 2021-03-04 10:14:15 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2021-03-04 10:14:24 +0200 |
commit | 4eded18d1cffe2bcbc432e4c14e4712b0c1ab4cb (patch) | |
tree | 903be1d7643439007ef4e39ef3d566171913f0ee /src/bin | |
parent | 5141d3a654e3abc8064a6ba252220426701a5f89 (diff) | |
download | vmadm-4eded18d1cffe2bcbc432e4c14e4712b0c1ab4cb.tar.gz |
feat! allow specification files to have any number of machines
Diffstat (limited to 'src/bin')
-rw-r--r-- | src/bin/vmadm.rs | 33 |
1 files changed, 9 insertions, 24 deletions
diff --git a/src/bin/vmadm.rs b/src/bin/vmadm.rs index 4cc2248..8fe5540 100644 --- a/src/bin/vmadm.rs +++ b/src/bin/vmadm.rs @@ -57,17 +57,6 @@ enum Command { #[structopt(parse(from_os_str))] dirname: PathBuf, }, - - CloudInitIso { - #[structopt(flatten)] - common: CommonOptions, - - #[structopt(parse(from_os_str))] - spec: PathBuf, - - #[structopt(parse(from_os_str))] - iso: PathBuf, - }, } #[derive(StructOpt, Debug)] @@ -83,8 +72,8 @@ fn main() -> anyhow::Result<()> { match cli.cmd { Command::New { common, spec } => { - let spec = get_spec(&common, &spec)?; - cmd::new(&spec)?; + let specs = get_specs(&common, &spec)?; + cmd::new(&specs)?; } Command::List { common } => { @@ -93,8 +82,8 @@ fn main() -> anyhow::Result<()> { } Command::Delete { common, spec } => { - let spec = get_spec(&common, &spec)?; - cmd::delete(&spec)?; + let specs = get_specs(&common, &spec)?; + cmd::delete(&specs)?; } Command::CloudInit { @@ -102,21 +91,17 @@ fn main() -> anyhow::Result<()> { spec, dirname, } => { - let spec = get_spec(&common, &spec)?; - cmd::cloud_init(&spec, &dirname)?; - } - Command::CloudInitIso { common, spec, iso } => { - let spec = get_spec(&common, &spec)?; - cmd::cloud_init_iso(&spec, &iso)?; + let specs = get_specs(&common, &spec)?; + cmd::cloud_init(&specs, &dirname)?; } } Ok(()) } -fn get_spec(common: &CommonOptions, spec: &Path) -> anyhow::Result<Specification> { +fn get_specs(common: &CommonOptions, spec: &Path) -> anyhow::Result<Vec<Specification>> { let config = config(&common)?; - let spec = Specification::from_file(&config, &spec)?; - Ok(spec) + let specs = Specification::from_file(&config, &spec)?; + Ok(specs) } fn config(common: &CommonOptions) -> anyhow::Result<Configuration> { |