[Pkg-libvirt-commits] [libguestfs] 29/40: sysprep: Check --{keep, remove}-user-accounts parameters are not used when operation is disabled (RHBZ#1141157).

Hilko Bengen bengen at moszumanska.debian.org
Fri Oct 3 14:44:53 UTC 2014


This is an automated email from the git hooks/post-receive script.

bengen pushed a commit to annotated tag debian/1%1.27.44-1
in repository libguestfs.

commit 3729bc1fe1726abda7576fdd6243a47ac96de5fe
Author: Richard W.M. Jones <rjones at redhat.com>
Date:   Fri Sep 12 16:39:55 2014 +0100

    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
---
 sysprep/sysprep_operation_user_account.ml | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/sysprep/sysprep_operation_user_account.ml b/sysprep/sysprep_operation_user_account.ml
index c514286..2d231cd 100644
--- a/sysprep/sysprep_operation_user_account.ml
+++ b/sysprep/sysprep_operation_user_account.ml
@@ -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

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-libvirt/libguestfs.git



More information about the Pkg-libvirt-commits mailing list