diff options
author | Lars Wirzenius <liw@liw.fi> | 2021-07-25 10:45:27 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2021-07-25 11:44:44 +0300 |
commit | 40f951a3adbbba94942e007434946a2192eb8989 (patch) | |
tree | 47653653c827b3899d95a4bf37e8ce5d528c02ff /src/cmd | |
parent | be53a50f86c3f9dcbc003d2ced9824829ee81f19 (diff) | |
download | vmadm-40f951a3adbbba94942e007434946a2192eb8989.tar.gz |
feat: allow use to add a VM on virtual networks
Sponsored-by: author
Diffstat (limited to 'src/cmd')
-rw-r--r-- | src/cmd/config.rs | 4 | ||||
-rw-r--r-- | src/cmd/spec.rs | 10 |
2 files changed, 8 insertions, 6 deletions
diff --git a/src/cmd/config.rs b/src/cmd/config.rs index 396f089..0a78a64 100644 --- a/src/cmd/config.rs +++ b/src/cmd/config.rs @@ -6,7 +6,9 @@ use crate::config::Configuration; /// The `config` sub-command. /// -/// Write the actual run-time configuration to stdout. +/// Write the actual run-time configuration to stdout as JSON. We +/// convert the config to JSON to make it clear we parse it the right +/// way. pub fn config(config: &Configuration) -> Result<(), std::io::Error> { let config = serde_json::to_vec(&config).unwrap(); std::io::stdout().write_all(&config)?; diff --git a/src/cmd/spec.rs b/src/cmd/spec.rs index b41f234..7922cb5 100644 --- a/src/cmd/spec.rs +++ b/src/cmd/spec.rs @@ -6,11 +6,11 @@ use crate::spec::Specification; /// The `spec` sub-command. /// -/// Write the actual VM specifications to stdout. +/// Write the actual VM specifications to stdout as JSON. We convert +/// the spec to JSON to make it more clear that we parse the config +/// and spec in the right way. pub fn spec(specs: &[Specification]) -> Result<(), std::io::Error> { - for spec in specs { - let spec = serde_yaml::to_vec(&spec).unwrap(); - std::io::stdout().write_all(&spec)?; - } + let spec = serde_json::to_vec(specs).unwrap(); + std::io::stdout().write_all(&spec)?; Ok(()) } |