mirror of
https://github.com/ComputerScienceHouse/proxstar.git
synced 2025-03-09 15:40:09 +00:00
Clean VM boot order code
This commit is contained in:
parent
085f5c09d8
commit
fae4e9f059
2 changed files with 4 additions and 5 deletions
|
@ -848,7 +848,7 @@ $("#edit-boot-order").click(function(){
|
|||
.then((willChange) => {
|
||||
if (willChange) {
|
||||
var data = new FormData();
|
||||
for (k = 0; k < boot_order.length; k++) {
|
||||
for (k = 0; k < boot_order.order.length; k++) {
|
||||
e = document.getElementById(`boot-order-${k + 1}`);
|
||||
data.append(`${k + 1}`, e.options[e.selectedIndex].value);
|
||||
}
|
||||
|
|
|
@ -129,9 +129,8 @@ class VM:
|
|||
boot_order['legacy'] = True
|
||||
for order in raw_boot_order:
|
||||
boot_order['order'].append({'device': boot_order_lookup[order]})
|
||||
return boot_order
|
||||
# Currently using 'order=' format
|
||||
if raw_boot_order.startswith('order='):
|
||||
elif raw_boot_order.startswith('order='):
|
||||
# Add enabled boot devices
|
||||
for order in raw_boot_order[6:].split(';'):
|
||||
boot_order['order'].append(
|
||||
|
@ -174,9 +173,9 @@ class VM:
|
|||
{'device': device, 'description': self.config.get(device), 'enabled': True}
|
||||
for device in devices
|
||||
)
|
||||
return boot_order
|
||||
except:
|
||||
return {'legacy': False, 'order': []}
|
||||
return boot_order
|
||||
|
||||
@lazy_property
|
||||
def boot_order_json(self):
|
||||
|
@ -187,7 +186,7 @@ class VM:
|
|||
proxmox = connect_proxmox()
|
||||
boot_order_lookup = {'Floppy': 'a', 'Hard Disk': 'c', 'CD-ROM': 'd', 'Network': 'n'}
|
||||
# Check if legacy format
|
||||
if boot_order[0] in boot_order_lookup.keys():
|
||||
if all(order in boot_order_lookup.keys() for order in boot_order):
|
||||
raw_boot_order = ''
|
||||
for order in boot_order:
|
||||
raw_boot_order += boot_order_lookup[order]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue