xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Ian Campbell <ian.campbell@citrix.com>
To: Ian Jackson <ian.jackson@eu.citrix.com>, xen-devel@lists.xenproject.org
Subject: Re: [OSSTEST PATCH 15/16] mg-schema-test-database: Safety catch in JobDB database open
Date: Tue, 8 Dec 2015 11:16:15 +0000	[thread overview]
Message-ID: <1449573375.16124.51.camel@citrix.com> (raw)
In-Reply-To: <1449509254-27007-16-git-send-email-ian.jackson@eu.citrix.com>

On Mon, 2015-12-07 at 17:27 +0000, Ian Jackson wrote:
> When we open the `osstest' database, see whether this is a parent DB
> (main DB) from which a test DB has been spawned by this user.
> 
> If it has, bomb out, unless the user has specified a suitable regexp
> matching the DB name in the env var
>   OSSTEST_DB_USEREAL_IGNORETEST
> 
> This means that when a test database is in play, the user who created
> it cannot accidentally operate on the real DB.
> 
> The safety catch does not affect Tcl programs, which get the DB config
> directly, but in general that just means sg-execute-flight and
> sg-run-job which already have a fair amount of safety catch because
> they demand flight numbers.
> 
> mg-schema-test-database hits this feature over the head.  We assume
> that the caller of mg-schema-test-database knows what they are doing;
> particularly, that if they create nested test DBs (!), they do not
> need the assitance of this feature to stop themselves operating
> mg-schema-test-database incorrectly.  Anyone who creates nested test
> DBs will hopefully recognise the potential for confusion!
> 
> Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
> ---
>  Osstest/JobDB/Executive.pm |   33 ++++++++++++++++++++++++++++++++-
>  mg-schema-test-database    |    2 ++
>  2 files changed, 34 insertions(+), 1 deletion(-)
> 
> diff --git a/Osstest/JobDB/Executive.pm b/Osstest/JobDB/Executive.pm
> index 2572f5f..29dbc6f 100644
> --- a/Osstest/JobDB/Executive.pm
> +++ b/Osstest/JobDB/Executive.pm
> @@ -51,8 +51,39 @@ sub current_flight ($) { #method
>      return $ENV{'OSSTEST_FLIGHT'};
>  }
>  
> +sub _check_testdbs ($) {
> +    my ($dbh) = @_;
> +
> +    my $re = $ENV{OSSTEST_DB_USEREAL_IGNORETEST} // '';
> +    return if $re eq '.*'; # needed by mg-schema-test-database during
> setup
> +
> +    # mg-schema-test-database creates a task
> +    #   xdbref/DBNAME with username ${Username}@

Was there intended to be a wildcard or pattern of some sort after the @ in
this comment?

> +    my $sth = $dbh->prepare(<<END);
> +        SELECT refkey AS dbname,
> +               username, comment
> +            FROM tasks
> +	    WHERE type = 'xdbref'
> +	      AND live
> +	      AND username LIKE (? || '@%')

Nice of them to pick "||" as the string concatenation operator. It's almost
like they hate us C programmers...

Other than the comment thing above:
Acked-by: Ian Campbell <ian.campbell@citrix.com>


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

  reply	other threads:[~2015-12-08 11:17 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-07 17:27 (no subject) Ian Jackson
2015-12-07 17:27 ` [OSSTEST PATCH 01/16] tcl daemons: log host and port number we bind to, at startup Ian Jackson
2015-12-07 17:27 ` [OSSTEST PATCH 02/16] cri-getconfig: Break out exec_resetting_sigint Ian Jackson
2015-12-07 17:27 ` [OSSTEST PATCH 03/16] Configuration: No longer set password=<~/.xen-osstest/db-password> Ian Jackson
2015-12-07 17:27 ` [OSSTEST PATCH 04/16] mg-debug-fail: New utility script for debugging Ian Jackson
2015-12-07 17:27 ` [OSSTEST PATCH 05/16] mg-debug-fail: Catch attempts to read from a tty Ian Jackson
2015-12-07 17:27 ` [OSSTEST PATCH 06/16] cri-getconfig: Provide get_psql_cmd and get_pgdump_cmd Ian Jackson
2015-12-07 17:27 ` [OSSTEST PATCH 07/16] cri-getconfig: Provide debugging for get_psql_cmd Ian Jackson
2015-12-07 17:27 ` [OSSTEST PATCH 08/16] Osstest.pm: Break out and export globalconfigfiles Ian Jackson
2015-12-07 17:27 ` [OSSTEST PATCH 09/16] mg-schema-test-database: New script Ian Jackson
2015-12-08 11:06   ` Ian Campbell
2015-12-07 17:27 ` [OSSTEST PATCH 10/16] mg-schema-test-database: Move setting of test_cfg_setting to dbname Ian Jackson
2015-12-07 17:27 ` [OSSTEST PATCH 11/16] mg-schema-test-database: Sort out daemons; provide `daemons' subcommand Ian Jackson
2015-12-08 11:06   ` Ian Campbell
2015-12-07 17:27 ` [OSSTEST PATCH 12/16] Configuration: Introduce $c{Username} Ian Jackson
2015-12-08 11:07   ` Ian Campbell
2015-12-08 11:18   ` Ian Campbell
2015-12-07 17:27 ` [OSSTEST PATCH 13/16] mg-schema-test-database: Change username for back-to-main-db xref Ian Jackson
2015-12-08 11:09   ` Ian Campbell
2015-12-08 14:21     ` Ian Jackson
2015-12-07 17:27 ` [OSSTEST PATCH 14/16] mg-schema-test-database: Bump flight sequence number in test DB Ian Jackson
2015-12-08 11:10   ` Ian Campbell
2015-12-07 17:27 ` [OSSTEST PATCH 15/16] mg-schema-test-database: Safety catch in JobDB database open Ian Jackson
2015-12-08 11:16   ` Ian Campbell [this message]
2015-12-08 14:24     ` Ian Jackson
2015-12-07 17:27 ` [OSSTEST PATCH 16/16] mg-schema-test-database: Add workflow doc comment Ian Jackson
2015-12-08 11:19   ` Ian Campbell

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=1449573375.16124.51.camel@citrix.com \
    --to=ian.campbell@citrix.com \
    --cc=ian.jackson@eu.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).