-
Notifications
You must be signed in to change notification settings - Fork 167
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
cluster value in vm_attr for compute profiles expect string #1245
Comments
Hey @cmeissner, it's been a while! You say that I'd argue that putting it in quotes is more correct, after all that's the name of the cluster, which is (technically) a string, but I also see that there should be no reason for it not to work without. |
You could try changing the following line:
to be something like: part = next((part for part in available_parts if part['name'] == str(name) or part['id'] == str(name)), None) Or maybe also wrap the part[...] im str()? |
Haha, understand. But as names consisting only numbers are valid in vsphere it leads to confusion if the ansible module is complaining about missing cluster. For our real life example it leads to an extra effort of about 1h for debugging. So from my point of view this is not only a convenient change. But I'm open for discussions. |
Would it help to add type validation at the ansible parameter parsing? |
This can save some time and effort. For me it is okay but I guess this will lead to confusion and somehow frustrating situation. But good error Messages are a good compromise. |
The Ansible parameter spec is, uh, complicated. We could yield a warning ourself. But then we could also just cast ourself. Aaaah, decisions. |
Is this problem limited to |
We seen it only at |
I would think it's a problem for any entry we do translation from name to id for (so cluster, network, etc) |
from triage meeting: if we cast both sides (foreman reply and the value in the playbook) to strings, this should be safe to compare and not break (too much gg) |
SUMMARY
If we want to create compute profiles for vsphere compute resource the value of
cluster
withinvm_attrs
can't be an integer. We need to put an integer in quotes.As we can use numbers for cluster and or datacenter in Sphere configuration the module should also accept integers and may be do a type casting inside the module.
ISSUE TYPE
ANSIBLE VERSION
ansible >= 2.9.0, <= 2.9.10
COLLECTION VERSION
theforeman.foreman:2.1.0
KATELLO/FOREMAN VERSION
foreman-server 2.1.4
STEPS TO REPRODUCE
This code should reproduce the issue.
EXPECTED RESULTS
Foreman should manage compute profile with a cluster name with integers only without complaining about.
ACTUAL RESULTS
The text was updated successfully, but these errors were encountered: