We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The datadog_downtime module throws a TypeError when creating a downtime with versions 2.28.0 and later of the datadog-api-client Python module.
I think this might be related to this MR on the datadog-api-client module
Bug Report
datadog_downtime
ansible [core 2.17.5] config file = None configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] ansible python module location = /usr/local/lib/python3.13/site-packages/ansible ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections executable location = /usr/local/bin/ansible python version = 3.13.0 (main, Oct 19 2024, 04:14:02) [GCC 12.2.0] (/usr/local/bin/python3.13) jinja version = 3.1.4 libyaml = True
Collection Version ----------------- ------- community.general 9.5.0
$ ansible-config dump --only-changed CONFIG_FILE() = None
Running Ansible on Docker :
FROM python:3.13.0-bookworm RUN pip install ansible
Just use a simple playbook to try to create a new downtime, having installed version 2.28.0 or later of the datadog-api-client module
- hosts: localhost connection: local tasks: - name: Install python requirements become: true ansible.builtin.pip: name: datadog-api-client==2.28.0 extra_args: --break-system-packages - name: Create or update downtime community.general.datadog_downtime: state: present api_key: REDACTED app_key: REDACTED downtime_message: "Ansible managed" monitor_tags: - '*' scope: - env:dev
I expected the playbook to complete successfully, with the downtime created, as it does with this single change on the given playbook:
ansible.builtin.pip: - name: datadog-api-client==2.28.0 + name: datadog-api-client==2.27.0 extra_args: --break-system-packages
TASK [Install python requirements] ******************************************************************************************************************************************************************************************************************************************** task path: /code/downtime.yml:4 <127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: root <127.0.0.1> EXEC /bin/sh -c 'echo ~root && sleep 0' <127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /root/.ansible/tmp `"&& mkdir "` echo /root/.ansible/tmp/ansible-tmp-1730223116.070168-741-225037205900347 `" && echo ansible-tmp-1730223116.070168-741-225037205900347="` echo /root/.ansible/tmp/ansible-tmp-1730223116.070168-741-225037205900347 `" ) && sleep 0' Using module file /usr/local/lib/python3.13/site-packages/ansible/modules/pip.py <127.0.0.1> PUT /root/.ansible/tmp/ansible-local-702ynrnc56x/tmphuw1_4w7 TO /root/.ansible/tmp/ansible-tmp-1730223116.070168-741-225037205900347/AnsiballZ_pip.py <127.0.0.1> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1730223116.070168-741-225037205900347/ /root/.ansible/tmp/ansible-tmp-1730223116.070168-741-225037205900347/AnsiballZ_pip.py && sleep 0' <127.0.0.1> EXEC /bin/sh -c '/usr/local/bin/python3.13 /root/.ansible/tmp/ansible-tmp-1730223116.070168-741-225037205900347/AnsiballZ_pip.py && sleep 0' <127.0.0.1> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-tmp-1730223116.070168-741-225037205900347/ > /dev/null 2>&1 && sleep 0' ok: [localhost] => { "changed": false, "cmd": [ "/usr/local/bin/python3.13", "-m", "pip.__main__", "install", "--break-system-packages", "datadog-api-client==2.27.0" ], "invocation": { "module_args": { "break_system_packages": false, "chdir": null, "editable": false, "executable": null, "extra_args": "--break-system-packages", "name": [ "datadog-api-client==2.27.0" ], "requirements": null, "state": "present", "umask": null, "version": null, "virtualenv": null, "virtualenv_command": "virtualenv", "virtualenv_python": null, "virtualenv_site_packages": false } }, "name": [ "datadog-api-client==2.27.0" ], "requirements": null, "state": "present", "stderr": "WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager, possibly rendering your system unusable.It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv. Use the --root-user-action option if you know what you are doing and want to suppress this warning.\n\n[notice] A new release of pip is available: 24.2 -> 24.3.1\n[notice] To update, run: pip install --upgrade pip\n", "stderr_lines": [ "WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager, possibly rendering your system unusable.It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv. Use the --root-user-action option if you know what you are doing and want to suppress this warning.", "", "[notice] A new release of pip is available: 24.2 -> 24.3.1", "[notice] To update, run: pip install --upgrade pip" ], "stdout": "Requirement already satisfied: datadog-api-client==2.27.0 in /usr/local/lib/python3.13/site-packages (2.27.0)\nRequirement already satisfied: urllib3>=1.15 in /usr/local/lib/python3.13/site-packages (from datadog-api-client==2.27.0) (2.2.3)\nRequirement already satisfied: certifi in /usr/local/lib/python3.13/site-packages (from datadog-api-client==2.27.0) (2024.8.30)\nRequirement already satisfied: python-dateutil in /usr/local/lib/python3.13/site-packages (from datadog-api-client==2.27.0) (2.9.0.post0)\nRequirement already satisfied: typing-extensions>=4.0.0 in /usr/local/lib/python3.13/site-packages (from datadog-api-client==2.27.0) (4.12.2)\nRequirement already satisfied: six>=1.5 in /usr/local/lib/python3.13/site-packages (from python-dateutil->datadog-api-client==2.27.0) (1.16.0)\n", "stdout_lines": [ "Requirement already satisfied: datadog-api-client==2.27.0 in /usr/local/lib/python3.13/site-packages (2.27.0)", "Requirement already satisfied: urllib3>=1.15 in /usr/local/lib/python3.13/site-packages (from datadog-api-client==2.27.0) (2.2.3)", "Requirement already satisfied: certifi in /usr/local/lib/python3.13/site-packages (from datadog-api-client==2.27.0) (2024.8.30)", "Requirement already satisfied: python-dateutil in /usr/local/lib/python3.13/site-packages (from datadog-api-client==2.27.0) (2.9.0.post0)", "Requirement already satisfied: typing-extensions>=4.0.0 in /usr/local/lib/python3.13/site-packages (from datadog-api-client==2.27.0) (4.12.2)", "Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.13/site-packages (from python-dateutil->datadog-api-client==2.27.0) (1.16.0)" ], "version": null, "virtualenv": null } TASK [Create or update downtime] ********************************************************************************************************************************************************************************************************************************************** task path: /code/downtime.yml:10 <127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: root <127.0.0.1> EXEC /bin/sh -c 'echo ~root && sleep 0' <127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /root/.ansible/tmp `"&& mkdir "` echo /root/.ansible/tmp/ansible-tmp-1730223117.0821579-769-61530248049284 `" && echo ansible-tmp-1730223117.0821579-769-61530248049284="` echo /root/.ansible/tmp/ansible-tmp-1730223117.0821579-769-61530248049284 `" ) && sleep 0' Using module file /usr/local/lib/python3.13/site-packages/ansible_collections/community/general/plugins/modules/datadog_downtime.py <127.0.0.1> PUT /root/.ansible/tmp/ansible-local-702ynrnc56x/tmpmm4teu83 TO /root/.ansible/tmp/ansible-tmp-1730223117.0821579-769-61530248049284/AnsiballZ_datadog_downtime.py <127.0.0.1> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1730223117.0821579-769-61530248049284/ /root/.ansible/tmp/ansible-tmp-1730223117.0821579-769-61530248049284/AnsiballZ_datadog_downtime.py && sleep 0' <127.0.0.1> EXEC /bin/sh -c '/usr/local/bin/python3.13 /root/.ansible/tmp/ansible-tmp-1730223117.0821579-769-61530248049284/AnsiballZ_datadog_downtime.py && sleep 0' <127.0.0.1> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-tmp-1730223117.0821579-769-61530248049284/ > /dev/null 2>&1 && sleep 0' changed: [localhost] => { "changed": true, "downtime": { "active": true, "canceled": null, "child_id": null, "created": 1730223125, "creator_id": redacted, "disabled": false, "downtime_type": 2, "end": null, "id": redacted, "message": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", "modified": 1730223125, "monitor_id": null, "monitor_tags": [ "*" ], "mute_first_recovery_notification": false, "notify_end_states": [ "alert", "no data", "warn" ], "notify_end_types": [ "expired" ], "org_id": redacted, "parent_id": null, "recurrence": null, "scope": [ "env:dev" ], "start": 1730223125, "status": "active", "timezone": "UTC", "updater_id": null, "uuid": "83c9346b-6617-4420-99a4-0cf83b62b972" }, "invocation": { "module_args": { "api_host": "https://api.datadoghq.eu", "api_key": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", "app_key": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", "downtime_message": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", "end": null, "id": redacted, "monitor_id": null, "monitor_tags": [ "*" ], "rrule": null, "scope": [ "env:dev" ], "start": null, "state": "present", "timezone": null } } } PLAY RECAP ******************************************************************************************************************************************************************************************************************************************************************** localhost : ok=3 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
The downtime is successfully created on Datadog, but the module reports an error (TypeError: Value of unknown type: <class 'uuid.UUID'>):
TypeError: Value of unknown type: <class 'uuid.UUID'>
TASK [Install python requirements] ******************************************************************************************************************************************************************************************************************************************** task path: /code/downtime.yml:4 <127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: root <127.0.0.1> EXEC /bin/sh -c 'echo ~root && sleep 0' <127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /root/.ansible/tmp `"&& mkdir "` echo /root/.ansible/tmp/ansible-tmp-1730223218.1108186-898-185242479329798 `" && echo ansible-tmp-1730223218.1108186-898-185242479329798="` echo /root/.ansible/tmp/ansible-tmp-1730223218.1108186-898-185242479329798 `" ) && sleep 0' Using module file /usr/local/lib/python3.13/site-packages/ansible/modules/pip.py <127.0.0.1> PUT /root/.ansible/tmp/ansible-local-859wq_8eu67/tmp0kcqo7e1 TO /root/.ansible/tmp/ansible-tmp-1730223218.1108186-898-185242479329798/AnsiballZ_pip.py <127.0.0.1> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1730223218.1108186-898-185242479329798/ /root/.ansible/tmp/ansible-tmp-1730223218.1108186-898-185242479329798/AnsiballZ_pip.py && sleep 0' <127.0.0.1> EXEC /bin/sh -c '/usr/local/bin/python3.13 /root/.ansible/tmp/ansible-tmp-1730223218.1108186-898-185242479329798/AnsiballZ_pip.py && sleep 0' <127.0.0.1> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-tmp-1730223218.1108186-898-185242479329798/ > /dev/null 2>&1 && sleep 0' changed: [localhost] => { "changed": true, "cmd": [ "/usr/local/bin/python3.13", "-m", "pip.__main__", "install", "--break-system-packages", "datadog-api-client==2.28.0" ], "invocation": { "module_args": { "break_system_packages": false, "chdir": null, "editable": false, "executable": null, "extra_args": "--break-system-packages", "name": [ "datadog-api-client==2.28.0" ], "requirements": null, "state": "present", "umask": null, "version": null, "virtualenv": null, "virtualenv_command": "virtualenv", "virtualenv_python": null, "virtualenv_site_packages": false } }, "name": [ "datadog-api-client==2.28.0" ], "requirements": null, "state": "present", "stderr": "WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager, possibly rendering your system unusable.It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv. Use the --root-user-action option if you know what you are doing and want to suppress this warning.\n\n[notice] A new release of pip is available: 24.2 -> 24.3.1\n[notice] To update, run: pip install --upgrade pip\n", "stderr_lines": [ "WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager, possibly rendering your system unusable.It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv. Use the --root-user-action option if you know what you are doing and want to suppress this warning.", "", "[notice] A new release of pip is available: 24.2 -> 24.3.1", "[notice] To update, run: pip install --upgrade pip" ], "stdout": "Collecting datadog-api-client==2.28.0\n Downloading datadog_api_client-2.28.0-py3-none-any.whl.metadata (7.4 kB)\nRequirement already satisfied: urllib3>=1.15 in /usr/local/lib/python3.13/site-packages (from datadog-api-client==2.28.0) (2.2.3)\nRequirement already satisfied: certifi in /usr/local/lib/python3.13/site-packages (from datadog-api-client==2.28.0) (2024.8.30)\nRequirement already satisfied: python-dateutil in /usr/local/lib/python3.13/site-packages (from datadog-api-client==2.28.0) (2.9.0.post0)\nRequirement already satisfied: typing-extensions>=4.0.0 in /usr/local/lib/python3.13/site-packages (from datadog-api-client==2.28.0) (4.12.2)\nRequirement already satisfied: six>=1.5 in /usr/local/lib/python3.13/site-packages (from python-dateutil->datadog-api-client==2.28.0) (1.16.0)\nDownloading datadog_api_client-2.28.0-py3-none-any.whl (2.6 MB)\n ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.6/2.6 MB 949.3 kB/s eta 0:00:00\nInstalling collected packages: datadog-api-client\nSuccessfully installed datadog-api-client-2.28.0\n", "stdout_lines": [ "Collecting datadog-api-client==2.28.0", " Downloading datadog_api_client-2.28.0-py3-none-any.whl.metadata (7.4 kB)", "Requirement already satisfied: urllib3>=1.15 in /usr/local/lib/python3.13/site-packages (from datadog-api-client==2.28.0) (2.2.3)", "Requirement already satisfied: certifi in /usr/local/lib/python3.13/site-packages (from datadog-api-client==2.28.0) (2024.8.30)", "Requirement already satisfied: python-dateutil in /usr/local/lib/python3.13/site-packages (from datadog-api-client==2.28.0) (2.9.0.post0)", "Requirement already satisfied: typing-extensions>=4.0.0 in /usr/local/lib/python3.13/site-packages (from datadog-api-client==2.28.0) (4.12.2)", "Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.13/site-packages (from python-dateutil->datadog-api-client==2.28.0) (1.16.0)", "Downloading datadog_api_client-2.28.0-py3-none-any.whl (2.6 MB)", " ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.6/2.6 MB 949.3 kB/s eta 0:00:00", "Installing collected packages: datadog-api-client", "Successfully installed datadog-api-client-2.28.0" ], "version": null, "virtualenv": null } TASK [Create or update downtime] ********************************************************************************************************************************************************************************************************************************************** task path: /code/downtime.yml:10 <127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: root <127.0.0.1> EXEC /bin/sh -c 'echo ~root && sleep 0' <127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /root/.ansible/tmp `"&& mkdir "` echo /root/.ansible/tmp/ansible-tmp-1730223240.1328485-927-151340192074776 `" && echo ansible-tmp-1730223240.1328485-927-151340192074776="` echo /root/.ansible/tmp/ansible-tmp-1730223240.1328485-927-151340192074776 `" ) && sleep 0' Using module file /usr/local/lib/python3.13/site-packages/ansible_collections/community/general/plugins/modules/datadog_downtime.py <127.0.0.1> PUT /root/.ansible/tmp/ansible-local-859wq_8eu67/tmpub24mhom TO /root/.ansible/tmp/ansible-tmp-1730223240.1328485-927-151340192074776/AnsiballZ_datadog_downtime.py <127.0.0.1> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1730223240.1328485-927-151340192074776/ /root/.ansible/tmp/ansible-tmp-1730223240.1328485-927-151340192074776/AnsiballZ_datadog_downtime.py && sleep 0' <127.0.0.1> EXEC /bin/sh -c '/usr/local/bin/python3.13 /root/.ansible/tmp/ansible-tmp-1730223240.1328485-927-151340192074776/AnsiballZ_datadog_downtime.py && sleep 0' <127.0.0.1> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-tmp-1730223240.1328485-927-151340192074776/ > /dev/null 2>&1 && sleep 0' fatal: [localhost]: FAILED! => { "changed": false, "module_stderr": "/tmp/ansible_community.general.datadog_downtime_payload_xmrkmu0r/ansible_community.general.datadog_downtime_payload.zip/ansible_collections/community/general/plugins/modules/datadog_downtime.py:212: DeprecationWarning: list_downtimes is deprecated\n/tmp/ansible_community.general.datadog_downtime_payload_xmrkmu0r/ansible_community.general.datadog_downtime_payload.zip/ansible_collections/community/general/plugins/modules/datadog_downtime.py:261: DeprecationWarning: create_downtime is deprecated\nTraceback (most recent call last):\n File \"/root/.ansible/tmp/ansible-tmp-1730223240.1328485-927-151340192074776/AnsiballZ_datadog_downtime.py\", line 107, in <module>\n _ansiballz_main()\n ~~~~~~~~~~~~~~~^^\n File \"/root/.ansible/tmp/ansible-tmp-1730223240.1328485-927-151340192074776/AnsiballZ_datadog_downtime.py\", line 99, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/root/.ansible/tmp/ansible-tmp-1730223240.1328485-927-151340192074776/AnsiballZ_datadog_downtime.py\", line 47, in invoke_module\n runpy.run_module(mod_name='ansible_collections.community.general.plugins.modules.datadog_downtime', init_globals=dict(_module_fqn='ansible_collections.community.general.plugins.modules.datadog_downtime', _modlib_path=modlib_path),\n ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n run_name='__main__', alter_sys=True)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"<frozen runpy>\", line 226, in run_module\n File \"<frozen runpy>\", line 98, in _run_module_code\n File \"<frozen runpy>\", line 88, in _run_code\n File \"/tmp/ansible_community.general.datadog_downtime_payload_xmrkmu0r/ansible_community.general.datadog_downtime_payload.zip/ansible_collections/community/general/plugins/modules/datadog_downtime.py\", line 316, in <module>\n File \"/tmp/ansible_community.general.datadog_downtime_payload_xmrkmu0r/ansible_community.general.datadog_downtime_payload.zip/ansible_collections/community/general/plugins/modules/datadog_downtime.py\", line 217, in main\n File \"/tmp/ansible_community.general.datadog_downtime_payload_xmrkmu0r/ansible_community.general.datadog_downtime_payload.zip/ansible_collections/community/general/plugins/modules/datadog_downtime.py\", line 297, in schedule_downtime\n File \"/tmp/ansible_community.general.datadog_downtime_payload_xmrkmu0r/ansible_community.general.datadog_downtime_payload.zip/ansible_collections/community/general/plugins/modules/datadog_downtime.py\", line 263, in _post_downtime\n File \"/tmp/ansible_community.general.datadog_downtime_payload_xmrkmu0r/ansible_community.general.datadog_downtime_payload.zip/ansible/module_utils/basic.py\", line 1453, in exit_json\n File \"/tmp/ansible_community.general.datadog_downtime_payload_xmrkmu0r/ansible_community.general.datadog_downtime_payload.zip/ansible/module_utils/basic.py\", line 1442, in _return_formatted\n File \"/tmp/ansible_community.general.datadog_downtime_payload_xmrkmu0r/ansible_community.general.datadog_downtime_payload.zip/ansible/module_utils/common/parameters.py\", line 927, in remove_values\n File \"/tmp/ansible_community.general.datadog_downtime_payload_xmrkmu0r/ansible_community.general.datadog_downtime_payload.zip/ansible/module_utils/common/parameters.py\", line 470, in _remove_values_conditions\nTypeError: Value of unknown type: <class 'uuid.UUID'>, af0190b0-ad7c-41d1-a435-c20771912059\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1 } PLAY RECAP ******************************************************************************************************************************************************************************************************************************************************************** localhost : ok=2 changed=1 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
The text was updated successfully, but these errors were encountered:
Files identified in the description:
plugins/modules/datadog_downtime.py
If these files are incorrect, please update the component name section of the description or use the !component bot command.
component name
!component
click here for bot help
Sorry, something went wrong.
cc @DataDog click here for bot help
No branches or pull requests
Summary
The datadog_downtime module throws a TypeError when creating a downtime with versions 2.28.0 and later of the datadog-api-client Python module.
I think this might be related to this MR on the datadog-api-client module
Issue Type
Bug Report
Component Name
datadog_downtime
Ansible Version
Community.general Version
Configuration
OS / Environment
Running Ansible on Docker :
Steps to Reproduce
Just use a simple playbook to try to create a new downtime, having installed version 2.28.0 or later of the datadog-api-client module
Expected Results
I expected the playbook to complete successfully, with the downtime created, as it does with this single change on the given playbook:
Actual Results
The downtime is successfully created on Datadog, but the module reports an error (
TypeError: Value of unknown type: <class 'uuid.UUID'>
):Code of Conduct
The text was updated successfully, but these errors were encountered: