Bug 1509809

Summary: Ui :Server Error occurs when adding ansible playbook service catalog item with the same name
Product: Red Hat CloudForms Management Engine Reporter: Niyaz Akhtar Ansari <nansari>
Component: UI - OPSAssignee: Martin Hradil <mhradil>
Status: CLOSED CURRENTRELEASE QA Contact: Niyaz Akhtar Ansari <nansari>
Severity: high Docs Contact:
Priority: high    
Version: 5.9.0CC: dajohnso, hkataria, jhardy, mhradil, mpovolny, nansari, obarenbo, simaishi
Target Milestone: GAKeywords: TestOnly
Target Release: 5.10.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 5.10.0.0 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1513618 (view as bug list) Environment:
Last Closed: 2018-06-21 20:25:51 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:    
Bug Blocks: 1439135, 1513618    
Attachments:
Description Flags
server api error none

Description Niyaz Akhtar Ansari 2017-11-06 07:01:10 UTC
Created attachment 1348424 [details]
server api error

Description of problem:


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

How reproducible:
100%

Steps to Reproduce:
1.Enable Embedded Ansible role.
2.Add some repositories with ansible playbooks.
3.Navigate to Services/Catalogs/Catalog Items.
4.Create "Ansible Playbook" catalog item
5.Again repeat step 4 with the same name 

Actual results:


Expected results:


Additional info:
Evm.log error:

[----] E, [2017-11-06T01:58:49.028334 #13144:1317134] ERROR -- : AnsibleTowerClient::Middleware::RaiseTowerError Response Body:
[----] E, [2017-11-06T01:58:49.028934 #13144:1317134] ERROR -- : MIQ(MiqQueue#deliver) Message id: [1128], Error: [{"name":["Job template with this Name already exists."]}]
[----] E, [2017-11-06T01:58:49.029187 #13144:1317134] ERROR -- : [AnsibleTowerClient::ClientError]: {"name":["Job template with this Name already exists."]}  Method:[block in method_missing]
[----] E, [2017-11-06T01:58:49.029276 #13144:1317134] ERROR -- : /opt/rh/cfme-gemset/gems/ansible_tower_client-0.12.2/lib/ansible_tower_client/middleware/raise_tower_error.rb:23:in `on_complete'

Comment 2 Martin Hradil 2017-11-14 17:11:22 UTC
So.. what is the BZ about? 

It's a bit hard to guess without Actual results and Expected results - hence the fields' existence in the template ;).


I can confirm I see the error.
I also see a flash message about the error.
The error seems valid given the steps.


(Perhaps the resolution should be to not show the error modal on validation errors and only show the flash message?)

Comment 5 CFME Bot 2017-11-15 12:28:15 UTC
New commit detected on ManageIQ/manageiq-ui-classic/master:
https://github.com/ManageIQ/manageiq-ui-classic/commit/dafc94e68ca0041891bfcb1b5d58850cf4864aae

commit dafc94e68ca0041891bfcb1b5d58850cf4864aae
Author:     Martin Hradil <mhradil>
AuthorDate: Tue Nov 14 18:22:10 2017 +0000
Commit:     Martin Hradil <mhradil>
CommitDate: Tue Nov 14 18:22:10 2017 +0000

    PostService - skipError on 400, deduplicate
    
    go to Services > Catalogs, Catalog Items accordion
    create a new Catalog Item, of type Ansible Playbook
    do stuff to trigger a validation error on saving (duplicate name, badly configured embedded ansible)
    
    Before - you'll see the error modal pop up, and a flash message.
    
    Now - you'll only see the flash message.
    
    This also cleans up postService:
      * there were 2 identical brances differing in `action: 'edit'` vs `action: 'create'`
      * handleSuccess handled errors, separately from handleFailure but same way
      * $timeout was being used to compensate for not having originally injected the angular API variant
    
    (`postService` is only used by that single form - but that's a TODO for later)
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1509809

 app/assets/javascripts/services/post_service.js | 85 +++++++++++--------------
 1 file changed, 38 insertions(+), 47 deletions(-)