theforeman / foreman_fog_proxmox

Foreman plugin to add Proxmox compute resource based on fog-proxmox gem
GNU General Public License v3.0
106 stars 31 forks source link

set next valid vmid if vmid=0 #161

Closed FlatKey closed 4 years ago

FlatKey commented 4 years ago

Fixes #160

tristanrobert commented 4 years ago

Your feature needs tests. Why vmid == 0? I am working on tests to understand the cases we need to cover.

FlatKey commented 4 years ago

If the forman ansible modules or an API call without vmid is used, then the vmid == 0. https://github.com/theforeman/foreman_fog_proxmox/blob/c112ba30e275feb8b0694869c9c2f5fdb4507216/app/models/foreman_fog_proxmox/proxmox_vm_commands.rb#L31-L35 My thought was, if the vmid is 0, the next free vmid should be used automatically (even if 0 is explicitly specified as vmid). In this way, another invalid vmid's can still be specified that lead to an error message (invalid vmid).

tristanrobert commented 4 years ago

I have added this feature with its tests in commit : https://github.com/theforeman/foreman_fog_proxmox/commit/43d6846558a6858a40c21338a3e25a5ee3d3fdcd. It will be released in 0.12.