Bug 1267629 - API GET hostgroup does not return content_view_id and lifecycle_environment_id
API GET hostgroup does not return content_view_id and lifecycle_environment_id
Status: CLOSED ERRATA
Product: Red Hat Satellite 6
Classification: Red Hat
Component: API (Show other bugs)
6.1.2
Unspecified Unspecified
unspecified Severity medium (vote)
: Beta
: --
Assigned To: Brad Buckingham
Roman Plevka
http://projects.theforeman.org/issues...
FAILEDQA in Upstream
: Triaged
Depends On:
Blocks: 1122832
  Show dependency treegraph
 
Reported: 2015-09-30 10:22 EDT by Peter Vreman
Modified: 2016-07-27 04:56 EDT (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-07-27 04:56:40 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Foreman Issue Tracker 12353 None None None 2016-04-22 12:08 EDT
Red Hat Product Errata RHBA-2016:1500 normal SHIPPED_LIVE Red Hat Satellite 6.2 Base Libraries 2016-07-27 08:24:38 EDT

  None (edit)
Description Peter Vreman 2015-09-30 10:22:25 EDT
Description of problem:
You can set the content_view_id and lifecycle_environment_id using PUT:

PUT /api/hostgroups/:id 
...
hostgroup[content_view_id]
optional , nil allowed 	
Value: Must be a number.
hostgroup[lifecycle_environment_id]
optional , nil allowed 	
Value: Must be a number. 

But the GET /api/hostgroups/:id does not return those values. For scripts this makes it impossible to verify the current values

# curl -K /opt/hoici/etc/sat6/curl-hoici.conf "-HContent-Type: application/json" "-d{\"per_page\":9999}" -XGET https://localhost/api/v2/hostgroups/24 | jq . | egrep '(content_view|lifecycle_environment)'
#

In the WebUI those fields are visible as well as in object printed foreman-rake console.


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


How reproducible:


Steps to Reproduce:
1. See curl command
2.
3.

Actual results:
fields are not returned

Expected results:
All additional Katello fields, including content_view_id,content_view_name,lifecycle_environment_id,lifecycle_environment_name are returned

Additional info:
Comment 2 Brad Buckingham 2015-10-29 16:42:47 EDT
Created redmine issue http://projects.theforeman.org/issues/12353 from this bug
Comment 3 Brad Buckingham 2015-10-29 16:50:54 EDT
Upstream Katello PR: https://github.com/Katello/katello/pull/5559
Comment 4 Bryan Kearney 2015-12-16 14:02:46 EST
Moving to POST since upstream bug http://projects.theforeman.org/issues/12353 has been closed
-------------
Brad Buckingham
Applied in changeset commit:katello|06ae7fd5228c1187113f5b9719e0b0dce4294824.
Comment 5 Sachin Ghai 2015-12-18 04:46:01 EST
Verified with following version:

katello-2.5.0-1.nightly.el7.noarch
foreman-1.11.0-0.develop.201512091815git0e9b35e.el7.noarch

API GET still doesn't return  content_view_id and lifecycle_environment_id

---|--------|--------|------------------|-------------|------
ID | NAME   | TITLE  | OPERATING SYSTEM | ENVIRONMENT | MODEL
---|--------|--------|------------------|-------------|------
1  | fgroup | fgroup | RHEL Server 7.2  | production  |      
2  | group1 | group1 | RHEL Server 7.2  |             |      
---|--------|--------|------------------|-------------|------


[root@cloud ~]# curl -k -u admin:changeme -H "Accept: application/json" -X GET https://localhost/api/v2/hostgroup/2{"subnet_id":2,"subnet_name":"primary_libvirt","operatingsystem_id":1,"operatingsystem_name":"RHEL Server 7.2","domain_id":1,"domain_name":"idmqe.lab.eng.bos.redhat.com","environment_id":null,"environment_name":null,"compute_profile_id":4,"compute_profile_name":"testp","ancestry":null,"puppet_proxy_id":1,"puppet_ca_proxy_id":1,"ptable_id":55,"ptable_name":"Kickstart default","medium_id":9,"medium_name":"Default_Organization/Library/RHEL7/RHEL7_x86_64","architecture_id":1,"architecture_name":"x86_64","realm_id":null,"realm_name":null,"created_at":"2015-12-17T11:25:34Z","updated_at":"2015-12-17T11:35:28Z","id":2,"name":"group1","title":"group1","parameters":[{"id":2,"name":"kt_activation_keys","value":"ak_rhel7"}],"template_combinations":[],"puppetclasses":[],"config_groups":[],"all_puppetclasses":[],"locations":[],"organizations":[{"id":1,"name":"Default Organization","title":"Default Organization","description":null}]}
Comment 7 Bryan Kearney 2015-12-18 06:02:59 EST
Moving to POST since upstream bug http://projects.theforeman.org/issues/12353 has been closed
-------------
Brad Buckingham
Applied in changeset commit:katello|06ae7fd5228c1187113f5b9719e0b0dce4294824.
Comment 8 Brad Buckingham 2016-02-29 15:01:01 EST
The API does indeed return the additional fields for content source, content view and lifecycle environment; therefore, moving this BZ back to POST.

Comment #5 raises a separate issue and that is supporting those fields from hammer cli.  I agree that we should do that; however, let's track that with a separate bug.


Regarding the API, the following is an example of the new fields:

{
    "content_source_id": 1,
    "content_source_name": "katello-centos7-devel",
    "content_view_id": 1,
    "content_view_name": "Default Organization View",
    "lifecycle_environment_id": 1,
    "lifecycle_environment_name": "Library",
    ...
}
Comment 9 Brad Buckingham 2016-02-29 15:10:07 EST
Sachin, I created bug 1313056 for the hammer CLI aspect.
Comment 11 Roman Plevka 2016-04-20 05:43:08 EDT
VERIFIED
in sat 6.2.0. snap 8.2

# curl -L -u admin:changeme sat6.com/api/hostgroups/1
{"content_source_id":1,
"content_source_name":"sat6.com",
"content_view_id":3,
"content_view_name":"rhel7_cv",
"lifecycle_environment_id":2,
"lifecycle_environment_name":"Dev",
...}
Comment 12 Peter Vreman 2016-06-29 11:19:14 EDT
Confirmed with Sat6.2.0 Beta2

[crash] root@li-lc-1578:~# curl -K /opt/hoici/etc/sat6/curl-hoici.conf "-HContent-Type: application/json" "-d{\"per_page\":9999}" -XGET https://localhost/api/v2/hostgroups/24 | jq . | egrep '(content_view|lifecycle_environment)'
  "content_view_id": 37,
  "content_view_name": "hg-crash::ILF::Gateway2",
  "lifecycle_environment_id": 2,
  "lifecycle_environment_name": "Library",
Comment 14 errata-xmlrpc 2016-07-27 04:56:40 EDT
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/RHBA-2016:1500

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