Example #1
0
def reboot(deployment_id):
    deployment = Deployment.objects.get(id=deployment_id)
    if deployment.status == DeploymentStatus.done:
        # Deployment chain requires status to be in_progress or open only.
        # But before running script assure status didn't change
        # in meantime.
        return False
    management = deployment.device.find_management()
    if not management:
        return True
    management_ip = management.address
    user, password = settings.ILO_USER, settings.ILO_PASSWORD
    if user and IloHost(management_ip, user, password).reboot(True):
        return True
    user, password = settings.IPMI_USER, settings.IPMI_PASSWORD
    if user and ipmi_reboot(management_ip, user, password, True):
        return True
    user = settings.SSH_IBM_USER
    bay = deployment.device.chassis_position
    if user and bay:
        ssh_ibm_reboot(management_ip, bay)
    return True
Example #2
0
def reboot(deployment_id):
    deployment = Deployment.objects.get(id=deployment_id)
    management = deployment.device.find_management()
    user, password = settings.ILO_USER, settings.ILO_PASSWORD
    if user and IloHost(management, user, password).reboot(True):
        return True
    user, password = settings.IPMI_USER, settings.IPMI_PASSWORD
    if user and ipmi_reboot(management, user, password, True):
        return True
    user = settings.SSH_IBM_USER
    bay = deployment.device.chassis_position
    if user and bay and ssh_ibm_reboot(management, bay):
        return True
    return False