[PATCH aeolus-configure, rev2] Bug 828515 - [RFE] Verify aeolus-cleanup command should be run
Steve Linabery
slinaber at redhat.com
Tue Sep 11 20:32:55 UTC 2012
On Tue, Sep 11, 2012 at 04:23:00PM -0400, John Eckersberg wrote:
> Steve Linabery <slinaber at redhat.com> writes:
> > Added command line options -y|--assumeyes to force operation.
> > If not provided, prompt user for confirmation to proceed.
> > ---
> > bin/aeolus-cleanup | 16 +++++++++++++---
> > docs/man1/aeolus-cleanup.1 | 3 +++
> > 2 files changed, 16 insertions(+), 3 deletions(-)
> >
> > diff --git a/bin/aeolus-cleanup b/bin/aeolus-cleanup
> > index eadc2ed..546d828 100755
> > --- a/bin/aeolus-cleanup
> > +++ b/bin/aeolus-cleanup
> > @@ -19,18 +19,19 @@ usage()
> > cat << EOF
> >
> > USAGE:
> > -aeolus-cleanup [-d|--debug] [-h|--help] [-v|--verbose] [-s|--savedata] [-p|--profile]
> > +aeolus-cleanup [-d|--debug] [-h|--help] [-v|--verbose] [-s|--savedata] [-y|--assumeyes] [-p|--profile]
> >
> > OPTIONS:
> > -h | --help Show this message.
> > -d | --debug Debug logging mode.
> > -v | --verbose Verbose logging mode.
> > -s | --savedata Do not delete existing data.
> > + -y | --assumeyes Assume yes; assume that the answer to any question which would be asked is yes.
> > -p | --profile Name of profile to use. A comma separated list can be used to specify multiple profiles.
> > EOF
> > }
> >
> > -args=`getopt -o :hdvsp: --long help,debug,verbose,savedata,profile -- "$@"`
> > +args=`getopt -o :hdvsyp: --long help,debug,verbose,savedata,assumeyes,profile -- "$@"`
> > if test $? != 0
> > then
> > usage
> > @@ -39,6 +40,7 @@ fi
> >
> > SAVE_DATA=false
> > PUPPET_NODE='default'
> > +ASSUME_YES=false
> >
> > eval set -- $args
> > while true ; do
> > @@ -46,13 +48,21 @@ while true ; do
> > -h|--help) usage ; exit 1 ; shift ;;
> > -d|--debug) LOGLEVEL="--debug" ; shift ;;
> > -v|--verbose) LOGLEVEL="--verbose" ; shift ;;
> > - -s|--savedata) SAVE_DATA=true ; shift ;;
> > + -s|--savedata) SAVE_DATA=true ; shift ;;
> > + -y|--assumeyes) ASSUME_YES=true ; shift ;;
> > -p|--profile) PUPPET_NODE=$2 ; shift ; shift ;;
> > --) shift ; break ;;
> > *) usage ; exit 1 ;;
> > esac
> > done
> >
> > +if [ $ASSUME_YES != true ]; then
> > + read -p "aeolus-cleanup will delete local aeolus installations. Are you sure you wish to proceed? [y/N]"
>
> Add a colon and extra space at the end here, otherwise the user input
> gets jammed right up against the closing ']'. Also it feels "off" to me
> somehow having the input so far off to the right in the terminal, maybe
> break this into two lines:
>
> echo "aeolus-cleanup will delete local aeolus installations."
> read -p "Are you sure you wish to proceed? [y/N]: "
>
> Then you'd get:
>
> aeolus-cleanup will delete local aeolus installations.
> Are you sure you wish to proceed? [y/N]: y
>
> instead of:
>
> aeolus-cleanup will delete local aeolus installations. Are you sure you wish to proceed? [y/N]y
>
> (For comparison, here's some similar output from yum)
>
> Total download size: 19 M
> Is this ok [y/N]: y
>
> > + if [[ $REPLY != "y" && $REPLY != "Y" ]]; then
> > + exit
> > + fi
> > +fi
> > +
> > export FACTER_AEOLUS_ENABLE_HTTPS=true
> > export FACTER_AEOLUS_ENABLE_SECURITY=false
> > export FACTER_AEOLUS_SAVE_DATA=$SAVE_DATA
> > diff --git a/docs/man1/aeolus-cleanup.1 b/docs/man1/aeolus-cleanup.1
> > index 1c2c71a..7a10852 100644
> > --- a/docs/man1/aeolus-cleanup.1
> > +++ b/docs/man1/aeolus-cleanup.1
> > @@ -20,6 +20,9 @@ Verbose logging mode.
> > \fB\-s\fR | \fB\-\-savedata\fR
> > Do not delete existing data.
> > .TP
> > +\fB\-y\fR | \fB\-\-assumeyes\fR
> > +Assume yes; assume that the answer to any question which would be asked is yes.
> > +.TP
> > \fB\-p\fR | \fB\-\-profile\fR
> > Name of profile to use. A comma separated list can be used to specify multiple profiles.
> > .SH "SEE ALSO"
> > --
> > 1.7.7.6
>
> The USAGE line in the manpage needs updated to include the new option as
> well.
>
> Besides that and the minor style nit above, looks good and works as
> advertised!
Agreed, will make these changes and push.
Thank you!
s|e
More information about the aeolus-devel
mailing list