Bug 1379079 - [RFE] better traceback for Ansible Tower API errors
Summary: [RFE] better traceback for Ansible Tower API errors
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Providers
Version: 5.6.0
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: GA
: 5.8.0
Assignee: Brandon Dunne
QA Contact: Pavol Kotvan
URL:
Whiteboard: tower
Depends On:
Blocks: 1411507
TreeView+ depends on / blocked
 
Reported: 2016-09-24 17:49 UTC by Tsai Li Ming
Modified: 2017-06-12 16:20 UTC (History)
4 users (show)

Fixed In Version: 5.8.0.0
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1411507 (view as bug list)
Environment:
Last Closed: 2017-06-12 16:20:06 UTC
Category: ---
Cloudforms Team: Ansible
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Tsai Li Ming 2016-09-24 17:49:54 UTC
Description of problem:
Currently, if the API fails, the evm.log will contain a "DRb::DRbConnError: connection closed" error without any details of the API response. 

I was clueless and it took me some time to figure out that this was an API error. I had to look at Ansible tower httpd log and it was a HTTP 400 error.

Did a tcpdump and found out:
POST /api/v1/job_templates/5/launch/ HTTP/1.1
Authorization: Basic YWRtaW46c3lzdGVt
User-Agent: Faraday v0.9.2
Content-Type: application/json
Accept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3
Accept: */*
Connection: close
Host: xxxx
Content-Length: 19
{"extra_vars":"{}"}
HTTP/1.1 400 BAD REQUEST
<followed by reason in the response>


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

How reproducible:
Always

Steps to Reproduce:
1. Add Ansible Tower as provider
2. Create a job template but without credentials
3. Launch the job template from CF


Actual results:
Exception without any further details why the API fails.

Expected results:
There should be better logging.

Additional info:

Comment 2 Brandon Dunne 2016-12-06 15:09:45 UTC
Error messages are now properly parsed.  Added error logging on errors.  Added optional debug logging to aid in troubleshooting.

Comment 4 CFME Bot 2016-12-06 17:16:35 UTC
New commit detected on ManageIQ/manageiq/master:
https://github.com/ManageIQ/manageiq/commit/0366af17f56f73e73cbd28b2b01c742b21651818

commit 0366af17f56f73e73cbd28b2b01c742b21651818
Author:     Brandon Dunne <bdunne>
AuthorDate: Mon Dec 5 15:37:14 2016 -0500
Commit:     Brandon Dunne <bdunne>
CommitDate: Mon Dec 5 15:37:14 2016 -0500

    Ensure AnsibleTowerClient.logger is set to $log not a NullLogger
    
    Update ansible_tower_client to take advantage of debug and error logging enhancements
    https://bugzilla.redhat.com/show_bug.cgi?id=1393941
    https://bugzilla.redhat.com/show_bug.cgi?id=1379079

 Gemfile                                                 | 2 +-
 app/models/manageiq/providers/ansible_tower/provider.rb | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comment 5 Brandon Dunne 2016-12-06 18:36:57 UTC
https://github.com/ManageIQ/manageiq/pull/12996


Note You need to log in before you can comment on or make changes to this bug.