storage icon indicating copy to clipboard operation
storage copied to clipboard

LVM: Running role in --check mode causes failure at TASK [linux-system-roles.storage : get required packages]

Open benblasco opened this issue 2 years ago • 2 comments

Problem statement and error

I was testing the role for the first time and wanted to run it in --check mode to verify the behaviour, but it would fail. Here is the error

TASK [linux-system-roles.storage : get required packages] *****************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: NameError: name 'devices' is not defin
ed                                                                                                                                     
fatal: [localhost]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n  File \"/home/bblasco/.ansible
/tmp/ansible-tmp-1651110898.850052-489119-163256305427217/AnsiballZ_blivet.py\", line 102, in <module>\n    _ansiballz_main()\n  File \
"/home/bblasco/.ansible/tmp/ansible-tmp-1651110898.850052-489119-163256305427217/AnsiballZ_blivet.py\", line 94, in _ansiballz_main\n  
  invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/home/bblasco/.ansible/tmp/ansible-tmp-1651110898.850052-489119-1632
56305427217/AnsiballZ_blivet.py\", line 40, in invoke_module\n    runpy.run_module(mod_name='ansible.modules.blivet', init_globals=None
, run_name='__main__', alter_sys=True)\n  File \"/usr/lib64/python3.8/runpy.py\", line 207, in run_module\n    return _run_module_code(
code, init_globals, run_name, mod_spec)\n  File \"/usr/lib64/python3.8/runpy.py\", line 97, in _run_module_code\n    _run_code(code, mo
d_globals, init_globals,\n  File \"/usr/lib64/python3.8/runpy.py\", line 87, in _run_code\n    exec(code, run_globals)\n  File \"/tmp/a
nsible_blivet_payload_1xe7hh39/ansible_blivet_payload.zip/ansible/modules/blivet.py\", line 577, in <module>\n  File \"/tmp/ansible_bli
vet_payload_1xe7hh39/ansible_blivet_payload.zip/ansible/modules/blivet.py\", line 578, in BlivetDiskVolume\nNameError: name 'devices' i
s not defined\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}               

I googled the problem and came across this Red Hat KB article: https://access.redhat.com/solutions/6726561

I am already using Python 3, and was using localhost with connection = local.

I tried to run the playbook in regular (not --check) mode, and it ran perfectly. Subsequent executions of the playbook in --check mode generate no errors either. I have reproduced the issue on two separate machines.

Steps to generate the error

  1. Create a playbook that uses this role
  2. Run in check mode - Result = error as per above
  3. Run same playbook in regular mode - Result = success
  4. Run in check mode again - Result = success

Environment info

OS: Fedora 32 (also reproducible on Fedora 35) Ansible version: ansible-2.9.21-1.fc32.noarch AND ansible-2.9.27-1.fc35.noarch Link to the playbook I am testing with: https://github.com/benblasco/fedoralaptop/blob/master/nuc_storage_samsung.yml

benblasco avatar Apr 28 '22 02:04 benblasco

Please note that this issue was created after discussion with Brian Smith at Red Hat.

benblasco avatar Apr 28 '22 02:04 benblasco

Execution log showing

  1. Run in check mode failing (more than once)
  2. Run in normal mode succeeding
  3. Run in check mode succeeding

error_log_20220428.txt

benblasco avatar Apr 28 '22 02:04 benblasco

fixed

richm avatar Jul 23 '24 20:07 richm