From 677be49c7e3ee0b561b86ff58aea9ed6c4a9edee Mon Sep 17 00:00:00 2001 From: Casandra Qiu Date: Tue, 18 Oct 2016 10:19:37 -0400 Subject: [PATCH] checking return code for xdsh --- xCAT-server/share/xcat/scripts/configMellanox | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/xCAT-server/share/xcat/scripts/configMellanox b/xCAT-server/share/xcat/scripts/configMellanox index 4b5f35634..c15cdb8f6 100755 --- a/xCAT-server/share/xcat/scripts/configMellanox +++ b/xCAT-server/share/xcat/scripts/configMellanox @@ -267,9 +267,12 @@ sub config_snmp { } $cmd = `xdsh $switch -l $user --devicetype IBSwitch::Mellanox "enable;configure terminal;snmp-server user $snmp_user v3 enable;snmp-server user $snmp_user v3 auth $snmp_auth $snmp_passwd;no snmp-server user $snmp_user v3 require-privacy;configuration write;exit;exit" `; - - $cmd = "chdef $switch status=snmp_configed snmpversion=3 snmpauth=$snmp_auth snmpusername=$snmp_user snmppassword=$snmp_passwd"; - $rc= xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) { + xCAT::MsgUtils->message("E","Failed to set snmpv3 for $switch"); + } else { + $cmd = "chdef $switch status=snmp_configed snmpversion=3 snmpauth=$snmp_auth snmpusername=$snmp_user snmppassword=$snmp_passwd"; + $rc= xCAT::Utils->runcmd($cmd, 0); + } } }