Fix bug.
This commit is contained in:
parent
62078b6b56
commit
01c7540989
|
@ -150,12 +150,17 @@ def main():
|
||||||
yaml.dump(netplan_config_yaml, f)
|
yaml.dump(netplan_config_yaml, f)
|
||||||
netplan_get_status = os.system('sudo netplan get')
|
netplan_get_status = os.system('sudo netplan get')
|
||||||
if netplan_get_status == 0:
|
if netplan_get_status == 0:
|
||||||
os.system('sudo netplan try --timeout 10 && echo "Finish configuring netplan!" && exit 0')
|
if os.system('sudo netplan try --timeout 10') == 0:
|
||||||
f.write(org_file_contents)
|
print("Finish configuring netplan!")
|
||||||
print("Recover changed!")
|
sys.exit(0)
|
||||||
else:
|
else:
|
||||||
print("Something went wrong!")
|
print("Something went wrong!")
|
||||||
f.write(org_file_contents)
|
f.write(org_file_contents)
|
||||||
print("Recover changed!")
|
print("Recover changed!")
|
||||||
|
sys.exit(1)
|
||||||
|
with open(netplan_config_file, 'w+') as f:
|
||||||
|
print(org_file_contents)
|
||||||
|
f.write(org_file_contents)
|
||||||
|
print("Recover changed!")
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
Loading…
Reference in New Issue