[BUG] proxmox salt-cloud driver fails on Proxmox VE 7
pjcreath opened this issue · comments
pjcreath commented
Description
When attempting to deploy a VM on a Proxmox VE 7 host, the salt-cloud proxmox driver raises an IndexError exception.
This failure is due to a variable name change in Proxmox's apidoc.js that conflicts with the regular expression in the proxmox driver. (See the change in Proxmox here.)
Pull request with fix and tests to follow.
Setup
- salt master (hostname "salt") is running in a container on the Proxmox host.
- Proxmox (hostname "pve") is running on bare metal, on-premises.
/etc/salt/cloud.providers.d/proxmox.conf
proxmox:
minion:
master: salt
user: mysaltuser@pve
password: notreallythepassword
url: pve
driver: proxmox
/etc/salt/cloud.profiles.d/proxmox.conf
ol8:
provider: proxmox
pool: mypool
image: local:vztmpl/oraclelinux-8-official_amd64.tar.gz
storage: local-zfs
technology: lxc
host: pve
onboot: 1
pubkey: mypubkey
ip_address: 192.168.0.222
Steps to Reproduce the behavior
salt-cloud -p -l all ol8 testvm
Excerpt of debug log
...
[INFO ] Creating Cloud VM testvm
[DEBUG ] Not authenticated yet, doing that now..
[DEBUG ] Starting new HTTPS connection (1): pve:8006
[DEBUG ] https://pve:8006 "POST /api2/json/access/ticket HTTP/1.1" 200 927
[DEBUG ] get: https://pve:8006/api2/json/cluster/nextid (None)
[DEBUG ] Starting new HTTPS connection (1): pve:8006
[DEBUG ] https://pve:8006 "GET /api2/json/cluster/nextid HTTP/1.1" 200 14
[DEBUG ] Starting new HTTPS connection (1): pve:8006
[DEBUG ] https://pve:8006 "GET /pve-docs/api-viewer/apidoc.js HTTP/1.1" 200 188669
[ERROR ] Error creating testvm on PROXMOX
The following exception was thrown when trying to run the initial deployment:
list index out of range
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/salt/cloud/clouds/proxmox.py", line 655, in create
data = create_node(vm_, newid)
File "/usr/lib/python3.6/site-packages/salt/cloud/clouds/proxmox.py", line 867, in create_node
for prop in _get_properties("/nodes/{node}/lxc", "POST", static_props):
File "/usr/lib/python3.6/site-packages/salt/cloud/clouds/proxmox.py", line 760, in _get_properties
_import_api()
File "/usr/lib/python3.6/site-packages/salt/cloud/clouds/proxmox.py", line 751, in _import_api
api_json = re_filter.findall(returned_data.text)[0]
IndexError: list index out of range
Error: There was a profile error: Failed to deploy VM
Expected behavior
Successful creation of the VM.
Versions Report
salt --versions-report
Salt Version:
Salt: 3004.1
Dependency Versions:
cffi: Not Installed
cherrypy: Not Installed
dateutil: 2.6.1
docker-py: Not Installed
gitdb: Not Installed
gitpython: Not Installed
Jinja2: 2.10.1
libgit2: Not Installed
M2Crypto: 0.35.2
Mako: Not Installed
msgpack: 0.6.2
msgpack-pure: Not Installed
mysql-python: Not Installed
pycparser: Not Installed
pycrypto: Not Installed
pycryptodome: Not Installed
pygit2: Not Installed
Python: 3.6.8 (default, Apr 11 2022, 08:25:52)
python-gnupg: 0.4.6
PyYAML: 3.12
PyZMQ: 19.0.0
smmap: Not Installed
timelib: Not Installed
Tornado: 4.5.3
ZMQ: 4.3.4
System Versions:
dist: oracle 8.6
locale: UTF-8
machine: x86_64
release: 5.15.35-1-pve
system: Linux
version: Oracle Linux Server 8.6