Traceback (most recent call last):
File "/root/.ansible/tmp/ansible-tmp-1557828074.96-16133015862007/AnsiballZ_centreon_host.py", line 261, in <module>
_ansiballz_main()
File "/root/.ansible/tmp/ansible-tmp-1557828074.96-16133015862007/AnsiballZ_centreon_host.py", line 248, in _ansiballz_main
exitcode = debug(sys.argv[1], zipped_mod, ANSIBALLZ_PARAMS)
File "/root/.ansible/tmp/ansible-tmp-1557828074.96-16133015862007/AnsiballZ_centreon_host.py", line 216, in debug
importer = imp.load_module('__main__', f, script_path, ('.py', 'r', imp.PY_SOURCE))
File "/root/.ansible/tmp/ansible-tmp-1557828074.96-16133015862007/debug_dir/__main__.py", line 372, in <module>
main()
File "/root/.ansible/tmp/ansible-tmp-1557828074.96-16133015862007/debug_dir/__main__.py", line 327, in main
current_macro = m_list.get('$_HOST' + k.get('name').upper() + '$')
AttributeError: 'NoneType' object has no attribute 'get'
I'm pretty sure you're not going to change the API so we probably need something like that (and maybe renaming the variable to reflect the fact that it's a dict and not a list):
--- a/centreon_host.py 2019-05-14 10:16:28.386279910 +0000
+++ b/centreon_host.py 2019-05-14 10:13:00.197051737 +0000
@@ -319,6 +319,8 @@
#### Macros
if macros:
m_state, m_list = host.getmacro()
+ if m_list is None:
+ m_list = {}
for k in macros:
if k.get('name').find("$_HOST") == 0:
current_macro = m_list.get(k.get('name'))
This is because we expect a dict: https://github.com/guillaumewatteeux/ansible-centreon/blob/a4e243f75ee1263c6fc4cf88b75106e24f0e75ec/library/centreon_host.py#L321-L326
and the API returns
None
: https://github.com/guillaumewatteeux/centreon-sdk-python/blob/9f207d5458afc3304e24f16988069467b19eab81/centreonapi/webservice/configuration/host.py#L41I'm pretty sure you're not going to change the API so we probably need something like that (and maybe renaming the variable to reflect the fact that it's a dict and not a list):