Hello Eli Mesika,
I'd like you to do a code review. Please visit
http://gerrit.ovirt.org/18405
to review the following change.
Change subject: core: unlock_entity script should validate...
......................................................................
core: unlock_entity script should validate...
unlock_entity script should validate command line before asking confirmation
Change-Id: I1c7011b97e6796e096a8985180138d6ae7447270
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=974924
Signed-off-by: Eli Mesika <[email protected]>
---
M packaging/dbscripts/unlock_entity.sh
1 file changed, 15 insertions(+), 11 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/05/18405/1
diff --git a/packaging/dbscripts/unlock_entity.sh
b/packaging/dbscripts/unlock_entity.sh
index c256e31..dbbe138 100755
--- a/packaging/dbscripts/unlock_entity.sh
+++ b/packaging/dbscripts/unlock_entity.sh
@@ -33,6 +33,20 @@
fi
}
+caution() {
+ if [ ! -n "${QUERY}" ]; then
+ echo "Caution, this operation may lead to data corruption and should
be used with care. Please contact support prior to running this command"
+ echo "Are you sure you want to proceed? [y/n]"
+ read answer
+
+ if [ "${answer}" = "n" ]; then
+ echo "Please contact support for further assistance."
+ popd>/dev/null
+ exit 1
+ fi
+ fi
+}
+
while getopts :ht:s:d:u:p:l:f:qrv option; do
case $option in
t) TYPE=$OPTARG;;
@@ -52,19 +66,9 @@
shift $(( OPTIND - 1 ))
IDS="$@"
-if [ ! -n "${QUERY}" ]; then
- echo "Caution, this operation may lead to data corruption and should be
used with care. Please contact support prior to running this command"
- echo "Are you sure you want to proceed? [y/n]"
- read answer
-
- if [ "${answer}" = "n" ]; then
- echo "Please contact support for further assistance."
- popd>/dev/null
- exit 1
- fi
-fi
if [[ -n "${TYPE}" && -n "${IDS}" ]]; then
+ caution
for ID in ${IDS} ; do
unlock_entity "${TYPE}" "${ID}" "$(whoami)" ${RECURSIVE}
done
--
To view, visit http://gerrit.ovirt.org/18405
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I1c7011b97e6796e096a8985180138d6ae7447270
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.3
Gerrit-Owner: Yair Zaslavsky <[email protected]>
Gerrit-Reviewer: Eli Mesika <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches