Add better messages and move normalization wait

This commit is contained in:
Joshua Boniface 2022-07-07 16:30:19 +00:00
parent a30ac176f4
commit 59228ed2eb
1 changed files with 8 additions and 6 deletions

View File

@ -103,12 +103,9 @@ class RedfishSession:
sleep(2) sleep(2)
tries += 1 tries += 1
if login_response is None: if login_response is None or login_response.status_code not in [200, 201]:
logger.error("Failed to log in to Redfish")
return
if login_response.status_code not in [200, 201]:
raise AuthenticationException("Login failed", response=login_response) raise AuthenticationException("Login failed", response=login_response)
logger.info(f"Logged in to Redfish at {host} successfully") logger.info(f"Logged in to Redfish at {host} successfully")
self.host = host self.host = host
@ -714,6 +711,9 @@ def redfish_init(config, cspec, data):
cspec_hostname = cspec_node["node"]["hostname"] cspec_hostname = cspec_node["node"]["hostname"]
cspec_fqdn = cspec_node["node"]["fqdn"] cspec_fqdn = cspec_node["node"]["fqdn"]
logger.info("Waiting 60 seconds for system normalization")
sleep(60)
notifications.send_webhook(config, "begin", f"Cluster {cspec_cluster}: Beginning Redfish initialization of host {cspec_fqdn}") notifications.send_webhook(config, "begin", f"Cluster {cspec_cluster}: Beginning Redfish initialization of host {cspec_fqdn}")
cluster = db.get_cluster(config, name=cspec_cluster) cluster = db.get_cluster(config, name=cspec_cluster)
@ -738,9 +738,11 @@ def redfish_init(config, cspec, data):
# Create the session and log in # Create the session and log in
session = RedfishSession(bmc_host, bmc_username, bmc_password) session = RedfishSession(bmc_host, bmc_username, bmc_password)
if session.host is None: if session.host is None:
notifications.send_webhook(config, "failure", f"Cluster {cspec_cluster}: Failed to log in to Redfish for host {cspec_fqdn} at {bmc_host}")
logger.info("Aborting Redfish configuration; reboot BMC to try again.") logger.info("Aborting Redfish configuration; reboot BMC to try again.")
del session del session
return return
notifications.send_webhook(config, "success", f"Cluster {cspec_cluster}: Logged in to Redfish for host {cspec_fqdn} at {bmc_host}")
logger.info("Characterizing node...") logger.info("Characterizing node...")
# Get Refish bases # Get Refish bases