mirror of
https://github.com/ComputerScienceHouse/proxstar.git
synced 2025-02-12 13:01:51 +00:00
Linting
This commit is contained in:
parent
8fae5521be
commit
36e2a6c687
2 changed files with 17 additions and 8 deletions
|
@ -393,6 +393,7 @@ def vm_mem(vmid, mem):
|
|||
else:
|
||||
return '', 403
|
||||
|
||||
|
||||
@app.route('/vm/<string:vmid>/renew', methods=['POST'])
|
||||
@auth.oidc_auth
|
||||
def vm_renew(vmid):
|
||||
|
@ -408,6 +409,7 @@ def vm_renew(vmid):
|
|||
else:
|
||||
return '', 403
|
||||
|
||||
|
||||
@app.route('/vm/<string:vmid>/disk/create/<int:size>', methods=['POST'])
|
||||
@auth.oidc_auth
|
||||
def create_disk(vmid, size):
|
||||
|
@ -423,6 +425,7 @@ def create_disk(vmid, size):
|
|||
else:
|
||||
return '', 403
|
||||
|
||||
|
||||
@app.route('/vm/<string:vmid>/disk/<string:disk>/resize/<int:size>', methods=['POST'])
|
||||
@auth.oidc_auth
|
||||
def resize_disk(vmid, disk, size):
|
||||
|
@ -438,6 +441,7 @@ def resize_disk(vmid, disk, size):
|
|||
else:
|
||||
return '', 403
|
||||
|
||||
|
||||
@app.route('/vm/<string:vmid>/disk/<string:disk>/delete', methods=['POST'])
|
||||
@auth.oidc_auth
|
||||
def delete_disk(vmid, disk):
|
||||
|
@ -450,6 +454,7 @@ def delete_disk(vmid, disk):
|
|||
else:
|
||||
return '', 403
|
||||
|
||||
|
||||
@app.route('/vm/<string:vmid>/iso/create', methods=['POST'])
|
||||
@auth.oidc_auth
|
||||
def iso_create(vmid):
|
||||
|
@ -462,6 +467,7 @@ def iso_create(vmid):
|
|||
else:
|
||||
return '', 403
|
||||
|
||||
|
||||
@app.route('/vm/<string:vmid>/iso/<string:iso_drive>/delete', methods=['POST'])
|
||||
@auth.oidc_auth
|
||||
def iso_delete(vmid, iso_drive):
|
||||
|
@ -474,6 +480,7 @@ def iso_delete(vmid, iso_drive):
|
|||
else:
|
||||
return '', 403
|
||||
|
||||
|
||||
@app.route('/vm/<string:vmid>/iso/<string:iso_drive>/eject', methods=['POST'])
|
||||
@auth.oidc_auth
|
||||
def iso_eject(vmid, iso_drive):
|
||||
|
|
|
@ -219,7 +219,7 @@ class VM:
|
|||
while True:
|
||||
name = f'net{i}'
|
||||
if name not in self.config:
|
||||
proxmox=connect_proxmox()
|
||||
proxmox = connect_proxmox()
|
||||
try:
|
||||
proxmox.nodes(self.node).qemu(self.id).config.post(**{name: int_type})
|
||||
return True
|
||||
|
@ -231,7 +231,7 @@ class VM:
|
|||
@retry(wait=wait_fixed(2), stop=stop_after_attempt(5))
|
||||
def delete_net(self, net_id):
|
||||
if net_id in self.config:
|
||||
proxmox=connect_proxmox()
|
||||
proxmox = connect_proxmox()
|
||||
proxmox.nodes(self.node).qemu(self.id).config.post(delete=net_id)
|
||||
return True
|
||||
return False
|
||||
|
@ -294,11 +294,11 @@ class VM:
|
|||
@retry(wait=wait_fixed(2), stop=stop_after_attempt(5))
|
||||
def add_iso_drive(self):
|
||||
iso_drives = list(filter(lambda interface: 'ide' in interface, self.config.keys()))
|
||||
for i in range(1,5):
|
||||
for i in range(1, 5):
|
||||
ide_name = f'ide{i}'
|
||||
if ide_name not in iso_drives:
|
||||
proxmox = connect_proxmox()
|
||||
proxmox.nodes(self.node).qemu(self.id).config.post(**{ide_name:'none,media=cdrom'})
|
||||
proxmox.nodes(self.node).qemu(self.id).config.post(**{ide_name: 'none,media=cdrom'})
|
||||
return True
|
||||
return False
|
||||
|
||||
|
@ -310,21 +310,23 @@ class VM:
|
|||
@retry(wait=wait_fixed(2), stop=stop_after_attempt(5))
|
||||
def eject_iso(self, iso_drive):
|
||||
proxmox = connect_proxmox()
|
||||
proxmox.nodes(self.node).qemu(self.id).config.post(**{iso_drive:'none,media=cdrom'})
|
||||
proxmox.nodes(self.node).qemu(self.id).config.post(**{iso_drive: 'none,media=cdrom'})
|
||||
|
||||
@retry(wait=wait_fixed(2), stop=stop_after_attempt(5))
|
||||
def mount_iso(self, iso_drive, iso):
|
||||
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))
|
||||
def create_disk(self, size):
|
||||
drives = list(filter(lambda interface: 'virtio' in interface, self.config.keys()))
|
||||
for i in range(0,16):
|
||||
for i in range(0, 16):
|
||||
disk_name = f'virtio{i}'
|
||||
if disk_name not in drives:
|
||||
proxmox = connect_proxmox()
|
||||
proxmox.nodes(self.node).qemu(self.id).config.post(**{disk_name:f'ceph:{size}'})
|
||||
proxmox.nodes(self.node).qemu(self.id).config.post(**{disk_name: f'ceph:{size}'})
|
||||
return True
|
||||
return False
|
||||
|
||||
|
|
Loading…
Reference in a new issue