sysprep: Check --{keep,remove}-user-accounts parameters are not used when operation is disabled (RHBZ#1141157).

You will see an error like this:

$ virt-sysprep --remove-user-accounts foo,bar -a /dev/null
virt-sysprep: error: user-accounts: --remove-user-accounts parameter was
used, but the "user-account" operation is not enabled
This commit is contained in:
Richard W.M. Jones
2014-09-12 16:39:55 +01:00
parent 5066fde8f2
commit 3729bc1fe1

View File

@@ -134,6 +134,11 @@ This option can be specified multiple times."
};
];
perform_on_filesystems = Some user_account_perform;
not_enabled_check_args = fun () ->
if not (StringSet.is_empty !keep_users) then
error ~prog (f_"user-accounts: --keep-user-accounts parameter was used, but the \"user-account\" operation is not enabled");
if not (StringSet.is_empty !remove_users) then
error ~prog (f_"user-accounts: --remove-user-accounts parameter was used, but the \"user-account\" operation is not enabled");
}
let () = register_operation op