Bug 1991142

Summary: [storage role] Get syntax errors in tests_lvm_errors.yml
Product: Red Hat Enterprise Linux 9 Reporter: Rich Megginson <rmeggins>
Component: rhel-system-rolesAssignee: Rich Megginson <rmeggins>
Status: CLOSED CURRENTRELEASE QA Contact: guazhang <guazhang>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 9.0CC: djez, guazhang, jharuda, nhosoi, rhel-cs-system-management-subsystem-qe, spetrosi
Target Milestone: betaKeywords: Triaged
Target Release: 9.0 BetaFlags: rmeggins: needinfo?
rmeggins: needinfo?
pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: role:storage
Fixed In Version: rhel-system-roles-1.8.1-1.el9 Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: 1990793 Environment:
Last Closed: 2021-12-07 22:04:56 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1990793    
Bug Blocks:    

Description Rich Megginson 2021-08-07 15:53:47 UTC
+++ This bug was initially created as a clone of Bug #1990793 +++

Description of problem:
Storage role regression testing failed, please have a look if hit a bug.

Version-Release number of selected component (if applicable):
rhel-system-roles-1.5.1-1.el8.noarch

How reproducible:


Steps to Reproduce:
1. ansible-playbook -vv -i host tests_lvm_errors.yml
2.
3.



TASK [rhel-system-roles.storage : get required packages] *******************************************************************************
task path: /usr/share/ansible/roles/rhel-system-roles.storage/tasks/main-blivet.yml:18
fatal: [localhost]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: [{'name': 'foo', 'disks': '{{ unused_disks[0] }}', 'volumes': [{'name': 'test1', 'size': '{{ volume_size }}', 'mount_point': '{{ mount_location1 }}'}]}]: 'volume_size' is undefined\n\nThe error appears to be in '/usr/share/ansible/roles/rhel-system-roles.storage/tasks/main-blivet.yml': line 18, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: get required packages\n  ^ here\n"}



task path: /usr/share/ansible/roles/rhel-system-roles.storage/tasks/main-blivet.yml:57
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: AttributeError: 'NoneType' object has no attribute '_device'
fatal: [localhost]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n  File \"/root/.ansible/tmp/ansible-tmp-1628238291.2594755-244172-85072390066614/AnsiballZ_blivet.py\", line 102, in <module>\n    _ansiballz_main()\n  File \"/root/.ansible/tmp/ansible-tmp-1628238291.2594755-244172-85072390066614/AnsiballZ_blivet.py\", line 94, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/root/.ansible/tmp/ansible-tmp-1628238291.2594755-244172-85072390066614/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.6/runpy.py\", line 205, in run_module\n    return _run_module_code(code, init_globals, run_name, mod_spec)\n  File \"/usr/lib64/python3.6/runpy.py\", line 96, in _run_module_code\n    mod_name, mod_spec, pkg_name, script_name)\n  File \"/usr/lib64/python3.6/runpy.py\", line 85, in _run_code\n    exec(code, run_globals)\n  File \"/tmp/ansible_blivet_payload_thpg5b7b/ansible_blivet_payload.zip/ansible/modules/blivet.py\", line 1530, in <module>\n  File \"/tmp/ansible_blivet_payload_thpg5b7b/ansible_blivet_payload.zip/ansible/modules/blivet.py\", line 1526, in main\n  File \"/tmp/ansible_blivet_payload_thpg5b7b/ansible_blivet_payload.zip/ansible/modules/blivet.py\", line 1488, in run_module\n  File \"/tmp/ansible_blivet_payload_thpg5b7b/ansible_blivet_payload.zip/ansible/modules/blivet.py\", line 1181, in manage_volume\n  File \"/tmp/ansible_blivet_payload_thpg5b7b/ansible_blivet_payload.zip/ansible/modules/blivet.py\", line 521, in manage\n  File \"/tmp/ansible_blivet_payload_thpg5b7b/ansible_blivet_payload.zip/ansible/modules/blivet.py\", line 348, in _look_up_device\n  File \"/tmp/ansible_blivet_payload_thpg5b7b/ansible_blivet_payload.zip/ansible/modules/blivet.py\", line 639, in _get_device_id\nAttributeError: 'NoneType' object has no attribute '_device'\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}



TASK [rhel-system-roles.storage : failed message] **************************************************************************************
task path: /usr/share/ansible/roles/rhel-system-roles.storage/tasks/main-blivet.yml:71
fatal: [localhost]: FAILED! => {"changed": false, "msg": {"changed": false, "exception": "Traceback (most recent call last):\n  File \"/root/.ansible/tmp/ansible-tmp-1628238291.2594755-244172-85072390066614/AnsiballZ_blivet.py\", line 102, in <module>\n    _ansiballz_main()\n  File \"/root/.ansible/tmp/ansible-tmp-1628238291.2594755-244172-85072390066614/AnsiballZ_blivet.py\", line 94, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/root/.ansible/tmp/ansible-tmp-1628238291.2594755-244172-85072390066614/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.6/runpy.py\", line 205, in run_module\n    return _run_module_code(code, init_globals, run_name, mod_spec)\n  File \"/usr/lib64/python3.6/runpy.py\", line 96, in _run_module_code\n    mod_name, mod_spec, pkg_name, script_name)\n  File \"/usr/lib64/python3.6/runpy.py\", line 85, in _run_code\n    exec(code, run_globals)\n  File \"/tmp/ansible_blivet_payload_thpg5b7b/ansible_blivet_payload.zip/ansible/modules/blivet.py\", line 1530, in <module>\n  File \"/tmp/ansible_blivet_payload_thpg5b7b/ansible_blivet_payload.zip/ansible/modules/blivet.py\", line 1526, in main\n  File \"/tmp/ansible_blivet_payload_thpg5b7b/ansible_blivet_payload.zip/ansible/modules/blivet.py\", line 1488, in run_module\n  File \"/tmp/ansible_blivet_payload_thpg5b7b/ansible_blivet_payload.zip/ansible/modules/blivet.py\", line 1181, in manage_volume\n  File \"/tmp/ansible_blivet_payload_thpg5b7b/ansible_blivet_payload.zip/ansible/modules/blivet.py\", line 521, in manage\n  File \"/tmp/ansible_blivet_payload_thpg5b7b/ansible_blivet_payload.zip/ansible/modules/blivet.py\", line 348, in _look_up_device\n  File \"/tmp/ansible_blivet_payload_thpg5b7b/ansible_blivet_payload.zip/ansible/modules/blivet.py\", line 639, in _get_device_id\nAttributeError: 'NoneType' object has no attribute '_device'\n", "failed": true, "module_stderr": "Traceback (most recent call last):\n  File \"/root/.ansible/tmp/ansible-tmp-1628238291.2594755-244172-85072390066614/AnsiballZ_blivet.py\", line 102, in <module>\n    _ansiballz_main()\n  File \"/root/.ansible/tmp/ansible-tmp-1628238291.2594755-244172-85072390066614/AnsiballZ_blivet.py\", line 94, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/root/.ansible/tmp/ansible-tmp-1628238291.2594755-244172-85072390066614/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.6/runpy.py\", line 205, in run_module\n    return _run_module_code(code, init_globals, run_name, mod_spec)\n  File \"/usr/lib64/python3.6/runpy.py\", line 96, in _run_module_code\n    mod_name, mod_spec, pkg_name, script_name)\n  File \"/usr/lib64/python3.6/runpy.py\", line 85, in _run_code\n    exec(code, run_globals)\n  File \"/tmp/ansible_blivet_payload_thpg5b7b/ansible_blivet_payload.zip/ansible/modules/blivet.py\", line 1530, in <module>\n  File \"/tmp/ansible_blivet_payload_thpg5b7b/ansible_blivet_payload.zip/ansible/modules/blivet.py\", line 1526, in main\n  File \"/tmp/ansible_blivet_payload_thpg5b7b/ansible_blivet_payload.zip/ansible/modules/blivet.py\", line 1488, in run_module\n  File \"/tmp/ansible_blivet_payload_thpg5b7b/ansible_blivet_payload.zip/ansible/modules/blivet.py\", line 1181, in manage_volume\n  File \"/tmp/ansible_blivet_payload_thpg5b7b/ansible_blivet_payload.zip/ansible/modules/blivet.py\", line 521, in manage\n  File \"/tmp/ansible_blivet_payload_thpg5b7b/ansible_blivet_payload.zip/ansible/modules/blivet.py\", line 348, in _look_up_device\n  File \"/tmp/ansible_blivet_payload_thpg5b7b/ansible_blivet_payload.zip/ansible/modules/blivet.py\", line 639, in _get_device_id\nAttributeError: 'NoneType' object has no attribute '_device'\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}}

--- Additional comment from Rich Megginson on 2021-08-06 14:33:42 UTC ---

What is your controller platform (el8? el8.5?) and what version of ansible are you using - 2.8 or 2.9?

I see this message in the output from running my test on f34 using ansible 2.9:

The task includes an option with an undefined variable. The error was: [{'name': 'foo', 'disks': '{{ unused_disks[0] }}', 'volumes': [{'name': 'test1', 'size': '{{ volume_size }}', 'mount_point': '{{ mount_location1 }}'}]}]: 'volume_size' is undefined

The error appears to be in '/home/rmeggins/linux-system-roles/storage/tasks/main-blivet.yml': line 18, column 3, but may
be elsewhere in the file depending on the exact syntax problem.

but the "rescue:" block handles this 

So I'm not sure how this error "leaked" out of the rescue block - that's really strange

This is a real bug and I am going to fix it - but I want to know why this wasn't found by CI testing

--- Additional comment from guazhang on 2021-08-07 13:13:36 UTC ---

Hi,

# ansible --version
ansible 2.9.23
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.6/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.6.8 (default, Jul 14 2021, 07:24:37) [GCC 8.5.0 20210514 (Red Hat 8.5.0-2)]

[root@storageqe-90 ~]# uname -a
Linux storageqe-90.lab.eng.brq.redhat.com 4.18.0-326.el8.x86_64 #1 SMP Tue Jul 27 20:07:27 EDT 2021 x86_64 x86_64 x86_64 GNU/Linux   
[root@storageqe-90 ~]# cat /etc/redhat-release 
Red Hat Enterprise Linux release 8.6 Beta (Ootpa)
DISTRO=RHEL-8.5.0-20210730.n.0

I test it by my physics server and hit it every time, the error is very easy to reproduce.

Comment 3 guazhang@redhat.com 2021-08-16 04:41:55 UTC
Hi

rhel-system-roles-1.7.5-99.el9.noarch

TASK [rhel-system-roles.storage : get required packages] ***********************
task path: /usr/share/ansible/roles/rhel-system-roles.storage/tasks/main-blivet.yml:18
ok: [localhost] => {"actions": [], "changed": false, "crypts": [], "leaves": [], "mounts": [], "packages": [], "pools": [], "volumes": []}


fixed the task [get required packages] error.

Comment 7 guazhang@redhat.com 2021-08-19 14:29:58 UTC
Hi,

the package  rhel-system-roles-1.8.1-1.el9 has fixed the issue. move to verified.