[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [OSSTEST PATCH 4/7] Schema: Introduce mg-schema-create
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@xxxxxxxxxxxxx> > --- > Â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@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |