Bug 1140313

Summary: Cannot read an auth source ldap's host via the API
Product: Red Hat Satellite Reporter: jaudet
Component: APIAssignee: jmagen <jmagen>
Status: CLOSED ERRATA QA Contact: Og Maciel <omaciel>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.0.4CC: cwelton, dcleal, jmagen, omaciel, sthirugn
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
URL: http://projects.theforeman.org/issues/7409
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-08-12 05:16:19 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:

Description jaudet 2014-09-10 16:30:53 UTC
Description of problem:
Host information is not returned when issuing an HTTP GET request to api/v2/auth_source_ldaps/:id. This does not make sense:

* The "host" parameter must be specified when creating an auth source ldap. If this parameter is necessary when creating an auth source ldap, shouldn't it be possible to read back that information later?
* The API documentation of theforeman.org provides an example of issuing an HTTP GET to api/v2/auth_source_ldaps/:id. The "host" parameter is returned.

Version-Release number of selected component (if applicable):
I tested this issue against qe-sat6-rhel65, which is running Satellite 6.0.4. The following software is installed on that machine:

* apr-util-ldap-1.3.9-3.el6_0.1.x86_64
* candlepin-0.9.23-1.el6_5.noarch
* candlepin-common-1.0.1-1.el6_5.noarch
* candlepin-scl-1-5.el6_4.noarch
* candlepin-scl-quartz-2.1.5-5.el6_4.noarch
* candlepin-scl-rhino-1.7R3-1.el6_4.noarch
* candlepin-scl-runtime-1-5.el6_4.noarch
* candlepin-selinux-0.9.23-1.el6_5.noarch
* candlepin-tomcat6-0.9.23-1.el6_5.noarch
* elasticsearch-0.90.10-6.el6sat.noarch
* foreman-1.6.0.44-1.el6sat.noarch
* foreman-compute-1.6.0.44-1.el6sat.noarch
* foreman-gce-1.6.0.44-1.el6sat.noarch
* foreman-libvirt-1.6.0.44-1.el6sat.noarch
* foreman-ovirt-1.6.0.44-1.el6sat.noarch
* foreman-postgresql-1.6.0.44-1.el6sat.noarch
* foreman-proxy-1.6.0.30-1.el6sat.noarch
* foreman-selinux-1.6.0.14-1.el6sat.noarch
* foreman-vmware-1.6.0.44-1.el6sat.noarch
* katello-1.5.0-30.el6sat.noarch
* katello-certs-tools-1.5.6-1.el6sat.noarch
* katello-default-ca-1.0-1.noarch
* katello-installer-0.0.64-1.el6sat.noarch
* katello-server-ca-1.0-1.noarch
* openldap-2.4.23-32.el6_4.1.x86_64
* pulp-katello-0.3-4.el6sat.noarch
* pulp-nodes-common-2.4.1-0.7.beta.el6sat.noarch
* pulp-nodes-parent-2.4.1-0.7.beta.el6sat.noarch
* pulp-puppet-plugins-2.4.1-0.7.beta.el6sat.noarch
* pulp-puppet-tools-2.4.1-0.7.beta.el6sat.noarch
* pulp-rpm-plugins-2.4.1-0.7.beta.el6sat.noarch
* pulp-selinux-2.4.1-0.7.beta.el6sat.noarch
* pulp-server-2.4.1-0.7.beta.el6sat.noarch
* python-ldap-2.3.10-1.el6.x86_64
* ruby193-rubygem-net-ldap-0.3.1-3.el6sat.noarch
* ruby193-rubygem-runcible-1.1.0-2.el6sat.noarc

How reproducible:
Always.

Steps to Reproduce:
1. Issue an HTTP GET request to api/v2/auth_source_ldaps/:id.
2. Examine the response. Look for a "host" parameter.

Actual results:
The following parameters are returned when reading an auth source LDAP:

    [
        u'account',
        u'name',
        u'attr_firstname',
        u'attr_lastname',
        u'attr_login',
        u'attr_mail',
        u'attr_photo',
        u'base_dn',
        u'created_at',
        u'id',
        u'ldap_filter',
        u'onthefly_register',
        u'port',
        u'tls',
        u'type',
        u'updated_at',
    ]

Expected results:
Same as above, but with 'host' in the list too.


Additional info:
n/a

Comment 1 RHEL Program Management 2014-09-10 16:42:58 UTC
Since this issue was entered in Red Hat Bugzilla, the release flag has been
set to ? to ensure that it is properly evaluated for this release.

Comment 3 jaudet 2014-09-10 16:45:20 UTC
An automated test for this bug has been written. You can see the change request here: https://github.com/omaciel/robottelo/pull/1340

Comment 4 Dominic Cleal 2014-09-11 13:16:54 UTC
Created redmine issue http://projects.theforeman.org/issues/7409 from this bug

Comment 5 jmagen@redhat.com 2014-09-16 07:47:27 UTC
Fixed https://github.com/theforeman/foreman/pull/1764

Comment 6 Bryan Kearney 2014-09-16 20:04:53 UTC
Moving to POST since upstream bug http://projects.theforeman.org/issues/7409 has been closed
-------------
Joseph Magen
Applied in changeset commit:d6b1f7b47c63052d3579720f5aa307d65d24b3b5.

Comment 7 Og Maciel 2014-10-15 15:30:23 UTC
Verified it against nightly build of Oct. 15th, 2014

http -a admin:changeme --verify=no https://SERVER/api/v2/auth_source_ldaps/7

HTTP/1.1 200 OK
Apipie-Checksum: b663d5f49abf95e01dd458ffc496c8f4
Cache-Control: must-revalidate, private, max-age=0
Connection: close
Content-Type: application/json; charset=utf-8
Date: Wed, 15 Oct 2014 15:27:05 GMT
ETag: "545f9b4c834adf74789e1f0107cb32ec"
Foreman_api_version: 2
Foreman_version: 1.7.0-develop
Server: Apache/2.4.6 (Red Hat)
Set-Cookie: _session_id=BAh7B0kiD3Nlc3Npb25faWQGOgZFRkkiJWNhNDcyMzEwYTYxYTc2YmZjYjFiZWM0ZDkxN2M5NmNmBjsAVEkiC2xvY2FsZQY7AEZJIgdlbgY7AEY%3D--908d5d4d0380b2217273bd8141a80143ac774502; path=/; HttpOnly
Status: 200 OK
Transfer-Encoding: chunked
X-Powered-By: Phusion Passenger 4.0.18
X-Rack-Cache: miss
X-Request-Id: 004eef1b4fa216283d606e4499235807
X-Runtime: 0.403868
X-UA-Compatible: IE=Edge,chrome=1

{
    "account": null,
    "attr_firstname": null,
    "attr_lastname": null,
    "attr_login": null,
    "attr_mail": null,
    "attr_photo": null,
    "base_dn": null,
    "created_at": "2014-10-15T13:38:18Z",
    "external_usergroups": [],
    "host": "

Comment 8 Bryan Kearney 2015-08-11 13:21:55 UTC
This bug is slated to be released with Satellite 6.1.

Comment 9 errata-xmlrpc 2015-08-12 05:16:19 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2015:1592