-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvami_validator.py
More file actions
22 lines (19 loc) · 982 Bytes
/
Copy pathvami_validator.py
File metadata and controls
22 lines (19 loc) · 982 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import subprocess
def runCommand(cmd):
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out, err = p.communicate()
return p.returncode, out, err
path = "/opt/vmware/share/vami/"
commands = [["vami_all_interfaces"], ["vami_access"], ["vami_default_interface"],
["vami_dns"], ["vami_domain"], ["vami_first_ip"], ["vami_fullhostname"],
["vami_gateway", "eth0"], ["vami_gateway6", "eth0"], ["vami_get_network", "eth0"],
["vami_hname"], ["vami_hw_addr", "eth0"], ["vami_ip_addr", "eth0"],
["vami_ip6_addr", "eth0"], ["vami_interfaces"], ["vami_netmask","eth0"], ["vami_prefix", "eth0"],
["vami_set_network"], ["vami_set_proxy"], ["vami_set_dns"], ["vami_set_hostname"]]
for cmd in commands:
run_cmd = [path + cmd[0]]
run_cmd = run_cmd + cmd[1:]
rc, out, err = runCommand(run_cmd)
if rc != 0:
print("Failed to run command %s. Err: %s" % (cmd, err))
print(out)