mirror of
https://github.com/FAUSheppy/athq-vm-management
synced 2025-12-06 05:41:35 +01:00
fix: skip virsh calls when only backup is requested
This commit is contained in:
5
main.py
5
main.py
@@ -24,11 +24,14 @@ if __name__ == "__main__":
|
||||
|
||||
FILE = "./config/vms.json"
|
||||
vmList = []
|
||||
skipVirsh = not any([args.skip_ansible, args.skip_nginx,
|
||||
args.skip_icinga, args.skip_ssh_config])
|
||||
|
||||
with open(FILE) as f:
|
||||
jsonList = json.load(f)
|
||||
for obj in jsonList:
|
||||
try:
|
||||
vmo = vm.VM(obj)
|
||||
vmo = vm.VM(obj, skipVirsh)
|
||||
vmList.append(vmo)
|
||||
except ValueError as e:
|
||||
print(e, file=sys.stderr)
|
||||
|
||||
4
vm.py
4
vm.py
@@ -5,7 +5,7 @@ class VM:
|
||||
|
||||
environment = jinja2.Environment(loader=jinja2.FileSystemLoader(searchpath="./templates"))
|
||||
|
||||
def __init__(self, args):
|
||||
def __init__(self, args, skipVirsh):
|
||||
|
||||
self.hostname = args.get("hostname")
|
||||
self.subdomains = args.get("subdomains")
|
||||
@@ -18,7 +18,7 @@ class VM:
|
||||
self.ansible = not args.get("noansible")
|
||||
self.sshOutsidePort = None
|
||||
|
||||
if self.isExternal:
|
||||
if self.isExternal or skipVirsh:
|
||||
self.lease = None
|
||||
self.ip = None
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user