supporting conversation at ansible/ansible-rulebook#539 (comment)
given 3 items (vertical scroll in github):
demo20230626-ansible-playground/empiric1.playbook.yml
Lines 6 to 22 in 504e0fc
using:
demo20230626-ansible-playground/empiric1.playbook.yml
Lines 38 to 39 in 504e0fc
results in:
TASK [debug] **********************************************************************************************************************************************************************
ok: [localhost] => {
"msg": [
{
"color": "red",
"name": "apple",
"nesting": {
"alphabet": "vowel"
},
"nesting.alphabet": "none"
},
{
"color": "red",
"name": "cherry",
"nesting": {
"alphabet": "consonant"
},
"nesting.alphabet": "none"
}
]
}
as expected.
using:
demo20230626-ansible-playground/empiric1.playbook.yml
Lines 42 to 44 in 817600a
results in has no attribute \"nesting['alphabet']\".
see:
TASK [debug] **********************************************************************************************************************************************************************
fatal: [localhost]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'dict object' has no attribute \"nesting['alphabet']\". 'dict object' has no attribute \"nesting['alphabet']\"\n\nThe error appears to be in '/Users/mmortari/git/demo20230626-ansible-playground/empiric1.playbook.yml': line 43, column 7, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n # has no attribute \\\"nesting['alphabet']\\\". :\n - debug:\n ^ here\n"}
so it would seems like, empirically, squared accessor is not supported in selectattr
.
using:
demo20230626-ansible-playground/empiric1.playbook.yml
Lines 47 to 49 in 87cd7e5
results in has no attribute \"nesting['alph\".
see:
TASK [debug] **********************************************************************************************************************************************************************
fatal: [localhost]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'dict object' has no attribute \"nesting['alph\". 'dict object' has no attribute \"nesting['alph\"\n\nThe error appears to be in '/Users/mmortari/git/demo20230626-ansible-playground/empiric1.playbook.yml': line 48, column 7, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n # has no attribute \\\"nesting['alph\\\". :\n - debug:\n ^ here\n"}
so it would seems like, empirically, squared accessor is completely ignored and just raw/brutally splitted on .
for the 1st argument in selectattr
.