openbmctool : Fix the error messages
Incorrect error message is shown with the following commands.
setDNS
setMACAddress
setNTP
setDomainName
getMACAddress
eg: Try setting wrong value to the MACAddress property on eth0 interface.
openbmctool.py -U <user> -P <password> -H <host> network setMACAddress -MA gh:ih:kl:pi:yq:qq -I eth0
Attempting login...
The specified Interface(eth0) doesn't exist
User root has been logged out
The error message "The specified Interface(eth0) doesn't exist" is misleading.
This commit fixes these error message to display as "Failed to set MACAddress!"
Similarly other set/get operations error messages are corrected.
Signed-off-by: Sunitha Harish <sunharis@in.ibm.com>
Change-Id: Icf6fe5da7359422483565522ba74159b53644029
diff --git a/thalerj/openbmctool.py b/thalerj/openbmctool.py
index 7d702b6..025cae7 100755
--- a/thalerj/openbmctool.py
+++ b/thalerj/openbmctool.py
@@ -3641,8 +3641,7 @@
except(requests.exceptions.ConnectionError) as err:
return connectionErrHandler(args.json, "ConnectionError", err)
if res.status_code == 403:
- return "The specified Interface"+"("+args.Interface+")"+\
- " doesn't exist"
+ return "Failed to set Domain Name"
return res.text
@@ -3669,8 +3668,7 @@
except(requests.exceptions.ConnectionError) as err:
return connectionErrHandler(args.json, "ConnectionError", err)
if res.status_code == 404:
- return "The specified Interface"+"("+args.Interface+")"+\
- " doesn't exist"
+ return "Failed to get MACAddress"
return res.text
@@ -3699,8 +3697,7 @@
except(requests.exceptions.ConnectionError) as err:
return connectionErrHandler(args.json, "ConnectionError", err)
if res.status_code == 403:
- return "The specified Interface"+"("+args.Interface+")"+\
- " doesn't exist"
+ return "Failed to set MACAddress"
return res.text
@@ -3726,7 +3723,7 @@
except(requests.exceptions.ConnectionError) as err:
return connectionErrHandler(args.json, "ConnectionError", err)
if res.status_code == 404:
- return "Failed to get Default Gateway info!!"
+ return "Failed to get Default Gateway info"
return res.text
@@ -3754,7 +3751,7 @@
except(requests.exceptions.ConnectionError) as err:
return connectionErrHandler(args.json, "ConnectionError", err)
if res.status_code == 403:
- return "Failed to set Default Gateway!!"
+ return "Failed to set Default Gateway"
return res.text
@@ -3835,8 +3832,7 @@
except(requests.exceptions.ConnectionError) as err:
return connectionErrHandler(args.json, "ConnectionError", err)
if res.status_code == 403:
- return "The specified Interface"+"("+args.Interface+")" +\
- " doesn't exist"
+ return "Failed to set DNS"
return res.text
@@ -3891,8 +3887,7 @@
except(requests.exceptions.ConnectionError) as err:
return connectionErrHandler(args.json, "ConnectionError", err)
if res.status_code == 403:
- return "The specified Interface"+"("+args.Interface+")" +\
- " doesn't exist"
+ return "Failed to set NTP"
return res.text