On Wed, Sep 11, 2013 at 12:27 PM, Klaus Aehlig <[email protected]> wrote:

> Before doing any changes, make tools/users-setup explain its
> actions first, and ask the user for confirmation. If the first
> argument is -y, this step will be skipped.
>

Most ganeti CLI tools use --yes-do-it instead of -y as the parameter to
perform these safety checks. Shouldn't we do the same here?


>
> Signed-off-by: Klaus Aehlig <[email protected]>
> ---
>  Makefile.am | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
>
> diff --git a/Makefile.am b/Makefile.am
> index f199456..33c7fff 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -1381,6 +1381,19 @@ tools/kvm-ifup: tools/kvm-ifup.in$(REPLACE_VARS_SED)
>  tools/users-setup: Makefile $(userspecs)
>         set -e; \
>         { echo '#!/bin/sh'; \
> +         echo 'if [ "x$$1" != "x-y" ];'; \
> +         echo 'then echo "This will do the following changes"'; \
> +         $(AWK) -- '{print "echo + Will add group ",$$1; count++}\
> +                    END {if (count ==0) {print "echo + No groups to
> add"}}' doc/users/groups; \
>

Missing whitespace between == and 0

+         $(AWK) -- '{if (NF > 1) {print "echo + Will add user",$$1,"with
> pimary group",$$2} \
>

s/pimary/primary


> +                                 else {print "echo + Will add user",$$1};
> count++}\
> +                    END {if (count == 0) {print "echo + No users to
> add"}}' doc/users/users; \
> +         $(AWK) -- '{print "echo + Will add user",$$1,"to group",$$2}'
> doc/users/groupmemberships; \
> +         echo 'echo'; \
> +         echo 'echo "OK? (y/n)"'; \
> +         echo 'read confirm'; \
> +         echo 'if [ "x$$confirm" != "xy" ]; then exit 0; fi'; \
> +         echo 'fi'; \
>           $(AWK) -- '{print "addgroup --system",$$1}' doc/users/groups; \
>           $(AWK) -- '{if (NF > 1) {print "adduser --system
> --ingroup",$$2,$$1} else {print "adduser --system",$$1}}' doc/users/users; \
>           $(AWK) -- '{print "adduser",$$1,$$2}'
> doc/users/groupmemberships; \
> --
> 1.8.4
>
>
Thanks,
Michele

-- 
Google Germany GmbH
Dienerstr. 12
80331 München

Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg
Geschäftsführer: Graham Law, Christine Elizabeth Flores

Reply via email to