From: Ian Jackson <ian.jackson@eu.citrix.com>
To: xen-devel@lists.xenproject.org
Cc: "Ian Jackson" <Ian.Jackson@eu.citrix.com>,
"Roger Pau Monné" <roger.pau@citrix.com>
Subject: [OSSTEST PATCH 07/10] mg-anoint: Make readonly operations "work" in standalone mode
Date: Thu, 17 May 2018 12:16:56 +0100 [thread overview]
Message-ID: <1526555819-29883-8-git-send-email-ian.jackson@eu.citrix.com> (raw)
In-Reply-To: <1526555819-29883-1-git-send-email-ian.jackson@eu.citrix.com>
This makes `mg-anoint' in standalone mode a view onto an empty set of
anointments. So now it becomes ok to call mg-anoint in make-*-flight.
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
CC: Roger Pau Monné <roger.pau@citrix.com>
---
Osstest/JobDB/Executive.pm | 2 ++
Osstest/JobDB/Standalone.pm | 2 ++
mg-anoint | 20 +++++++++++++++++++-
3 files changed, 23 insertions(+), 1 deletion(-)
diff --git a/Osstest/JobDB/Executive.pm b/Osstest/JobDB/Executive.pm
index a7a6696..fe8e7f6 100644
--- a/Osstest/JobDB/Executive.pm
+++ b/Osstest/JobDB/Executive.pm
@@ -409,4 +409,6 @@ sub jobdb_db_glob ($$) { #method
return "LIKE E'$str'";
}
+sub can_anoint ($) { return 1; }
+
1;
diff --git a/Osstest/JobDB/Standalone.pm b/Osstest/JobDB/Standalone.pm
index d9a90fc..4f320cc 100644
--- a/Osstest/JobDB/Standalone.pm
+++ b/Osstest/JobDB/Standalone.pm
@@ -133,4 +133,6 @@ sub jobdb_db_glob ($) { #method
return "GLOB '$str'";
}
+sub can_anoint ($) { return 0; }
+
1;
diff --git a/mg-anoint b/mg-anoint
index b007ab4..522cbdd 100755
--- a/mg-anoint
+++ b/mg-anoint
@@ -66,7 +66,6 @@ use DBI;
BEGIN { unshift @INC, qw(.); }
use Osstest;
use Osstest::TestSupport;
-use Osstest::Executive;
use IO::Handle;
use Text::Glob qw(glob_to_regex);
@@ -93,6 +92,15 @@ END
our $task_q;
our $mostrecent_q;
+sub empty_unless_can_anoint () {
+ return if $mjobdb->can_anoint();
+ exit 0;
+}
+sub fail_unless_can_anoint () {
+ return if $mjobdb->can_anoint();
+ die "anointments not supported in this mode ($c{JobDB})\n"
+}
+
sub prep_queries {
$task_q = $dbh_tests->prepare(<<END);
SELECT taskid, refinfo FROM tasks WHERE type='anoint' AND refkey=?
@@ -121,6 +129,9 @@ sub cmd_prepare {
}
die "usage: mg-anoint prepare [OPTIONS] 'SCOPE DETAILS...' DESCRIPTION"
unless @ARGV==2 || $ARGV[0] =~ m/ /;
+
+ fail_unless_can_anoint();
+
my ($refkey, $description) = @ARGV;
my $dq = $dbh_tests->prepare(<<END);
DELETE FROM tasks WHERE type='anoint' AND refkey=?
@@ -142,6 +153,7 @@ sub cmd_destroy {
die unless @ARGV==1;
die if $ARGV[0] =~ m/^-/;
my ($refkey) = @ARGV;
+ fail_unless_can_anoint();
my $rdq = $dbh_tests->prepare(<<END);
DELETE FROM resources
WHERE restype='share-flight'
@@ -178,6 +190,7 @@ sub cmd_anoint {
die unless @ARGV==3;
my ($refkey, $flight, $job) = @ARGV;
+ fail_unless_can_anoint();
prep_queries();
my $newflight_q = $dbh_tests->prepare(<<END);
@@ -285,6 +298,7 @@ sub cmd_retrieve {
die if $ARGV[0] =~ m/^-/;
my ($refkey) = @ARGV;
+ empty_unless_can_anoint();
prep_queries();
db_retry($dbh_tests, [], sub {
@@ -307,6 +321,8 @@ sub cmd_retrieve {
sub cmd_list {
die "no options to list" if @ARGV;
+ empty_unless_can_anoint();
+
my $tq = $dbh_tests->prepare(<<END);
SELECT *
FROM tasks
@@ -347,6 +363,8 @@ sub cmd_list_prepared {
my ($pat) = @ARGV;
my $re = glob_to_regex $pat;
+ empty_unless_can_anoint();
+
my $tq = $dbh_tests->prepare(<<END);
SELECT *
FROM tasks
--
2.1.4
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next prev parent reply other threads:[~2018-05-17 11:17 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-17 11:16 [OSSTEST PATCH 00/10] UEFI and commissioning fixes Ian Jackson
2018-05-17 11:16 ` [OSSTEST PATCH 01/10] Osstest/TestSupport: Use right arch for UEFI grub setup Ian Jackson
2018-05-17 11:16 ` [OSSTEST PATCH 02/10] Osstest/Debian: preseed: Force UEFI install regardless Ian Jackson
2018-05-17 11:16 ` [OSSTEST PATCH 03/10] README.dev: Fix a typo Ian Jackson
2018-05-17 11:16 ` [OSSTEST PATCH 04/10] README.dev: Discuss setting Firmware for UEFI machines Ian Jackson
2018-05-17 11:16 ` [OSSTEST PATCH 05/10] README.dev: Make example commisioning runes use $hn variable Ian Jackson
2018-05-17 11:16 ` [OSSTEST PATCH 06/10] Perl @INC path: fix a few more scripts to use BEGIN Ian Jackson
2018-05-17 12:53 ` Roger Pau Monné
2018-05-17 11:16 ` Ian Jackson [this message]
2018-05-17 14:20 ` [OSSTEST PATCH 07/10] mg-anoint: Make readonly operations "work" in standalone mode Roger Pau Monné
2018-05-17 11:16 ` [OSSTEST PATCH 08/10] mg-anoint: Support mg-anoint retrieve --tolerate-unprepared Ian Jackson
2018-05-17 14:22 ` Roger Pau Monné
2018-05-17 11:16 ` [OSSTEST PATCH 09/10] mfi-common: set_freebsd_runvars: Never set freebsd_distpath to `/amd64' etc Ian Jackson
2018-05-17 14:26 ` Roger Pau Monné
2018-05-17 11:16 ` [OSSTEST PATCH 10/10] mfi-common: Fall back to anointed builds in Executive mode Ian Jackson
2018-05-17 14:29 ` Roger Pau Monné
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1526555819-29883-8-git-send-email-ian.jackson@eu.citrix.com \
--to=ian.jackson@eu.citrix.com \
--cc=roger.pau@citrix.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).