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

[Xen-devel] [OSSTEST PATCH 06/16] cri-getconfig: Provide get_psql_cmd and get_pgdump_cmd



This is for (non-standalone-mode) shell scripts which want to access
the postgresql database.

get_psql_command provides `-v ON_ERROR_STOP' because it is not the
default (!) and no sane caller would not want it.

No callers as yet.

Signed-off-by: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
v2: Fix typo in comment.
---
 cri-getconfig |   33 ++++++++++++++++++++++++++++++++-
 1 file changed, 32 insertions(+), 1 deletion(-)

diff --git a/cri-getconfig b/cri-getconfig
index ee1cc40..973f1c0 100644
--- a/cri-getconfig
+++ b/cri-getconfig
@@ -40,7 +40,38 @@ getrepos() {
        echo $repos
 }
 
-# Good grief, handling background proceesses from shell is a pain.
+get_psql_cmd () {
+       perl -we '
+       use Osstest;
+       use Osstest::Executive;
+       use DBI;
+       csreadconfig();
+       print "psql",
+            " -d ", $dbh_tests->{pg_db},
+            " -h ", $dbh_tests->{pg_host},
+            " -p ", $dbh_tests->{pg_port},
+            " -U ", $dbh_tests->{pg_user},
+            " -v ON_ERROR_STOP=1\n"
+            or die $!;
+'
+}
+
+get_pgdump_cmd () {
+       perl -we '
+       use Osstest;
+       use Osstest::Executive;
+       use DBI;
+       csreadconfig();
+       print "pg_dump",
+            " -h ", $dbh_tests->{pg_host},
+            " -p ", $dbh_tests->{pg_port},
+            " -U ", $dbh_tests->{pg_user},
+            " ",    $dbh_tests->{pg_db}, "\n"
+            or die $!;
+'
+}
+
+# Good grief, handling background processes from shell is a pain.
 #
 # For stupid historical reasons, background processes start with
 # SIGINT (and QUIT) ignored (SuSv3 2.11).  bash does not currently
-- 
1.7.10.4


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


 


Rackspace

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