Use Proxmox shell API to get container ID

This commit is contained in:
whiskerz007 2020-03-20 14:42:03 +01:00
parent 02895331e3
commit bd6cd3c932
No known key found for this signature in database
GPG Key ID: A7EEAB6E1F1A6805

View File

@ -44,17 +44,7 @@ STORAGE_TYPE=`pvesm status -storage $STORAGE | awk 'NR>1 {print $2}'`
info "Using '$STORAGE' for storage location."
# Get the next guest VM/LXC ID
VMID=$(cat<<EOF | python3
import json
with open('/etc/pve/.vmlist') as vmlist:
vmids = json.load(vmlist)
if 'ids' not in vmids:
print(100)
else:
last_vm = sorted(vmids['ids'].keys())[-1:][0]
print(int(last_vm)+1)
EOF
)
VMID=$(pvesh get /cluster/nextid)
info "Container ID is $VMID."
# Get latest Home Assistant disk image archive URL