]> xenbits.xensource.com Git - people/liuw/osstest.git/commitdiff
cri-getconfig: Provide get_psql_cmd and get_pgdump_cmd
authorIan Jackson <ian.jackson@eu.citrix.com>
Fri, 4 Dec 2015 18:03:30 +0000 (18:03 +0000)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Tue, 8 Dec 2015 14:51:02 +0000 (14:51 +0000)
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@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
---
v2: Fix typo in comment.

cri-getconfig

index ee1cc40aa80749c8bb97ec2f43a28e37b403d69b..973f1c010c3b873bf6d6568ec3b804a721a458a8 100644 (file)
@@ -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