Fix hardcoded variables, tweak schema/dockerfile

Change config.local.py to config_local.py

Fix 2AM Willard Moments™

Made a few errors last night that should be corrected.
This commit is contained in:
Will Nilges 2021-10-04 00:55:23 -04:00
parent 262b5b10eb
commit 74a0990997
18 changed files with 38 additions and 18814 deletions

View file

@ -158,6 +158,8 @@ def list_vms(user_view=None):
user = User(session['userinfo']['preferred_username'])
rtp_view = False
connect_proxmox()
if eval(app.config['FORCE_STANDARD_USER']):
user.rtp = False
if user_view and not user.rtp:
abort(403)
elif user_view and user.rtp:

View file

@ -60,7 +60,8 @@ def get_vm_node(proxmox, vmid):
def get_isos(proxmox, storage):
isos = []
for iso in proxmox.nodes('proxmox01').storage(storage).content.get():
first_node = app.config['PROXMOX_HOSTS'][0].split('.')[0] # Get the name of the first node.
for iso in proxmox.nodes(first_node).storage(storage).content.get():
isos.append(iso['volid'].split('/')[1])
return isos

View file

@ -83,11 +83,12 @@ def create_vm_task(user, name, cores, memory, disk, iso):
set_job_status(job, 'failed to provision')
delete_vm_task(vmid)
return
logging.info('[{}] Registering in STARRS.'.format(name))
set_job_status(job, 'registering in STARRS')
vm = VM(vmid)
ip = get_next_ip(starrs, app.config['STARRS_IP_RANGE'])
register_starrs(starrs, name, app.config['STARRS_USER'], vm.get_mac(), ip)
if (eval(app.config['USE_STARRS'])):
logging.info('[{}] Registering in STARRS.'.format(name))
set_job_status(job, 'registering in STARRS')
ip = get_next_ip(starrs, app.config['STARRS_IP_RANGE'])
register_starrs(starrs, name, app.config['STARRS_USER'], vm.get_mac(), ip)
set_job_status(job, 'setting VM expiration')
get_vm_expire(db, vmid, app.config['VM_EXPIRE_MONTHS'])
vm.set_boot_order(['Hard Disk', 'CD-ROM', 'Network'])

View file

@ -250,8 +250,8 @@ def create_vm(proxmox, user, name, cores, memory, disk, iso):
name=name,
cores=cores,
memory=memory,
storage='ceph',
virtio0='ceph:{}'.format(disk),
storage=app.config['PROXMOX_VM_STORAGE'],
virtio0='{}:{}'.format(app.config['PROXMOX_VM_STORAGE'], disk),
ide2='{},media=cdrom'.format(iso),
net0='virtio,bridge=vmbr0',
pool=user,