From: Ian Jackson Subject: [OSSTEST PATCH 06/11] cri-getconfig: Provide get_psql_cmd and get_pgdump_cmd Date: Fri, 4 Dec 2015 19:35:29 +0000 Message-ID: <1449257734-26860-7-git-send-email-ian.jackson@eu.citrix.com> References: <1449257734-26860-1-git-send-email-ian.jackson@eu.citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1a4w90-000648-3h for xen-devel@lists.xenproject.org; Fri, 04 Dec 2015 19:35:50 +0000 In-Reply-To: <1449257734-26860-1-git-send-email-ian.jackson@eu.citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xenproject.org Cc: Ian Jackson , Ian Campbell List-Id: xen-devel@lists.xenproject.org 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 --- cri-getconfig | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/cri-getconfig b/cri-getconfig index ee1cc40..48528b5 100644 --- a/cri-getconfig +++ b/cri-getconfig @@ -40,6 +40,37 @@ getrepos() { echo $repos } +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 proceesses from shell is a pain. # # For stupid historical reasons, background processes start with -- 1.7.10.4