From e36cce018a63ea9e64ce8ecba1c825052a0d7abb Mon Sep 17 00:00:00 2001 From: GONG Jie Date: Thu, 23 Feb 2017 13:25:03 +0800 Subject: [PATCH 1/3] Add PostgreSQL support in test case pre_deploy_sn --- .../testcase/installation/pre_deploy_sn | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/xCAT-test/autotest/testcase/installation/pre_deploy_sn b/xCAT-test/autotest/testcase/installation/pre_deploy_sn index 4ef510174..d46f49564 100755 --- a/xCAT-test/autotest/testcase/installation/pre_deploy_sn +++ b/xCAT-test/autotest/testcase/installation/pre_deploy_sn @@ -16,11 +16,24 @@ sub runcmd { } } -$cmd = "XCATMYSQLADMIN_PW=12345 XCATMYSQLROOT_PW=12345 /opt/xcat/bin/mysqlsetup -i -V"; -runcmd("$cmd"); +if ($ENV{XCAT_DATABASE} eq "PostgreSQL") { + $cmd = "XCATPGPW=12345 /opt/xcat/bin/pgsqlsetup -i -V"; + runcmd("$cmd"); -$cmd = "echo \"GRANT ALL on xcatdb.* TO xcatadmin@\'%\' IDENTIFIED BY \'12345\'\;\" | mysql -u root -p12345"; -runcmd("$cmd"); + open(my $fh, '>>', '/var/lib/pgsql/data/pg_hba.conf') or die; + print $fh "host all all 0.0.0.0/0 md5\n"; + print $fh "host all all ::0/0 md5\n"; + close $fh; + + $cmd = "service postgresql restart" + runcmd("$cmd"); +} else { + $cmd = "XCATMYSQLADMIN_PW=12345 XCATMYSQLROOT_PW=12345 /opt/xcat/bin/mysqlsetup -i -V"; + runcmd("$cmd"); + + $cmd = "echo \"GRANT ALL on xcatdb.* TO xcatadmin@\'%\' IDENTIFIED BY \'12345\'\;\" | mysql -u root -p12345"; + runcmd("$cmd"); +} my $xcatballpath = "/install/post/otherpkgs/$os/$arch/xcat"; $cmd = "mkdir -p $xcatballpath/xcat-core && cp -r /xcat-core/* $xcatballpath/xcat-core && cp -r /xcat-dep $xcatballpath"; From 8b393fda869d4af7cb89499d8262937703eeaf71 Mon Sep 17 00:00:00 2001 From: GONG Jie Date: Thu, 23 Feb 2017 14:11:06 +0800 Subject: [PATCH 2/3] Patch SN_setup_case for PostgreSQL support --- xCAT-test/autotest/testcase/installation/SN_setup_case | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-test/autotest/testcase/installation/SN_setup_case b/xCAT-test/autotest/testcase/installation/SN_setup_case index 1873a0efd..ac693c267 100644 --- a/xCAT-test/autotest/testcase/installation/SN_setup_case +++ b/xCAT-test/autotest/testcase/installation/SN_setup_case @@ -2,7 +2,7 @@ start:SN_setup_case os:Linux stop:yes -cmd:/opt/xcat/share/xcat/tools/autotest/testcase/installation/pre_deploy_sn __GETNODEATTR($$SN,os)__ __GETNODEATTR($$SN,arch)__ +cmd:XCAT_DATABASE=$$XCAT_DATABASE /opt/xcat/share/xcat/tools/autotest/testcase/installation/pre_deploy_sn __GETNODEATTR($$SN,os)__ __GETNODEATTR($$SN,arch)__ check:rc==0 cmd:chtab key=nameservers site.value="" From fd0e6aa3e3630d78f37e5548ad3b476ac65064e5 Mon Sep 17 00:00:00 2001 From: GONG Jie Date: Mon, 20 Mar 2017 14:59:23 +0800 Subject: [PATCH 3/3] More reasonable error message when open() file failed. --- xCAT-test/autotest/testcase/installation/pre_deploy_sn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-test/autotest/testcase/installation/pre_deploy_sn b/xCAT-test/autotest/testcase/installation/pre_deploy_sn index d46f49564..a4c30001a 100755 --- a/xCAT-test/autotest/testcase/installation/pre_deploy_sn +++ b/xCAT-test/autotest/testcase/installation/pre_deploy_sn @@ -20,7 +20,7 @@ if ($ENV{XCAT_DATABASE} eq "PostgreSQL") { $cmd = "XCATPGPW=12345 /opt/xcat/bin/pgsqlsetup -i -V"; runcmd("$cmd"); - open(my $fh, '>>', '/var/lib/pgsql/data/pg_hba.conf') or die; + open(my $fh, '>>', '/var/lib/pgsql/data/pg_hba.conf') or die("failed open file /var/lib/pgsql/data/pg_bha.conf"); print $fh "host all all 0.0.0.0/0 md5\n"; print $fh "host all all ::0/0 md5\n"; close $fh;