diff options
author | KingPoo <haojingbo@huawei.com> | 2016-11-09 22:39:01 -0500 |
---|---|---|
committer | KingPoo <haojingbo@huawei.com> | 2016-11-09 22:39:01 -0500 |
commit | 404fcf8f737f405da7fd2e61441dd20a57d63935 (patch) | |
tree | be6f2214774edb1c803303eede8e810028a7584d /deploy/reset_compute.py | |
parent | 5f7e61eb5419681359af3ff3e37fac2b771a5c08 (diff) |
autopep8 make py files more standard
Change-Id: Ibaa74a1f508b28548668e764d1860393caa356d4
Signed-off-by: KingPoo <haojingbo@huawei.com>
Diffstat (limited to 'deploy/reset_compute.py')
-rw-r--r-- | deploy/reset_compute.py | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/deploy/reset_compute.py b/deploy/reset_compute.py index 717e8833..d47f462f 100644 --- a/deploy/reset_compute.py +++ b/deploy/reset_compute.py @@ -2,15 +2,17 @@ import os import sys import yaml + def exec_cmd(cmd): print cmd os.system(cmd) + def reset_baremetal(dha_info): print "reset_baremetal" hosts_info = yaml.load(open(dha_info)) - #print hosts_info + # print hosts_info ipmiUserDf = hosts_info.get('ipmiUser', 'root') ipmiPassDf = hosts_info.get('ipmiPass', 'Huawei@123') @@ -18,8 +20,8 @@ def reset_baremetal(dha_info): print ipmiPassDf hosts_list = hosts_info.get('hosts', []) - #print hosts_list - + # print hosts_list + for host in hosts_list: print host if ('compute' in host['roles']): @@ -29,7 +31,9 @@ def reset_baremetal(dha_info): print ipmiUser print ipmiPass print ipmiIp - exec_cmd("ipmitool -I lanplus -H %s -U %s -P %s chassis power reset >/dev/null" % (ipmiIp, ipmiUser, ipmiPass)) + exec_cmd( + "ipmitool -I lanplus -H %s -U %s -P %s chassis power reset >/dev/null" % + (ipmiIp, ipmiUser, ipmiPass)) def reset_virtual(dha_info): @@ -45,15 +49,14 @@ def reset_virtual(dha_info): if ('compute' in host['roles']): name = host['name'] exec_cmd("virsh destroy %s" % name) - exec_cmd("virsh start %s" % name) + exec_cmd("virsh start %s" % name) if __name__ == "__main__": - deploy_type=sys.argv[1] - dha_info=sys.argv[2] + deploy_type = sys.argv[1] + dha_info = sys.argv[2] print deploy_type print dha_info - if (deploy_type == 'baremetal') : + if (deploy_type == 'baremetal'): reset_baremetal(dha_info) - elif (deploy_type == 'virtual') : + elif (deploy_type == 'virtual'): reset_virtual(dha_info) - |