Bug 1611946

Summary: syncrou.manageiq-automate : Initialize the Workspace failed
Product: Red Hat CloudForms Management Engine Reporter: Gellert Kis <gekis>
Component: AutomateAssignee: William Fitzgerald <wfitzger>
Status: CLOSED CURRENTRELEASE QA Contact: Dmitry Misharov <dmisharo>
Severity: high Docs Contact:
Priority: high    
Version: 5.9.3CC: abellott, dbomhof, dluong, dmetzger, dmisharo, gekis, gmccullo, jprause, ncarboni, obarenbo, pkomanek, simaishi, tfitzger, wfitzger, WilliamC.Elliott
Target Milestone: GAKeywords: TestOnly, ZStream
Target Release: 5.10.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 5.10.0.22 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1644410 (view as bug list) Environment:
5.9.3.4
Last Closed: 2019-02-12 16:51:15 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: Bug
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: Ansible Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1644410    

Comment 11 Tina Fitzgerald 2018-08-22 16:38:42 UTC
Hi Gellert,

Thanks for the update. 

Setting a needinfo, waiting for the customer to respond to question 3.

Thanks,
Tina

Comment 14 Tina Fitzgerald 2018-09-17 19:20:22 UTC
Hi Gellert,

Checking to see if there is an update from the customer.

Regards,
Tina

Comment 15 WilliamC.Elliott 2018-09-28 06:24:55 UTC
We experience a problem with workspace initialization. Can I post a detailed description here? (cfme-5.9.4.7)

Comment 19 Greg McCullough 2018-10-04 17:36:21 UTC
Patrik - I will setup a meeting to review this work with DrewB tomorrow.

Comment 21 Greg McCullough 2018-10-05 14:48:04 UTC
David - That would explain the issue, the automate_workspace is only passed to the Automate Method Type Ansible Playbook, not to the catalog items.

We will be working on changes to the module so it does not expect the workspace all the time.

Comment 22 David Luong 2018-10-05 19:54:27 UTC
Hey Drew, Greg,

This is what the customer is coming back with:
---
I'm using this playbook inside embedded as a method.  Those are the debug variables.

Base on: https://github.com/syncrou/manageiq-automate/blob/master/library/manageiq_automate.py
This code will never work in line 71 because there is't variable manageiq_connection.automate_workspace.

TASK [debug] *******************************************************************
ok: [localhost] => {
    "manageiq": {
        "X_MIQ_Group": "EvmGroup-super_administrator",
        "api_token": "a98e308f8b36fdcd115d4cb5ec99920d",
        "api_url": "https://10.99.16.254",
        "automate_workspace": "automate_workspaces/79c21887-576a-4943-bc32-5b350777e6bc",
        "group": "groups/99000000000002",
        "request_task": "requests/99000000000083/request_tasks/99000000000083",
        "user": "users/99000000000001"
    }
}

TASK [debug] *******************************************************************
ok: [localhost] => {
    "manageiq_connection": {
        "X_MIQ_Group": "EvmGroup-super_administrator",
        "token": "a98e308f8b36fdcd115d4cb5ec99920d",
        "url": "https://10.99.16.254"
    }
---

Comment 23 Greg McCullough 2018-10-09 14:08:33 UTC
David, That is what we would expect to see passed from this code:

https://github.com/ManageIQ/manageiq-automation_engine/blob/master/lib/miq_automation_engine/engine/miq_ae_engine/miq_ae_playbook_method.rb#L150-L151

The two keys are setup in extra_vars hash and populated from this code:

https://github.com/ManageIQ/manageiq-automation_engine/blob/master/lib/miq_automation_engine/engine/miq_ae_engine/miq_ae_playbook_method.rb#L112-L128

This is done for backwards compatibility and the module merges the keys together in this action_plugin here: 

https://github.com/syncrou/manageiq-automate/blob/master/action_plugins/manageiq_automate.py#L60-L65

I would not expect their playbook to fail with the same AttributeError that was originally reported.

Comment 26 Greg McCullough 2018-10-29 21:33:08 UTC
This BZ is resolved with https://github.com/ManageIQ/manageiq-content/pull/454. 

Which is already back-ported to Hammer for Bug 1626152 and labeled for Gaprindashvili.

Note: The updated module will only report why it cannot run if the workspace url isn't passed.  There is no way for the module to continue if it is run in the wrong context.

Comment 28 Dmitry Misharov 2018-11-01 13:30:57 UTC
Can you please provide verification steps?

Comment 29 Greg McCullough 2018-11-02 12:45:31 UTC
Billy - Based on comment #26 can you run this with the updated module in an invalid context (comment #17) so we can provide QE an idea of how the updated module will report the error condition.  DrewB will be able to help you if needed.

Comment 30 William Fitzgerald 2018-11-02 15:58:07 UTC
Dmitry,

You need a playbook that uses the workspace.  I have a playbook in my repository that you can use: https://github.com/billfitzgerald0120/ansible_playbooks/blob/master/get_attributes.yml  

Verification steps:

1. Enable Embedded Ansible
2. Add Repository
3. Add a Catalog
4. Add a Catalog Item
5. Catalog Item Type -> Ansible Playbook
6. Name -> <your_name>
7. Display in Catalog -> yes
8. Select catalog -> <your_catalog>
9. Repository ->  https://github.com/billfitzgerald0120/ansible_playbooks or your_repo
10. Playbook that uses the workspace -> get_attributes or your playbook
11. Machine Credential -> CFME Default Credential
12. Dialog - > Create a new one
13. Click -> Add
14. Order the Service
15. Service should fail, check evm.log for the following message:

TASK [syncrou.manageiq-automate : Initialize the Workspace] ********************^M
fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "msg": "Required parameter 'automate_workspace' is not specified"}^M
^M

Reproducer: 10.8.198.202

Billy

Comment 31 Dmitry Misharov 2018-11-05 14:14:45 UTC
Verified in 5.10.0.22.20181030184024_26956a0.