Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1158620

Summary: /katello/api/v2/systems does not return an organization ID
Product: Red Hat Satellite Reporter: jaudet
Component: APIAssignee: Bryan Kearney <bkearney>
Status: CLOSED ERRATA QA Contact: jaudet
Severity: medium Docs Contact:
Priority: unspecified    
Version: NightlyCC: bbuckingham, cwelton
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
URL: http://projects.theforeman.org/issues/8235
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-08-12 05:18:32 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-10-29 18:01:19 UTC
Description of problem:
When a client issues a successful HTTP POST request to /katello/api/v2/systems, a hash of information about the just-created system is returned. This hash does not contain any information about the system's organization. Similarly, a client can fetch a hash of information about a system by issuing an HTTP GET to /katello/api/v2/systems/:id, but this hash does not include any organization information. This is odd because an organization ID must be provided when creating a system.

Here's an example of some python code that creates a system, then tries to read that system's organization:

    >>> # Create a system, get a response and decode the response JSON.
    >>> attrs = post(
    ...     'https://example.com/katello/api/v2/systems',
    ...     {
    ...         'name': 'Flamboozle',
    ...         'content_view_id': 1,
    ...         'environment_id': 2,
    ...         'organization_id': 3,
    ...     },
    ...     …
    ... ).json()
    ...
    >>> # Check for the information we submitted.
    >>> attrs['name'] == 'Flamboozle'
    True
    >>> attrs['content_view_id'] == 1
    True
    >>> attrs['environment']['id'] == 2  # See BZ 1151240
    True
    >>> 'organization' in attrs  # uh oh!
    False
    >>> 'organization_id' in attrs  # uh oh!
    False
    >>> # read the system and decode the JSON response
    >>> attrs = get(
    ...     '…/katello/api/v2/systems/{0}'.format(attrs['id']),
    ...     …
    ... ).json()
    ...
    >>> 'organization' in attrs  # uh oh!
    False
    >>> 'organization_id' in attrs  # uh oh!
    False


Version-Release number of selected component (if applicable):
Tested against a two nightly installs of Satellite, one on RHEL 6.5 and the other on RHEL 7. The following software is installed on the RHEL 6.5 machine:

* apr-util-ldap-1.3.9-3.el6_0.1.x86_64
* candlepin-0.9.32-1.el6.noarch
* candlepin-common-1.0.8-1.el6.noarch
* candlepin-selinux-0.9.32-1.el6.noarch
* candlepin-tomcat6-0.9.32-1.el6.noarch
* elasticsearch-0.90.10-7.el6.noarch
* foreman-1.8.0-0.develop.201410291338git203d2bb.el6.noarch
* foreman-compute-1.8.0-0.develop.201410291338git203d2bb.el6.noarch
* foreman-gce-1.8.0-0.develop.201410291338git203d2bb.el6.noarch
* foreman-libvirt-1.8.0-0.develop.201410291338git203d2bb.el6.noarch
* foreman-ovirt-1.8.0-0.develop.201410291338git203d2bb.el6.noarch
* foreman-postgresql-1.8.0-0.develop.201410291338git203d2bb.el6.noarch
* foreman-proxy-1.8.0-0.develop.201410291129git3172820.el6.noarch
* foreman-release-1.8.0-0.develop.201410291338git203d2bb.el6.noarch
* foreman-selinux-1.8.0-0.develop.201410280941git10de1c5.el6.noarch
* foreman-vmware-1.8.0-0.develop.201410291338git203d2bb.el6.noarch
* katello-2.1.0-1.201410281930gitecedc1a.el6.noarch
* katello-certs-tools-2.0.1-1.el6.noarch
* katello-default-ca-1.0-1.noarch
* katello-installer-2.1.0-1.201410271412git4da9a62.el6.noarch
* katello-repos-2.1.1-1.el6.noarch
* katello-server-ca-1.0-1.noarch
* openldap-2.4.23-32.el6_4.1.x86_64
* pulp-docker-plugins-0.2.1-0.2.beta.el6.noarch
* pulp-katello-0.3-3.el6.noarch
* pulp-nodes-common-2.5.0-0.7.beta.el6.noarch
* pulp-nodes-parent-2.5.0-0.7.beta.el6.noarch
* pulp-puppet-plugins-2.5.0-0.7.beta.el6.noarch
* pulp-puppet-tools-2.5.0-0.7.beta.el6.noarch
* pulp-rpm-plugins-2.5.0-0.7.beta.el6.noarch
* pulp-selinux-2.5.0-0.7.beta.el6.noarch
* pulp-server-2.5.0-0.7.beta.el6.noarch
* python-ldap-2.3.10-1.el6.x86_64
* ruby193-rubygem-ldap_fluff-0.3.2-1.el6.noarch
* ruby193-rubygem-net-ldap-0.3.1-2.el6.noarch
* ruby193-rubygem-runcible-1.2.0-1.el6.noarch

The RHEL 7 machine has this software installed:

* candlepin-0.9.32-1.el7.noarch
* candlepin-common-1.0.8-1.el7.noarch
* candlepin-selinux-0.9.32-1.el7.noarch
* candlepin-tomcat-0.9.32-1.el7.noarch
* elasticsearch-0.90.10-7.el7.noarch
* foreman-1.8.0-0.develop.201410291338git203d2bb.el7.noarch
* foreman-compute-1.8.0-0.develop.201410291338git203d2bb.el7.noarch
* foreman-gce-1.8.0-0.develop.201410291338git203d2bb.el7.noarch
* foreman-libvirt-1.8.0-0.develop.201410291338git203d2bb.el7.noarch
* foreman-ovirt-1.8.0-0.develop.201410291338git203d2bb.el7.noarch
* foreman-postgresql-1.8.0-0.develop.201410291338git203d2bb.el7.noarch
* foreman-proxy-1.8.0-0.develop.201410291129git3172820.el7.noarch
* foreman-release-1.8.0-0.develop.201410291338git203d2bb.el7.noarch
* foreman-selinux-1.8.0-0.develop.201410280941git10de1c5.el7.noarch
* foreman-vmware-1.8.0-0.develop.201410291338git203d2bb.el7.noarch
* katello-2.1.0-1.201410281930gitecedc1a.el7.noarch
* katello-certs-tools-2.0.1-1.el7.noarch
* katello-default-ca-1.0-1.noarch
* katello-installer-2.1.0-1.201410271412git4da9a62.el7.noarch
* katello-repos-2.1.1-1.el7.noarch
* katello-server-ca-1.0-1.noarch
* openldap-2.4.39-3.el7.x86_64
* pulp-docker-plugins-0.2.1-0.2.beta.el7.noarch
* pulp-katello-0.3-3.el7.noarch
* pulp-nodes-common-2.5.0-0.7.beta.el7.noarch
* pulp-nodes-parent-2.5.0-0.7.beta.el7.noarch
* pulp-puppet-plugins-2.5.0-0.7.beta.el7.noarch
* pulp-puppet-tools-2.5.0-0.7.beta.el7.noarch
* pulp-rpm-plugins-2.5.0-0.7.beta.el7.noarch
* pulp-selinux-2.5.0-0.7.beta.el7.noarch
* pulp-server-2.5.0-0.7.beta.el7.noarch
* python-ldap-2.4.6-6.el7.x86_64
* ruby193-rubygem-ldap_fluff-0.3.2-1.el7.noarch
* ruby193-rubygem-net-ldap-0.3.1-2.el7.noarch
* ruby193-rubygem-runcible-1.2.0-1.el7.noarch

How reproducible:
100%

Steps to Reproduce:
See "Description of problem" section at top of post.

Actual results:
No information about the system's organization.

Expected results:
An attribute named "organization_id".

Additional info:
n/a

Comment 1 RHEL Program Management 2014-10-29 18:03:02 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 Bryan Kearney 2014-10-31 16:38:58 UTC
Created redmine issue http://projects.theforeman.org/issues/8235 from this bug

Comment 4 Bryan Kearney 2014-11-04 19:05:12 UTC
Moving to POST since upstream bug http://projects.theforeman.org/issues/8235 has been closed
-------------
Bryan Kearney
Applied in changeset commit:katello|4cb268d577e0ef445c1f5e195a9561d97aba6d2b.

Comment 5 jaudet 2014-11-06 21:36:39 UTC
This bug has been fixed in our most recent builds of Satellite. See: https://github.com/SatelliteQE/robottelo/pull/1651

Comment 8 jaudet 2015-03-04 15:38:13 UTC
Tested against Satellite-6.1.0-RHEL-6-20150303.0 and Satellite-6.1.0-RHEL-7-20150303.0.

Comment 9 Bryan Kearney 2015-08-11 13:18:34 UTC
This bug is slated to be released with Satellite 6.1.

Comment 10 errata-xmlrpc 2015-08-12 05:18:32 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