Bug 1234964

Summary: PUT /api/v2/architectures/:id returns an incomplete set of attributes
Product: Red Hat Satellite Reporter: jaudet
Component: APIAssignee: alon <agoldboi>
Status: CLOSED ERRATA QA Contact: Roman Plevka <rplevka>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.1.0CC: agoldboi, bkearney, fsimonce, jaudet, ohadlevy, orabin, rplevka, tbrisker
Target Milestone: UnspecifiedKeywords: Reopened
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-07-27 08:52:45 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:
Bug Depends On: 1216236    
Bug Blocks:    
Attachments:
Description Flags
Output of foreman-debug from a Satellite 6.1.0 system running RHEL 7.1. none

Description jaudet 2015-06-23 15:17:57 UTC
Created attachment 1042389 [details]
Output of foreman-debug from a Satellite 6.1.0 system running RHEL 7.1.

Description of problem:
An architecture has at least the following attributes:

* id
* name
* organization{s,_ids}

When one updates an architecture, the following attributes are returned:

* created_at
* hostgroups_count
* hosts_count
* id
* name
* updated_at

The "organization" response is not mentioned in the response.

Version-Release number of selected component (if applicable):
Satellite 6.1.0. Foreman-debug is attached.

How reproducible:
100%

Steps to Reproduce:
1. Issue HTTP PUT request to https://sat.example.com/api/v2/architectures/:id
2. Capture the response. Examine the JSON payload and discover that the "organization" attribute is not mentioned.
3.

Actual results:
See "Description of problem" section.

Expected results:
See "Description of problem" section.

Additional info:

Comment 1 RHEL Program Management 2015-06-23 15:22:38 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 Ohad Levy 2015-07-05 14:00:09 UTC
Architecture is not related to org/locations, directly, hence I would not assume this is a bug?

Comment 4 jaudet 2015-07-06 15:23:14 UTC
I made a typo in the original bug write-up. It should reference operating systems, not organizations. In other words, this set of attributes is returned when one updates an architecture:

* created_at
* hostgroups_count
* hosts_count
* id
* name
* updated_at

No reference is made to operating systems, even though architectures are directly related to them.

Comment 5 orabin 2015-07-07 08:22:45 UTC

*** This bug has been marked as a duplicate of bug 1216236 ***

Comment 6 alon 2015-07-14 12:18:54 UTC
Fixed in http://projects.theforeman.org/issues/10356

Comment 7 Tomer Brisker 2016-04-12 12:46:53 UTC
This has been resolved in current 6.2 snaps, moving to ON_QA for verification.

Comment 8 Roman Plevka 2016-05-18 08:52:53 UTC
VERIFIED
on Sat 6.2.0 Beta Snap GA11

the `operatingsystems` key is now being included in the response:

# curl -u admin:changeme -H "Content-type: application/json" -X PUT -d '{"name": "my_updated_arch_1"}' https://my-sat6.com/api/v2/architectures/3
{"created_at":"2016-05-18 08:47:56 UTC","updated_at":"2016-05-18 08:49:16 UTC","name":"my_updated_arch_1","id":3,"operatingsystems":[{"id":1,"name":"RedHat_Enterprise_Linux_Atomic_Host","title":"RedHat_Enterprise_Linux_Atomic_Host 7.2"},{"id":2,"name":"RedHat","title":"RHEL Server 6.8"}],"images":[]}

Comment 10 errata-xmlrpc 2016-07-27 08:52:45 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/RHBA-2016:1500