only retrieve ignored_pools once, add paramter for get_pools in tasks

This commit is contained in:
Jordan Rodgers 2018-02-03 00:05:20 -05:00
parent e96c8cf4cf
commit 85a5e74a6b
2 changed files with 2 additions and 2 deletions

View file

@ -274,10 +274,10 @@ def mount_vm_iso(proxmox, vmid, iso):
def get_pools(proxmox, db):
ignored_pools = get_ignored_pools(db)
pools = []
for pool in proxmox.pools.get():
poolid = pool['poolid']
ignored_pools = get_ignored_pools(db)
if poolid not in ignored_pools and is_user(poolid):
pools.append(poolid)
pools = sorted(pools)

View file

@ -76,7 +76,7 @@ def process_expiring_vms_task():
proxmox = connect_proxmox()
db = connect_db()
starrs = connect_starrs()
pools = get_pools(proxmox)
pools = get_pools(proxmox, db)
for pool in pools:
expiring_vms = []
vms = get_vms_for_user(proxmox, db, pool)