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
[WARNING]: Failure using method (v2_playbook_on_task_start) in callback plugin (<ansible.plugins.callback./home/dmsimard/dev/git/ansible-community/ara/ara/plugins/callback/ara_default.CallbackModule object at 0x7fb58bb36a90>): Object of type type is not
JSON serializable
Callback Exception:
File "/home/dmsimard/dev/git/ansible-community/ara/.tox/ansible-integration/lib/python3.7/site-packages/ansible/executor/task_queue_manager.py", line 333, in send_callback
method(*new_args, **kwargs)
File "/home/dmsimard/dev/git/ansible-community/ara/ara/plugins/callback/ara_default.py", line 232, in v2_playbook_on_task_start
handler=handler,
File "/home/dmsimard/dev/git/ansible-community/ara/ara/clients/http.py", line 104, in post
return self._request("post", endpoint, **kwargs)
File "/home/dmsimard/dev/git/ansible-community/ara/ara/clients/http.py", line 82, in _request
response = func(url, **kwargs)
File "/home/dmsimard/dev/git/ansible-community/ara/ara/clients/http.py", line 63, in post
return self._request("post", url, data=json.dumps(payload))
File "/usr/lib64/python3.7/json/__init__.py", line 231, in dumps
return _default_encoder.encode(obj)
File "/usr/lib64/python3.7/json/encoder.py", line 199, in encode
chunks = self.iterencode(o, _one_shot=True)
File "/usr/lib64/python3.7/json/encoder.py", line 257, in iterencode
return _iterencode(o, 0)
File "/usr/lib64/python3.7/json/encoder.py", line 179, in default
raise TypeError(f'Object of type {o.__class__.__name__} '
Or screenshot from 0.x:
This is because the structure of the task object has changed.
After discussing this with upstream in #ansible-devel, it turns out that this new Sentinel object is used to indicate that something has not been set (to allow a distinction between unset and set to None).
We can use something like from ansible.utils.sentinel import Sentinel; if foo is Sentinel to determine if the value is set and otherwise coerce to a value we can send to the database like None or an empty list, for example.
The text was updated successfully, but these errors were encountered:
Tags are available as task.tags, there is no need to use _attributes
which now defaults unset values to a new Sentinel class instead of None
or [].
Fixes: #46
Change-Id: Ie8b2ef112a54497253ea1c3a1b5956c6284434c3
Example trace from ara 1.0:
Or screenshot from 0.x:
This is because the structure of the task object has changed.
In 2.7:
In 2.8 (notice all the
ansible.utils.sentinel.Sentinel
):After discussing this with upstream in #ansible-devel, it turns out that this new Sentinel object is used to indicate that something has not been set (to allow a distinction between unset and set to
None
).We can use something like
from ansible.utils.sentinel import Sentinel; if foo is Sentinel
to determine if the value is set and otherwise coerce to a value we can send to the database like None or an empty list, for example.The text was updated successfully, but these errors were encountered: