Replies: 1 comment 1 reply
-
I don't think this is related to the modules per se, as you can get the full data when saving the variable. It might be that the |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Ansible NetBox Collection version
3.1.1
Ansible version
NetBox version
3.1.7
Python version
3.8
Steps to Reproduce
When I do a debug to show what I get when I do an nb_lookup query of the vlan, I can get the item.value.role.slug and item.value.role.name data, they return a string. When I save the variable like this it is correct.
But when I directly use item.value.role.name or item.value.role.slug in the "when" comparison part of the task to fulfil the condition of being a string or another, the result I get is "Has no attribute 'name' or Has no attribute 'slug'".
Expected Behavior
What I expect is to be able to compare what I get from item.value.role.name or item.value.role.slug with the desired string in the same task that I perform the nb_lookup of the vlans.
For example:
Example of task:
Observed Behavior
When I run this task:
I obtain:
"msg": "The conditional check 'item.value.role.name == \"VoIP\"' failed. The error was: error while evaluating conditional (item.value.role.name == \"VoIP\"): 'None' has no attribute 'name'
But when I run in this way:
The result is correct:
Beta Was this translation helpful? Give feedback.
All reactions