-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Proxmox node
, name
condition.
#5108
Fix Proxmox node
, name
condition.
#5108
Conversation
@@ -1234,7 +1234,7 @@ def main(): | |||
module.exit_json(changed=False, vmid=vmid, msg="VM with vmid <%s> already exists" % vmid) | |||
elif proxmox.get_vmid(name, ignore_missing=True) and not (update or clone): | |||
module.exit_json(changed=False, vmid=proxmox.get_vmid(name), msg="VM with name <%s> already exists" % name) | |||
elif not (node, name): | |||
elif (not node) or (not name): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be overkill, but it could also be expressed as:
elif (not node) or (not name): | |
elif not all(node, name): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally I find the previous version easier to understand since I don't usually write Python.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suit yourself 😁
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm both fine with the current version or @russoz's suggestion.
@@ -0,0 +1,2 @@ | |||
deprecated_features: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@felixfontein wouldn't this be a bug fix instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's fixed now, was a copy-paste error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, thanks for spotting that!
9c066e5
to
8a7f52f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Backport to stable-5: 💚 backport PR created✅ Backport PR branch: Backported as #5110 🤖 @patchback |
* Fix Proxmox `node`, `name` condition. * Add changelog entry. (cherry picked from commit 0338eb7)
@reitermarkus thanks for the contribution! |
This broke the update feature using the vmid
result:
It worked until I updated the ansible (collection) version. |
#5206 fixes this. |
* Fix Proxmox `node`, `name` condition. * Add changelog entry.
* Fix Proxmox `node`, `name` condition. * Add changelog entry.
SUMMARY
Fix condition which is always false.
ISSUE TYPE
COMPONENT NAME
proxmox_kvm
ADDITIONAL INFORMATION
not (node, name)
is always false, the correct check is if eithernode
orname
is unspecified.Extracted from #4027.