Bug 1736116

Summary: manageiq-automate and manageiq-vmdb roles fail with python 3
Product: Red Hat CloudForms Management Engine Reporter: Nick Carboni <ncarboni>
Component: AutomateAssignee: Drew Bomhof <dbomhof>
Status: CLOSED DUPLICATE QA Contact: Sudhir Mallamprabhakara <smallamp>
Severity: high Docs Contact: Red Hat CloudForms Documentation <cloudforms-docs>
Priority: high    
Version: 5.11.0CC: dbomhof, dmetzger, gmccullo, mkanoor, obarenbo, smallamp
Target Milestone: GA   
Target Release: 5.11.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-08-09 21:48:28 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: Bug
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: CFME Core Target Upstream Version:
Embargoed:

Description Nick Carboni 2019-08-01 14:47:17 UTC
Description of problem:

RHEL 8 ships with python 3 by default so our ansible modules need to be compatible with python 3.

Currently running the manageiq-automate role will yield the following error:

[----] I, [2019-07-31T15:53:07.528940 #13951:2b098d0725bc]  INFO -- : Q-task_id([r5_service_template_provision_task_5]) MIQ(ManageIQ::Providers::EmbeddedAnsible::AutomationManager::PlaybookRunner#log_stdout) Stdout from playbook manageiq-automate_role_bug_example.yml: 

PLAY [manageiq-automate role bug example] **************************************

TASK [manageiq-core.manageiq-automate : Initialize the Workspace] **************

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: AttributeError: 'dict' object has no attribute 'iteritems'
fatal: [localhost]: FAILED! => {"ansible_facts": {"discovered_interpreter_python": "/usr/libexec/platform-python"}, "changed": false, "module_stderr": "Traceback (most recent call last):\n  File \"/root/.ansible/tmp/ansible-tmp-1564602748.1169078-260481528705529/AnsiballZ_manageiq_automate.py\", line 114, in <module>\n    _ansiballz_main()\n  File \"/root/.ansible/tmp/ansible-tmp-1564602748.1169078-260481528705529/AnsiballZ_manageiq_automate.py\", line 106, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/root/.ansible/tmp/ansible-tmp-1564602748.1169078-260481528705529/AnsiballZ_manageiq_automate.py\", line 49, in invoke_module\n    imp.load_module('__main__', mod, module, MOD_DESC)\n  File \"/usr/lib64/python3.6/imp.py\", line 235, in load_module\n    return load_source(name, filename, file)\n  File \"/usr/lib64/python3.6/imp.py\", line 170, in load_source\n    module = _exec(spec, sys.modules[name])\n  File \"<frozen importlib._bootstrap>\", line 618, in _exec\n  File \"<frozen importlib._bootstrap_external>\", line 678, in exec_module\n  File \"<frozen importlib._bootstrap>\", line 219, in _call_with_frames_removed\n  File \"/tmp/ansible_manageiq_automate_payload_mwfakkab/__main__.py\", line 503, in <module>\n  File \"/tmp/ansible_manageiq_automate_payload_mwfakkab/__main__.py\", line 489, in main\nAttributeError: 'dict' object has no attribute 'iteritems'\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}

PLAY RECAP *********************************************************************
localhost                  : ok=0    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0


Version-Release number of selected component (if applicable):
5.11.0.17


Steps to Reproduce:
1. Create an ansible playbook automate method which runs one of the listed modules
2. Run the method
3. Observe failures

Actual results:
Playbook fails

Expected results:
Playbook succeeds

Additional info:
The issue was initially discovered as a part of validating bug 1734902 which allows us to run playbooks using those roles out of the box.

Comment 2 Drew Bomhof 2019-08-06 21:45:28 UTC
PR: https://github.com/ManageIQ/manageiq-content/pull/556

Comment 3 Drew Bomhof 2019-08-06 21:48:09 UTC
Do we have any examples of manageiq-vmdb failing with Python 3? The title of this BZ suggests that's the case, though there is no use of the `iteritems()` method in manageiq-vmdb.

Comment 4 Drew Bomhof 2019-08-07 18:32:03 UTC
PR: https://github.com/ManageIQ/manageiq-content/pull/556 is closed due to new information that the changes will need to be backwards compatible with Python 2, 3

Comment 5 Drew Bomhof 2019-08-09 21:48:28 UTC

*** This bug has been marked as a duplicate of bug 1738542 ***

Comment 6 Red Hat Bugzilla 2023-09-14 05:38:11 UTC
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 1000 days