You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A user raised an issue (F5Networks/f5-ansible#2380) where he seems to be forced to use results keyword when setting up wait_for conditions.
For example when we attempt to define wait_for conditon like so:
bigip_command:
commands:
- show sys failover
wait_for:
- sys_failover_state[0] contains 'Failover standby'
provider: "{{ f5_provider }}"
warn: no
match: any
retries: 60
interval: 30
register: sys_failover_state
We end up with the following error:
The full traceback is:
Traceback (most recent call last):
File "/Users/wypior/.ansible/tmp/ansible-tmp-1700135387.177551-10764-33297694207417/AnsiballZ_bigip_command.py", line 107, in <module>
_ansiballz_main()
File "/Users/wypior/.ansible/tmp/ansible-tmp-1700135387.177551-10764-33297694207417/AnsiballZ_bigip_command.py", line 99, in _ansiballz_main
invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
File "/Users/wypior/.ansible/tmp/ansible-tmp-1700135387.177551-10764-33297694207417/AnsiballZ_bigip_command.py", line 47, in invoke_module
runpy.run_module(mod_name='ansible_collections.f5networks.f5_modules.plugins.modules.bigip_command', init_globals=dict(_module_fqn='ansible_collections.f5networks.f5_modules.plugins.modules.bigip_command', _modlib_path=modlib_path),
File "/usr/local/Cellar/[email protected]/3.10.8/Frameworks/Python.framework/Versions/3.10/lib/python3.10/runpy.py", line 224, in run_module
return _run_module_code(code, init_globals, run_name, mod_spec)
File "/usr/local/Cellar/[email protected]/3.10.8/Frameworks/Python.framework/Versions/3.10/lib/python3.10/runpy.py", line 96, in _run_module_code
_run_code(code, mod_globals, init_globals,
File "/usr/local/Cellar/[email protected]/3.10.8/Frameworks/Python.framework/Versions/3.10/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/tmp/ansible_bigip_command_payload_ck1sz0qc/ansible_bigip_command_payload.zip/ansible_collections/f5networks/f5_modules/plugins/modules/bigip_command.py", line 757, in <module>
File "/tmp/ansible_bigip_command_payload_ck1sz0qc/ansible_bigip_command_payload.zip/ansible_collections/f5networks/f5_modules/plugins/modules/bigip_command.py", line 750, in main
File "/tmp/ansible_bigip_command_payload_ck1sz0qc/ansible_bigip_command_payload.zip/ansible_collections/f5networks/f5_modules/plugins/modules/bigip_command.py", line 680, in exec_module
File "/tmp/ansible_bigip_command_payload_ck1sz0qc/ansible_bigip_command_payload.zip/ansible_collections/f5networks/f5_modules/plugins/modules/bigip_command.py", line 634, in exec_module
File "/tmp/ansible_bigip_command_payload_ck1sz0qc/ansible_bigip_command_payload.zip/ansible_collections/f5networks/f5_modules/plugins/modules/bigip_command.py", line 513, in execute
File "/tmp/ansible_bigip_command_payload_ck1sz0qc/ansible_bigip_command_payload.zip/ansible_collections/ansible/netcommon/plugins/module_utils/network/common/parsing.py", line 235, in __call__
File "/tmp/ansible_bigip_command_payload_ck1sz0qc/ansible_bigip_command_payload.zip/ansible_collections/ansible/netcommon/plugins/module_utils/network/common/parsing.py", line 262, in get_value
File "/tmp/ansible_bigip_command_payload_ck1sz0qc/ansible_bigip_command_payload.zip/ansible_collections/ansible/netcommon/plugins/module_utils/network/common/parsing.py", line 278, in get_json
KeyError: 'sys_failover_state'
Some output from the variables registed in the parsing.py:
2.9s __call__: data=['Failover active for 0d 00:23:18']
2.9s get_value: result={'result': ['Failover active for 0d 00:23:18']}
2.9s get_json: result={'result': ['Failover active for 0d 00:23:18']}
2.9s get_json: self.key='sys_failover_state[0]'
2.9s get_json: key='sys_failover_state'
To fix the apparent problem, user needed to use result keyword:
- name: Wait for active or standby status (means online)
bigip_command:
commands:
- show sys failover
wait_for:
- result[0] contains 'Failover active'
provider: "{{ f5_provider }}"
warn: no
match: any
retries: 60
interval: 30
register: sys_failover_state
Some output from the variables registered in the parsing.py:
2.8s __call__: data=['Failover active for 0d 00:22:25']
2.8s get_value: result={'result': ['Failover active for 0d 00:22:25']}
2.8s get_json: result={'result': ['Failover active for 0d 00:22:25']}
2.8s get_json: self.key='result[0]'
2.8s get_json: key='result'
Is this expected, or maybe we have some issue in our implementation, i just do not see? If this is a bug or an improvement is required can we get this actioned?
SUMMARY
The conditonal class in parsing.py seems to require using
result
keyword when implemeting wait_for.We have implemented wait_for in our collection, and we use Conditional class from
plugins/module_utils/network/common/parsing.py
https://github.com/F5Networks/f5-ansible/blob/devel/ansible_collections/f5networks/f5_modules/plugins/modules/bigip_command.py#L504
A user raised an issue (F5Networks/f5-ansible#2380) where he seems to be forced to use
results
keyword when setting up wait_for conditions.For example when we attempt to define wait_for conditon like so:
We end up with the following error:
Some output from the variables registed in the parsing.py:
To fix the apparent problem, user needed to use
result
keyword:Some output from the variables registered in the parsing.py:
Is this expected, or maybe we have some issue in our implementation, i just do not see? If this is a bug or an improvement is required can we get this actioned?
ISSUE TYPE
COMPONENT NAME
https://github.com/ansible-collections/ansible.netcommon/blob/main/plugins/module_utils/network/common/parsing.py#L168
ANSIBLE VERSION
COLLECTION VERSION
CONFIGURATION
STEPS TO REPRODUCE
EXPECTED RESULTS
ACTUAL RESULTS
The text was updated successfully, but these errors were encountered: