Bug 1398804

Summary: cannot create Foreman or AnsibleTower provider via API
Product: Red Hat CloudForms Management Engine Reporter: Wolfram Richter <wrichter>
Component: APIAssignee: Gregg Tanzillo <gtanzill>
Status: CLOSED CURRENTRELEASE QA Contact: Martin Kourim <mkourim>
Severity: medium Docs Contact:
Priority: medium    
Version: 5.6.0CC: cbolz, jhardy, obarenbo, rwolters, slukasik
Target Milestone: GA   
Target Release: cfme-future   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: rest:satellite:tower
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-12-16 10:11:14 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:

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!