Skip to content

Commit

Permalink
Added check to validate iDRAC creds
Browse files Browse the repository at this point in the history
  • Loading branch information
texroemer authored May 27, 2021
1 parent 74d4527 commit 9556bc8
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Redfish Python/BiosGetAttributesREDFISH.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# NOTE: Recommended to run this script first to get attributes and current values before executing BiosSetAttributeREDFISH script.
#
# _author_ = Texas Roemer <[email protected]>
# _version_ = 3.0
# _version_ = 4.0
#
# Copyright (c) 2017, Dell, Inc.
#
Expand All @@ -26,7 +26,7 @@
parser.add_argument('-ip',help='iDRAC IP address', required=True)
parser.add_argument('-u', help='iDRAC username', required=True)
parser.add_argument('-p', help='iDRAC password', required=True)
parser.add_argument('-a', help='Pass in the attribute name you want to get the current value, Note: make sure to type the attribute name exactly due to case sensitive. Example: MemTest will work but memtest will fail', required=False)
parser.add_argument('-a', help='Pass in the attribute name you want to get the current value, Note: make sure to type the attribute name exactly due to case senstive. Example: MemTest will work but memtest will fail', required=False)

args=vars(parser.parse_args())

Expand All @@ -42,7 +42,10 @@
def check_supported_idrac_version():
response = requests.get('https://%s/redfish/v1/Systems/System.Embedded.1/Bios' % idrac_ip,verify=False,auth=(idrac_username, idrac_password))
data = response.json()
if response.status_code != 200:
if response.status_code == 401:
print("\n- WARNING, status code %s returned. Incorrect iDRAC username/password or invalid privilege detected." % response.status_code)
sys.exit()
elif response.status_code != 200:
print("\n- WARNING, iDRAC version installed does not support this feature using Redfish API")
sys.exit()
else:
Expand Down

0 comments on commit 9556bc8

Please sign in to comment.