Update power-on.py
This commit is contained in:
parent
cb86bc8609
commit
c303665a27
1 changed files with 1 additions and 2 deletions
|
@ -22,13 +22,12 @@ with open('hosts-in.csv',encoding='utf8') as csvfile:
|
||||||
print(i)
|
print(i)
|
||||||
i += 1
|
i += 1
|
||||||
BMC_NAME = (row[1])
|
BMC_NAME = (row[1])
|
||||||
HOST_NAME = (row[0])
|
|
||||||
print(BMC_NAME)
|
print(BMC_NAME)
|
||||||
if i > 0:
|
if i > 0:
|
||||||
client = paramiko.SSHClient()
|
client = paramiko.SSHClient()
|
||||||
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||||
client.connect(hostname=BMC_NAME, look_for_keys=False, port=22, username=USER_NAME, password=PASSWORD, disabled_algorithms={'pubkeys': ['rsa-sha2-256', 'rsa-sha2-512']})
|
client.connect(hostname=BMC_NAME, look_for_keys=False, port=22, username=USER_NAME, password=PASSWORD, disabled_algorithms={'pubkeys': ['rsa-sha2-256', 'rsa-sha2-512']})
|
||||||
command = ("set system1 oemHPE_server_name="+HOST_NAME)
|
command = ("power on")
|
||||||
stdin, stdout, stderr = client.exec_command(command)
|
stdin, stdout, stderr = client.exec_command(command)
|
||||||
print(stdout.read())
|
print(stdout.read())
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue