Bug 1398804 - cannot create Foreman or AnsibleTower provider via API
Summary: cannot create Foreman or AnsibleTower provider via API
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: API
Version: 5.6.0
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: GA
: cfme-future
Assignee: Gregg Tanzillo
QA Contact: Martin Kourim
URL:
Whiteboard: rest:satellite:tower
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-11-26 08:41 UTC by Wolfram Richter
Modified: 2019-08-06 20:05 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-12-16 10:11:14 UTC
Category: ---
Cloudforms Team: ---
Target Upstream Version:


Attachments (Terms of Use)

Description Wolfram Richter 2016-11-26 08:41:59 UTC
Description of problem:

CFME returns errors when creating the Foreman or AnsibleTower providers based on the documented sample https://github.com/ManageIQ/manageiq_docs/blob/master/api/reference/providers.adoc#foreman-support

Version-Release number of selected component (if applicable):
CFME 5.6.2.2.20161017185613_7cee0a0 

How reproducible:
100%

Steps to Reproduce:
1. Use curl to POST the sample json structure to cfme provider api endpoint
2. Vary the json structure to include/exclude the URL parameter
3.


Actual results:

# curl -k  -u admin:XXXXX -d '{
  "type"      : "ManageIQ::Providers::Foreman::Provider",
  "name"      : "new_foreman_111",
  "url"       : "100.200.300.111",
  "credentials" : {
    "userid"   : "foreman_admin",
    "password" : "foreman_password"
  }
}' https://localhost/api/providers?provider_class=provider
{"error":{"kind":"bad_request","message":"Could not create the new provider - Invalid Provider attributes url specified","klass":"ApiController::BadRequestError"}}

# curl -k  -u admin:redhat01 -d '{
  "type"      : "ManageIQ::Providers::Foreman::Provider",
  "name"      : "new_foreman_111",
  "credentials" : {
    "userid"   : "foreman_admin",
    "password" : "foreman_password"
  }
}' https://localhost/api/providers?provider_class=provider
{"error":{"kind":"bad_request","message":"Could not create the new provider - Validation failed: Url can't be blank","klass":"ApiController::BadRequestError"}}


Expected results:
Provider is created, summary is returned


Additional info:

Same also applies to the AnsibleTower provider

This check does seem to flag "url" as an invalid parameter:
https://github.com/ManageIQ/manageiq/blob/master/app/controllers/api/providers_controller.rb#L193

Comment 4 Wolfram Richter 2016-12-13 22:00:17 UTC
This is also working on CFME 5.6.3.3.20161128141841_49d925b which solves the problem for me.

Comment 5 Šimon Lukašík 2016-12-16 10:11:14 UTC
Thanks for confirmation!


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