[PATCH aeolus-configure, rev2] Bug 828515 - [RFE] Verify aeolus-cleanup command should be run

Steve Linabery slinaber at redhat.com
Tue Sep 11 19:37:47 UTC 2012


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]"
+  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




More information about the aeolus-devel mailing list