aboutsummaryrefslogtreecommitdiffstats
path: root/deploy/rename_nics.py
diff options
context:
space:
mode:
Diffstat (limited to 'deploy/rename_nics.py')
-rw-r--r--deploy/rename_nics.py18
1 files changed, 13 insertions, 5 deletions
diff --git a/deploy/rename_nics.py b/deploy/rename_nics.py
index dcec51df..99eed3c2 100644
--- a/deploy/rename_nics.py
+++ b/deploy/rename_nics.py
@@ -2,10 +2,12 @@ import os
import sys
import yaml
+
def exec_cmd(cmd):
print cmd
os.system(cmd)
+
def rename_nics(dha_info, rsa_file, compass_ip, os_version):
for host in dha_info['hosts']:
host_name = host['name']
@@ -18,13 +20,13 @@ def rename_nics(dha_info, rsa_file, compass_ip, os_version):
if os_version == 'xenial':
exec_cmd("ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
-i %s root@%s \
- 'cobbler system edit --name=%s --interface=%s --mac=%s --interface_type=static'" \
- % (rsa_file, compass_ip, host_name, nic_name, mac))
+ 'cobbler system edit --name=%s --interface=%s --mac=%s --interface_type=static'"
+ % (rsa_file, compass_ip, host_name, nic_name, mac))
else:
exec_cmd("ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
-i %s root@%s \
- 'cobbler system edit --name=%s --interface=%s --mac=%s'" \
- % (rsa_file, compass_ip, host_name, nic_name, mac))
+ 'cobbler system edit --name=%s --interface=%s --mac=%s'"
+ % (rsa_file, compass_ip, host_name, nic_name, mac))
exec_cmd("ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
-i %s root@%s \
@@ -32,4 +34,10 @@ def rename_nics(dha_info, rsa_file, compass_ip, os_version):
if __name__ == "__main__":
assert(len(sys.argv) == 5)
- rename_nics(yaml.load(open(sys.argv[1])), sys.argv[2], sys.argv[3], sys.argv[4])
+ rename_nics(
+ yaml.load(
+ open(
+ sys.argv[1])),
+ sys.argv[2],
+ sys.argv[3],
+ sys.argv[4])