mirror of
https://github.com/FAUSheppy/athq-vm-management
synced 2025-12-06 13:51: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"
|
FILE = "./config/vms.json"
|
||||||
vmList = []
|
vmList = []
|
||||||
|
skipVirsh = not any([args.skip_ansible, args.skip_nginx,
|
||||||
|
args.skip_icinga, args.skip_ssh_config])
|
||||||
|
|
||||||
with open(FILE) as f:
|
with open(FILE) as f:
|
||||||
jsonList = json.load(f)
|
jsonList = json.load(f)
|
||||||
for obj in jsonList:
|
for obj in jsonList:
|
||||||
try:
|
try:
|
||||||
vmo = vm.VM(obj)
|
vmo = vm.VM(obj, skipVirsh)
|
||||||
vmList.append(vmo)
|
vmList.append(vmo)
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
print(e, file=sys.stderr)
|
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"))
|
environment = jinja2.Environment(loader=jinja2.FileSystemLoader(searchpath="./templates"))
|
||||||
|
|
||||||
def __init__(self, args):
|
def __init__(self, args, skipVirsh):
|
||||||
|
|
||||||
self.hostname = args.get("hostname")
|
self.hostname = args.get("hostname")
|
||||||
self.subdomains = args.get("subdomains")
|
self.subdomains = args.get("subdomains")
|
||||||
@@ -18,7 +18,7 @@ class VM:
|
|||||||
self.ansible = not args.get("noansible")
|
self.ansible = not args.get("noansible")
|
||||||
self.sshOutsidePort = None
|
self.sshOutsidePort = None
|
||||||
|
|
||||||
if self.isExternal:
|
if self.isExternal or skipVirsh:
|
||||||
self.lease = None
|
self.lease = None
|
||||||
self.ip = None
|
self.ip = None
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user