add dryrun and quiet options
Change-Id: I95bebc532389208e9e3bbd952095d75bf0dac763
This commit is contained in:
parent
117d47ca31
commit
6492a37e76
@ -1,11 +1,35 @@
|
||||
#!/bin/bash
|
||||
|
||||
usage() {
|
||||
echo "Usage: $0 [-n] [-q]"
|
||||
echo "-n: Dry Run. Don't update the database"
|
||||
echo "-q: Quiet mode. Only show incorrect quotas"
|
||||
exit 1
|
||||
}
|
||||
|
||||
while getopts ":nq" opt ; do
|
||||
case ${opt} in
|
||||
n)
|
||||
base_msg="[DRY RUN] "
|
||||
args="${args} -n"
|
||||
;;
|
||||
q)
|
||||
args="${args} -q"
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
|
||||
echo "$(date): Tenant quota correction - started"
|
||||
|
||||
for x in $(keystone --insecure tenant-list | awk -F' |\
|
||||
' '!/^\+/ && !/\ id\ / {print $2}'); do
|
||||
echo "Correcting quota for tenant $x"
|
||||
python /root/scripts/auto-fix-quota.py --tenant $x
|
||||
msg="${base_msg}Correcting quota for tenant ${x}"
|
||||
echo ${msg}
|
||||
python ./auto-fix-quota.py ${args} --tenant ${x}
|
||||
done
|
||||
|
||||
echo "$(date): Tenant quota correction - finished"
|
||||
|
Loading…
x
Reference in New Issue
Block a user