Skip to content

Commit

Permalink
Fix for ipmi bad credentials.
Browse files Browse the repository at this point in the history
If the ipmi credentials for root were not properly set on a host
the whole execution of M&R was being truncated due to not handling
the exception for the initialization of badfish.
Also added reboot on exception which if host is off, it would power
on.

Change-Id: I4e1eeea66e73cc08df8d7311a6f229e87f088e9c
  • Loading branch information
grafuls committed Jul 23, 2019
1 parent 8170005 commit eb68059
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions quads/tools/move_and_rebuild_hosts.py
Expand Up @@ -143,8 +143,11 @@ def move_and_rebuild(host, old_cloud, new_cloud, rebuild=False):
execute_ipmi(host, arguments=ipmi_pxe_persistent)

if is_supported(host):
badfish = Badfish("mgmt-%s" % host, conf["ipmi_username"], conf["ipmi_password"])

try:
badfish = Badfish("mgmt-%s" % host, conf["ipmi_username"], conf["ipmi_password"])
except SystemExit:
logger.exception("Could not initialize Badfish. Verify ipmi credentials.")
return False
try:
badfish.change_boot(
"director",
Expand All @@ -155,7 +158,7 @@ def move_and_rebuild(host, old_cloud, new_cloud, rebuild=False):
)
except SystemExit:
logger.exception("Could not set boot order via Badfish.")
badfish.clear_job_queue()
badfish.reboot_server()
return False

foreman_success = foreman.remove_extraneous_interfaces(host)
Expand Down

0 comments on commit eb68059

Please sign in to comment.