Skip to content

intersight_local_user_policy crashes in check mode if Local User Policy doesn't exist #178

@cgascoig

Description

@cgascoig

Example task:

    - name: Configure Local User policy
      cisco.intersight.intersight_local_user_policy:
        organization: "{{ org_name }}"
        name: "{{ name_prefix }}-local_user-pol"
        tags: *tags
        description: User named guest with admin role
        enforce_strong_password: false
        password_history: 0
        local_users:
          - username: guest
            role: admin
            password: Cisco123!!

Crash output

$ ansible-playbook --check ansible/main.yml
[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'
[WARNING]: Found variable using reserved name: tags

PLAY [Deploy Server Profiles] ********************************************************************************************************************************************************************************
[... omitted ...]
TASK [Configure Local User policy] ***************************************************************************************************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: TypeError: can only concatenate str (not "NoneType") to str
fatal: [localhost]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n  File \"/Users/cgascoig/.ansible/tmp/ansible-tmp-1752042618.093864-16499-82254158809843/AnsiballZ_intersight_local_user_policy.py\", line 107, in <module>\n    _ansiballz_main()\n    ~~~~~~~~~~~~~~~^^\n  File \"/Users/cgascoig/.ansible/tmp/ansible-tmp-1752042618.093864-16499-82254158809843/AnsiballZ_intersight_local_user_policy.py\", line 99, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n    ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/Users/cgascoig/.ansible/tmp/ansible-tmp-1752042618.093864-16499-82254158809843/AnsiballZ_intersight_local_user_policy.py\", line 47, in invoke_module\n    runpy.run_module(mod_name='ansible_collections.cisco.intersight.plugins.modules.intersight_local_user_policy', init_globals=dict(_module_fqn='ansible_collections.cisco.intersight.plugins.modules.intersight_local_user_policy', _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 \"/var/folders/xn/2hp8y1pn6kqc1cjnf9jzdhx80000gn/T/ansible_cisco.intersight.intersight_local_user_policy_payload_5ummdfs8/ansible_cisco.intersight.intersight_local_user_policy_payload.zip/ansible_collections/cisco/intersight/plugins/modules/intersight_local_user_policy.py\", line 389, in <module>\n  File \"/var/folders/xn/2hp8y1pn6kqc1cjnf9jzdhx80000gn/T/ansible_cisco.intersight.intersight_local_user_policy_payload_5ummdfs8/ansible_cisco.intersight.intersight_local_user_policy_payload.zip/ansible_collections/cisco/intersight/plugins/modules/intersight_local_user_policy.py\", line 381, in main\nTypeError: can only concatenate str (not \"NoneType\") to str\n", "module_stdout": "", "msg": "MODULE FAILURE: No start of json char found\nSee stdout/stderr for the exact error", "rc": 1}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions