From: Ian Campbell <ian.campbell@citrix.com>
To: Ian Jackson <ian.jackson@eu.citrix.com>, xen-devel@lists.xenproject.org
Subject: Re: [OSSTEST PATCH 4/7] Schema: Introduce mg-schema-create
Date: Thu, 10 Dec 2015 15:08:47 +0000 [thread overview]
Message-ID: <1449760127.9759.73.camel@citrix.com> (raw)
In-Reply-To: <1449755513-4166-5-git-send-email-ian.jackson@eu.citrix.com>
On Thu, 2015-12-10 at 13:51 +0000, Ian Jackson wrote:
> There is a fair amount of option parsing clobber here that will be
> relevant shortly.
How dangerous is this script if you just run it e.g. without with_test?
Specifically, would it nuke an existing database?
>
> Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
> ---
> mg-schema-create | 61
> +++++++++++++++++++++++++++++++++++++++++++++++
> mg-schema-test-database | 2 +-
> 2 files changed, 62 insertions(+), 1 deletion(-)
> create mode 100755 mg-schema-create
>
> diff --git a/mg-schema-create b/mg-schema-create
> new file mode 100755
> index 0000000..54f1c76
> --- /dev/null
> +++ b/mg-schema-create
> @@ -0,0 +1,61 @@
> +#!/bin/bash
> +
> +# This is part of "osstest", an automated testing framework for Xen.
> +# Copyright (C) 2009-2015 Citrix Inc.
> +#
> +# This program is free software: you can redistribute it and/or modify
> +# it under the terms of the GNU Affero General Public License as
> published by
> +# the Free Software Foundation, either version 3 of the License, or
> +# (at your option) any later version.
> +#
> +# This program is distributed in the hope that it will be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> +# GNU Affero General Public License for more details.
> +#
> +# You should have received a copy of the GNU Affero General Public
> License
> +# along with this program. If not, see <http://www.gnu.org/licenses/>.
> +
> +
> +# Usages:
> +#
> +# ./mg-schema-create [<options>]
> +#
> +# Database must already exist. (Ie, mg-schema-create does not
> +# do CREATE DATABASE.)
> +#
> +# When setting up a production database, mg-schema-create should
> +# be run *AS THE ROLE USER* who is to own all the resources.
> +#
> +# Options:
> +#
> +# -q don't print progress messages
> +
> +set -e
> +set -o posix
> +set -o pipefail
> +
> +progress () { printf "%s\n" "$*"; }
> +progress=progress
> +quietopt=''
> +
> +while [ $# != 0 ]; do
> + arg=$1; shift
> + case "$arg" in
> + -q)
> + progress=:
> + quietopt=-q
> + ;;
> + *)
> + echo >&2 "bad usage ($arg)"; exit 127
> + ;;
> + esac
> +done
> +
> +. ./cri-getconfig
> +
> +$progress "Populating database..."
> +
> +$(get_psql_cmd) $quietopt -f schema/initial.sql
> +
> +$progress "Database set up."
> diff --git a/mg-schema-test-database b/mg-schema-test-database
> index c68b1d2..3616c4d 100755
> --- a/mg-schema-test-database
> +++ b/mg-schema-test-database
> @@ -391,7 +391,7 @@ END
> psql_do <<END
> CREATE DATABASE $dbname;
> END
> - $(withtest get_psql_cmd) -q -f schema/initial.sql
> + withtest ./mg-schema-create -q
>
> printf ".\n"
>
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2015-12-10 15:09 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-10 13:51 [OSSTEST PATCH 0/7] Support database schema updates Ian Jackson
2015-12-10 13:51 ` [OSSTEST PATCH 1/7] mg-schema-test-database: Fix argument parsing for _SUFFIX Ian Jackson
2015-12-10 15:04 ` Ian Campbell
2015-12-10 13:51 ` [OSSTEST PATCH 2/7] Schema: Rename schema file Ian Jackson
2015-12-10 15:04 ` Ian Campbell
2015-12-10 13:51 ` [OSSTEST PATCH 3/7] Schema: Remove SET OWNER and GRANT/REVOKE from schema/initial.sql Ian Jackson
2015-12-10 15:07 ` Ian Campbell
2015-12-10 15:16 ` Ian Jackson
2015-12-10 13:51 ` [OSSTEST PATCH 4/7] Schema: Introduce mg-schema-create Ian Jackson
2015-12-10 15:08 ` Ian Campbell [this message]
2015-12-10 15:19 ` Ian Jackson
2015-12-10 15:34 ` [OSSTEST PATCH 8/7] Schema: When creating, check that no updates are applied Ian Jackson
2015-12-10 15:46 ` Ian Campbell
2015-12-10 13:51 ` [OSSTEST PATCH 5/7] Schema: Support database schema updates Ian Jackson
2015-12-10 15:43 ` Ian Campbell
2015-12-10 16:46 ` Ian Jackson
2015-12-10 13:51 ` [OSSTEST PATCH 6/7] Schema: Check that schema creation and update runs as the right user Ian Jackson
2015-12-10 15:45 ` Ian Campbell
2015-12-10 13:51 ` [OSSTEST PATCH 7/7] Schema: drop old resource_log table Ian Jackson
2015-12-10 15:46 ` 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=1449760127.9759.73.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.