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

[Xen-devel] [OSSTEST PATCH] anointments: Provide ./mg-anoint list-prepared



CC: Roger Pau Monne <roger.pau@xxxxxxxxxx>
Signed-off-by: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
---
 mg-anoint | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/mg-anoint b/mg-anoint
index 4bb8ab0..837e608 100755
--- a/mg-anoint
+++ b/mg-anoint
@@ -20,6 +20,9 @@
 #         if nothing anointed yet, prints nothing and exits 0
 #         if anointment not prepared, fails
 #
+#  ./mg-anoint list-prepared REFKEY-GLOB
+#      => possibly empty list of REFKEYs
+#
 #  ./mg-anoint list
 #      => human-readable output
 
@@ -65,6 +68,7 @@ use Osstest;
 use Osstest::TestSupport;
 use Osstest::Executive;
 use IO::Handle;
+use Text::Glob qw(glob_to_regex);
 
 csreadconfig();
 
@@ -337,6 +341,31 @@ END
     pr_o();
 }
 
+sub cmd_list_prepared {
+    die unless @ARGV==1;
+    die if $ARGV[0] =~ m/^-/;
+    my ($pat) = @ARGV;
+    my $re = glob_to_regex $pat;
+
+    my $tq = $dbh_tests->prepare(<<END);
+        SELECT *
+          FROM tasks
+         WHERE type = 'anoint'
+      ORDER BY refkey
+END
+
+    db_retry($dbh_tests, [], sub {
+        @o = ();
+        db_readonly_report();
+       $tq->execute();
+       while (my $t = $tq->fetchrow_hashref()) {
+           next unless $t->{refkey} =~ m{$re}o;
+           push @o, $t->{refkey};
+       }
+    });
+    pr_o();
+}
+
 die 'need operation' unless @ARGV;
 die 'no global options understood' if $ARGV[0] =~ m/^-/;
 
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

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