Merge pull request #84 from mxmeinhold/boot-order-and-fixes

Boot Ordering and other fixes
This commit is contained in:
Max Meinhold 2021-01-02 13:45:55 -05:00 committed by GitHub
commit f8af77469e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View file

@ -406,7 +406,7 @@ def delete(vmid):
@app.route('/vm/<string:vmid>/boot_order', methods=['POST'])
@auth.oidc_auth
def get_boot_order(vmid):
def set_boot_order(vmid):
user = User(session['userinfo']['preferred_username'])
connect_proxmox()
if user.rtp or int(vmid) in user.allowed_vms:

View file

@ -27,8 +27,8 @@ from proxstar.vnc import send_stop_ssh_tunnel
logging.basicConfig(format='%(asctime)s %(levelname)s %(message)s', level=logging.INFO)
app = Flask(__name__)
if os.path.exists(os.path.join(app.config.get('ROOT_DIR', os.getcwd()), 'config.local.py')):
config = os.path.join(app.config.get('ROOT_DIR', os.getcwd()), 'config.local.py')
if os.path.exists(os.path.join(app.config.get('ROOT_DIR', os.getcwd()), 'config_local.py')):
config = os.path.join(app.config.get('ROOT_DIR', os.getcwd()), 'config_local.py')
else:
config = os.path.join(app.config.get('ROOT_DIR', os.getcwd()), 'config.py')
app.config.from_pyfile(config)
@ -90,6 +90,7 @@ def create_vm_task(user, name, cores, memory, disk, iso):
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'])
logging.info('[{}] VM successfully provisioned.'.format(name))
set_job_status(job, 'complete')