[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [OSSTEST PATCH 08/10] mg-anoint: Support mg-anoint retrieve --tolerate-unprepared



make-*-flight is going to want this.

Signed-off-by: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
CC: Roger Pau Monné <roger.pau@xxxxxxxxxx>
---
 mg-anoint | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/mg-anoint b/mg-anoint
index 522cbdd..d09124b 100755
--- a/mg-anoint
+++ b/mg-anoint
@@ -15,10 +15,12 @@
 #        --allow-blessed=BLESSING,...       default is from `prepare'
 #        --allow-job-status=STATUS,...      default is only `pass'
 #
-#  ./mg-anoint retrieve REFKEY
+#  ./mg-anoint retrieve [--tolerate-unprepared] REFKEY
 #      => FLIGHT JOB
 #         if nothing anointed yet, prints nothing and exits 0
 #         if anointment not prepared, fails
+#      With --tolerate-unprepared, it is not an error if nothing is
+#      reported because the anointment has not been prepared.
 #
 #  ./mg-anoint list-prepared REFKEY-GLOB
 #      => possibly empty list of REFKEYs
@@ -294,6 +296,11 @@ END
 }    
 
 sub cmd_retrieve {
+    my $tolerate_unprepared;
+    if (@ARGV && $ARGV[0] eq '--tolerate-unprepared') {
+       shift @ARGV;
+       $tolerate_unprepared = 1;
+    }
     die unless @ARGV==1;
     die if $ARGV[0] =~ m/^-/;
     my ($refkey) = @ARGV;
@@ -305,7 +312,8 @@ sub cmd_retrieve {
         @o = ();
         $task_q->execute($refkey);
        my ($task) = $task_q->fetchrow_array();
-       die "no such anointment kind \`$refkey'" unless defined $task;
+       die "no such anointment kind \`$refkey'"
+           unless defined $task or $tolerate_unprepared;
 
        $mostrecent_q->execute($task);
        my $row = $mostrecent_q->fetchrow_hashref();
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.