From 2c35493c5224a859284e9b5a1e4261f45bee575b Mon Sep 17 00:00:00 2001 From: lissav Date: Sat, 2 Oct 2010 12:25:08 +0000 Subject: [PATCH] While investigating defect 3079612, which I could not create. I did find one of our setups for LL was not working on the Client. The /var/lib/db2/sqllib/cfg/db2cli.ini does not exist, which I had instructions to setup for LL. Added a check and must talk to LL git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@7742 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/sbin/db2sqlsetup | 47 ++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/xCAT-server/sbin/db2sqlsetup b/xCAT-server/sbin/db2sqlsetup index 976c2de62..927afb712 100755 --- a/xCAT-server/sbin/db2sqlsetup +++ b/xCAT-server/sbin/db2sqlsetup @@ -1290,34 +1290,35 @@ sub setupODBC { my $db2clifile = "/var/lib/db2/sqllib/cfg/db2cli.ini"; my $db2clifilebackup = "/var/lib/db2/sqllib/cfg/db2cli.ini.org"; - $cmd = "fgrep -i XCATDB $db2clifile"; - xCAT::Utils->runcmd($cmd, -1); - if ($::RUNCMD_RC != 0) # then xcat entry not there - { - $cmd = "cp $db2clifile $db2clifilebackup "; - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { + if (-e ( $db2clifile)) { + $cmd = "fgrep -i XCATDB $db2clifile"; + xCAT::Utils->runcmd($cmd, -1); + if ($::RUNCMD_RC != 0) # then xcat entry not there + { + $cmd = "cp $db2clifile $db2clifilebackup "; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { $message = "$cmd failed. Could not setup ODBC."; xCAT::MsgUtils->message("E", "$message"); exit(1); - } - my $entry = "\n[$instance]\nuid=$instance\npasswd=$passwd"; - $cmd = "echo \"$entry\" >> $db2clifile"; - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { - $message = "$cmd failed. Could not setup $db2clifile."; - xCAT::MsgUtils->message("E", "$message"); - exit(1); + } + my $entry = "\n[$instance]\nuid=$instance\npasswd=$passwd"; + $cmd = "echo \"$entry\" >> $db2clifile"; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + $message = "$cmd failed. Could not setup $db2clifile."; + xCAT::MsgUtils->message("E", "$message"); - } - } - else - { # entry already there - $message = "$db2clifile already configured, will not change."; - xCAT::MsgUtils->message("I", "$message"); + } + } + else + { # entry already there + $message = "$db2clifile already configured, will not change."; + xCAT::MsgUtils->message("I", "$message"); + } } } }