[node-patches] Change in ovirt-node[master]: tools: Fix testable-node

fabiand at fedoraproject.org fabiand at fedoraproject.org
Mon May 6 17:32:40 UTC 2013


Fabian Deutsch has uploaded a new change for review.

Change subject: tools: Fix testable-node
......................................................................

tools: Fix testable-node

Previously the arguments weren't parsed correctly.

Change-Id: I3996c4d376c161384345445166b33cdd9ef54617
Signed-off-by: Fabian Deutsch <fabiand at fedoraproject.org>
---
M tools/testable-node
1 file changed, 29 insertions(+), 14 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/16/14516/1

diff --git a/tools/testable-node b/tools/testable-node
index 2b3d253..d4e0005 100755
--- a/tools/testable-node
+++ b/tools/testable-node
@@ -21,17 +21,18 @@
 isoname=""
 verbose=""
 reponame=""
+dry=false
 
 IGORPLUGIN=ovirt-node-plugin-igor-slave
 
 
-
 show_usage()
 {
-    echo "Usage: $0 [-v] [-r <.repo-file>] -i <isoname>"
+    echo "Usage: $0 [-vd] [-r <.repo-file>] -i <isoname>"
     echo " -i    ISO file to be edited"
     echo " -v    Be verbose"
     echo " -r    Additional .repo file"
+    echo " -d    Dry - don't execute edit-node"
     echo ""
     echo "$0 can be used to add the $IGORPLUGIN to a "
     echo "given ISO so it can be tested within an igor setup."
@@ -45,9 +46,15 @@
     exit 1
 }
 
+log()
+{
+    echo -e "$(date +"%F %T") $@"
+}
+
 _parse_opts()
 {
-    while getopts "h?vi:r:" opt;
+    log "Parsing args: $@"
+    while getopts "h?vdi:r:" opt;
     do
         case "$opt" in
         h|\?)
@@ -60,10 +67,12 @@
             ;;
         r)  reponame=$OPTARG
             ;;
+        d)  dry=true
+            ;;
         esac
     done
 
-    [[ -z "$ISONAME" ]] && die "<isoname> is missing"
+    [[ -e "$isoname" ]] || die "<isoname> is missing or does not exist"
 
     shift $((OPTIND-1))
 
@@ -74,20 +83,26 @@
 {
     TMPREPO=igor.repo
 
-    _parse_opts
+    _parse_opts "$@"
 
+    log "Generating temporary repository file: $TMPREPO"
     cmds="s/^\[/\[igor-/ ; /^mirrorlist/d ; s/^#base/base/ ; s/https:/http:/"
-    sed "$cmds" /etc/yum.repos.d/*.repo > $TMPREPO
+    sed "$cmds" /etc/yum.repos.d/*.repo $reponame > $TMPREPO
 
-    [[ ! -z "$reponame" ]] && cat "$reponame" >> $TMPREPO
+    ARGS="$verbose "
+    ARGS+="--repo $TMPREPO "
+    ARGS+="--install $IGORPLUGIN "
+    ARGS+="--nogpgcheck "
+    ARGS+="'$isoname'"
 
-    ./edit-node $verbose \
-      --repo $TMPREPO \
-      --install $IGORPLUGIN \
-      --nogpgcheck \
-      "$isoname"
+    log "Launching edit-node $ARGS"
+    log "Dry: $dry"
+    $dry || ./edit-node $ARGS
 
-    unlink $TMPREPO
+    # Keep temporary repo when in verbose mode
+    [[ "$verbose" ]] || unlink $TMPREPO
+
+    log "Done"
 }
 
-main
\ No newline at end of file
+main "$@"
\ No newline at end of file


--
To view, visit http://gerrit.ovirt.org/14516
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3996c4d376c161384345445166b33cdd9ef54617
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Fabian Deutsch <fabiand at fedoraproject.org>



More information about the node-patches mailing list