[pbs-devel] [PATCH proxmox-backup 5/8] apt: let api handle optional bool with default
Fabian Grünbichler
f.gruenbichler at proxmox.com
Wed Jan 20 17:23:52 CET 2021
one less FIXME :)
Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
---
src/api2/node/apt.rs | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/src/api2/node/apt.rs b/src/api2/node/apt.rs
index 52eeb976..9d723f17 100644
--- a/src/api2/node/apt.rs
+++ b/src/api2/node/apt.rs
@@ -107,16 +107,13 @@ fn do_apt_update(worker: &WorkerTask, quiet: bool) -> Result<(), Error> {
)]
/// Update the APT database
pub fn apt_update_database(
- notify: Option<bool>,
- quiet: Option<bool>,
+ notify: bool,
+ quiet: bool,
rpcenv: &mut dyn RpcEnvironment,
) -> Result<String, Error> {
let auth_id: Authid = rpcenv.get_auth_id().unwrap().parse()?;
let to_stdout = rpcenv.env_type() == RpcEnvironmentType::CLI;
- // FIXME: change to non-option in signature and drop below once we have proxmox-api-macro 0.2.3
- let quiet = quiet.unwrap_or(API_METHOD_APT_UPDATE_DATABASE_PARAM_DEFAULT_QUIET);
- let notify = notify.unwrap_or(API_METHOD_APT_UPDATE_DATABASE_PARAM_DEFAULT_NOTIFY);
let upid_str = WorkerTask::new_thread("aptupdate", None, auth_id, to_stdout, move |worker| {
do_apt_update(&worker, quiet)?;
--
2.20.1
More information about the pbs-devel
mailing list