This commit is contained in:
Joe Abbate 2023-01-27 12:51:57 -05:00
parent 8fae5521be
commit 36e2a6c687
2 changed files with 17 additions and 8 deletions

View file

@ -393,6 +393,7 @@ def vm_mem(vmid, mem):
else: else:
return '', 403 return '', 403
@app.route('/vm/<string:vmid>/renew', methods=['POST']) @app.route('/vm/<string:vmid>/renew', methods=['POST'])
@auth.oidc_auth @auth.oidc_auth
def vm_renew(vmid): def vm_renew(vmid):
@ -408,6 +409,7 @@ def vm_renew(vmid):
else: else:
return '', 403 return '', 403
@app.route('/vm/<string:vmid>/disk/create/<int:size>', methods=['POST']) @app.route('/vm/<string:vmid>/disk/create/<int:size>', methods=['POST'])
@auth.oidc_auth @auth.oidc_auth
def create_disk(vmid, size): def create_disk(vmid, size):
@ -423,6 +425,7 @@ def create_disk(vmid, size):
else: else:
return '', 403 return '', 403
@app.route('/vm/<string:vmid>/disk/<string:disk>/resize/<int:size>', methods=['POST']) @app.route('/vm/<string:vmid>/disk/<string:disk>/resize/<int:size>', methods=['POST'])
@auth.oidc_auth @auth.oidc_auth
def resize_disk(vmid, disk, size): def resize_disk(vmid, disk, size):
@ -438,6 +441,7 @@ def resize_disk(vmid, disk, size):
else: else:
return '', 403 return '', 403
@app.route('/vm/<string:vmid>/disk/<string:disk>/delete', methods=['POST']) @app.route('/vm/<string:vmid>/disk/<string:disk>/delete', methods=['POST'])
@auth.oidc_auth @auth.oidc_auth
def delete_disk(vmid, disk): def delete_disk(vmid, disk):
@ -450,6 +454,7 @@ def delete_disk(vmid, disk):
else: else:
return '', 403 return '', 403
@app.route('/vm/<string:vmid>/iso/create', methods=['POST']) @app.route('/vm/<string:vmid>/iso/create', methods=['POST'])
@auth.oidc_auth @auth.oidc_auth
def iso_create(vmid): def iso_create(vmid):
@ -462,6 +467,7 @@ def iso_create(vmid):
else: else:
return '', 403 return '', 403
@app.route('/vm/<string:vmid>/iso/<string:iso_drive>/delete', methods=['POST']) @app.route('/vm/<string:vmid>/iso/<string:iso_drive>/delete', methods=['POST'])
@auth.oidc_auth @auth.oidc_auth
def iso_delete(vmid, iso_drive): def iso_delete(vmid, iso_drive):
@ -474,6 +480,7 @@ def iso_delete(vmid, iso_drive):
else: else:
return '', 403 return '', 403
@app.route('/vm/<string:vmid>/iso/<string:iso_drive>/eject', methods=['POST']) @app.route('/vm/<string:vmid>/iso/<string:iso_drive>/eject', methods=['POST'])
@auth.oidc_auth @auth.oidc_auth
def iso_eject(vmid, iso_drive): def iso_eject(vmid, iso_drive):

View file

@ -315,7 +315,9 @@ class VM:
@retry(wait=wait_fixed(2), stop=stop_after_attempt(5)) @retry(wait=wait_fixed(2), stop=stop_after_attempt(5))
def mount_iso(self, iso_drive, iso): def mount_iso(self, iso_drive, iso):
proxmox = connect_proxmox() proxmox = connect_proxmox()
proxmox.nodes(self.node).qemu(self.id).config.post(**{iso_drive:'{},media=cdrom'.format(iso)}) proxmox.nodes(self.node).qemu(self.id).config.post(
**{iso_drive: '{},media=cdrom'.format(iso)}
)
@retry(wait=wait_fixed(2), stop=stop_after_attempt(5)) @retry(wait=wait_fixed(2), stop=stop_after_attempt(5))
def create_disk(self, size): def create_disk(self, size):