diff --git a/src/api2/node/apt.rs b/src/api2/node/apt.rs index 500b2309..765ea525 100644 --- a/src/api2/node/apt.rs +++ b/src/api2/node/apt.rs @@ -261,7 +261,7 @@ fn apt_get_changelog( }, )] /// Get package information for important Proxmox Backup Server packages. -pub fn get_versions() -> Result { +pub fn get_versions() -> Result, Error> { const PACKAGES: &[&str] = &[ "ifupdown2", "libjs-extjs", @@ -350,7 +350,7 @@ pub fn get_versions() -> Result { } } - Ok(json!(packages)) + Ok(packages) } const SUBDIRS: SubdirMap = &[ diff --git a/src/bin/proxmox-backup-manager.rs b/src/bin/proxmox-backup-manager.rs index 84ec0148..80e699f1 100644 --- a/src/bin/proxmox-backup-manager.rs +++ b/src/bin/proxmox-backup-manager.rs @@ -383,14 +383,8 @@ async fn report() -> Result { async fn get_versions(verbose: bool, param: Value) -> Result { let output_format = get_output_format(¶m); - let mut packages = if verbose { - crate::api2::node::apt::get_versions()? - } else { - // TODO: slice first element out in a nicer way? - let packages = crate::api2::node::apt::get_versions()?; - let packages = packages.as_array().unwrap(); - Value::Array(vec![packages[0].to_owned()]) - }; + let packages = crate::api2::node::apt::get_versions()?; + let mut packages = json!(if verbose { &packages[..] } else { &packages[0..1] }); let options = default_table_format_options() .disable_sort()