Project

General

Profile

Actions

Bug #24063

closed

Server settings module fails when the value is a plain string

Added by Félix DALLIDET 11 months ago. Updated 7 months ago.

Status:
Released
Priority:
N/A
Category:
Ansible collection
Target version:
Severity:
UX impact:
User visibility:
Effort required:
Priority:
0
Name check:
To do
Fix check:
To do
Regression:
No

Description

To reproduce use the playbook below:

- name: Ansible test
  hosts: localhost
  tasks:
  - name: Complex Modify Rudder Settings
    become: yes
    collections:
      - rudder.rudder
    rudder.rudder.server_settings:
      rudder_url: "https://localhost/rudder" 
      validate_certs: False
      name: "{{ item.name }}" 
      value: "{{ item.value }}" 
    loop:
      - name: "rudder_save_db_compliance_details" 
        value: "false" 
      - name: "reporting_mode" 
        value: "changes-only" 

It produces the following error:

The full traceback is:
Traceback (most recent call last):
  File "/root/.ansible/tmp/ansible-tmp-1706029353.2044022-38193-70861070006311/AnsiballZ_server_settings.py", line 102, in <module>
    _ansiballz_main()
  File "/root/.ansible/tmp/ansible-tmp-1706029353.2044022-38193-70861070006311/AnsiballZ_server_settings.py", line 94, in _ansiballz_main
    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
  File "/root/.ansible/tmp/ansible-tmp-1706029353.2044022-38193-70861070006311/AnsiballZ_server_settings.py", line 40, in invoke_module
    runpy.run_module(mod_name='ansible_collections.rudder.rudder.plugins.modules.server_settings', init_globals=None, run_name='__main__', alter_sys=True)
  File "/usr/lib/python3.9/runpy.py", line 210, in run_module
    return _run_module_code(code, init_globals, run_name, mod_spec)
  File "/usr/lib/python3.9/runpy.py", line 97, in _run_module_code
    _run_code(code, mod_globals, init_globals,
  File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/tmp/ansible_rudder.rudder.server_settings_payload_rhmb2i1z/ansible_rudder.rudder.server_settings_payload.zip/ansible_collections/rudder/rudder/plugins/modules/server_settings.py", line 268, in <module>
  File "/tmp/ansible_rudder.rudder.server_settings_payload_rhmb2i1z/ansible_rudder.rudder.server_settings_payload.zip/ansible_collections/rudder/rudder/plugins/modules/server_settings.py", line 237, in main
  File "/tmp/ansible_rudder.rudder.server_settings_payload_rhmb2i1z/ansible_rudder.rudder.server_settings_payload.zip/ansible/module_utils/basic.py", line 2147, in from_json
  File "/usr/lib/python3.9/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.9/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.9/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
failed: [localhost] (item={'name': 'reporting_mode', 'value': 'changes-only'}) => {
    "ansible_loop_var": "item",
    "changed": false,
    "item": {
        "name": "reporting_mode",
        "value": "changes-only" 
    },
    "module_stderr": "Traceback (most recent call last):\n  File \"/root/.ansible/tmp/ansible-tmp-1706029353.2044022-38193-70861070006311/AnsiballZ_server_settings.py\", line 102, in <module>\n    _ansiballz_main()\n  File \"/root/.ansible/tmp/ansible-tmp-1706029353.2044022-38193-70861070006311/AnsiballZ_server_settings.py\", line 94, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/root/.ansible/tmp/ansible-tmp-1706029353.2044022-38193-70861070006311/AnsiballZ_server_settings.py\", line 40, in invoke_module\n    runpy.run_module(mod_name='ansible_collections.rudder.rudder.plugins.modules.server_settings', init_globals=None, run_name='__main__', alter_sys=True)\n  File \"/usr/lib/python3.9/runpy.py\", line 210, in run_module\n    return _run_module_code(code, init_globals, run_name, mod_spec)\n  File \"/usr/lib/python3.9/runpy.py\", line 97, in _run_module_code\n    _run_code(code, mod_globals, init_globals,\n  File \"/usr/lib/python3.9/runpy.py\", line 87, in _run_code\n    exec(code, run_globals)\n  File \"/tmp/ansible_rudder.rudder.server_settings_payload_rhmb2i1z/ansible_rudder.rudder.server_settings_payload.zip/ansible_collections/rudder/rudder/plugins/modules/server_settings.py\", line 268, in <module>\n  File \"/tmp/ansible_rudder.rudder.server_settings_payload_rhmb2i1z/ansible_rudder.rudder.server_settings_payload.zip/ansible_collections/rudder/rudder/plugins/modules/server_settings.py\", line 237, in main\n  File \"/tmp/ansible_rudder.rudder.server_settings_payload_rhmb2i1z/ansible_rudder.rudder.server_settings_payload.zip/ansible/module_utils/basic.py\", line 2147, in from_json\n  File \"/usr/lib/python3.9/json/__init__.py\", line 346, in loads\n    return _default_decoder.decode(s)\n  File \"/usr/lib/python3.9/json/decoder.py\", line 337, in decode\n    obj, end = self.raw_decode(s, idx=_w(s, 0).end())\n  File \"/usr/lib/python3.9/json/decoder.py\", line 355, in raw_decode\n    raise JSONDecodeError(\"Expecting value\", s, err.value) from None\njson.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)\n",
    "module_stdout": "",
    "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
    "rc": 1
}

Actions #1

Updated by Félix DALLIDET 11 months ago

  • Status changed from New to In progress
  • Assignee set to Félix DALLIDET
Actions #2

Updated by Félix DALLIDET 11 months ago

  • Status changed from In progress to Pending technical review
  • Assignee changed from Félix DALLIDET to Nicolas CHARLES
  • Pull Request set to https://github.com/Normation/rudder-ansible/pull/73
Actions #3

Updated by Félix DALLIDET 11 months ago

  • Status changed from Pending technical review to Pending release
Actions #4

Updated by Anonymous 11 months ago

Actions #5

Updated by Vincent MEMBRÉ 7 months ago

  • Status changed from Pending release to Released
Actions

Also available in: Atom PDF