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 1234973

Summary: PUT /api/v2/config_templates/:id returns an incomplete set of attributes
Product: Red Hat Satellite Reporter: jaudet
Component: APIAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED ERRATA QA Contact: jcallaha
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.1.0CC: bkearney, jcallaha, orabin, rplevka, tbrisker
Target Milestone: Unspecified   
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:50 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:46:30 UTC
Created attachment 1042404 [details]
Output of foreman-debug from a Satellite 6.1.0 system running RHEL 7.1.

Description of problem:
A config template has at least the following attributes:

* audit_comment
* id
* locked
* name
* operatingsystem
* organization
* snippet
* template
* template_combinations
* template_kind

When one updates a config template, the following attributes are returned:

* created_at
* default
* id
* locked
* name
* snippet
* template
* template_kind_id
* updated_at
* vendor

The following attributes are missing from the response:

* audit_comment
* operatingsystem
* organization
* template_combinations

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/config_templates/:id
2. Capture the response. Examine the JSON payload and discover that several attributes are 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 16:02:37 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 alon 2015-07-14 12:19:44 UTC
Fixed in http://projects.theforeman.org/issues/10356

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

Comment 5 Roman Plevka 2016-05-18 12:04:02 UTC
FAILED QA:
everything is being displayed here just fine, but audit_comment stays 'null'.
This makes sense as the audit_comment links to a specific audit, not to the template.
So the payload should either contain whole history with references to the individual audit ids with their comments,
or audit_comment should show the comment of the recent audit.

# curl -u admin:changeme -H "Content-type: application/json" -X PUT -d '{"audit_comment": "foo", "template": "# my updated template"}' https://sat6.com/api/v2/config_templates/87
{"template":"# my updated template","locked":false,"snippet":false,"audit_comment":null,"created_at":"2016-05-18 11:49:57 UTC","updated_at":"2016-05-18 11:52:02 UTC","id":87,"name":"foo","template_kind_id":5,"template_kind_name":"provision","template_combinations":[],"operatingsystems":[],"os_default_templates":[],"locations":[],"organizations":[]}

Comment 6 Tomer Brisker 2016-05-24 13:52:20 UTC
The issue in comment #5 is a separate issue that is also present in the "get" version of the template json. 
audit_comment is only used for setting the audit comment, not displaying it. This behavior is inline with the UI - see BZ 1121577 for more info. 
If you believe this is a bug, please open a new issue. This issue has to do with inconsistency between the result of "GET" and "PUT" to the api - which is now consistent. 
Moving back to ON_QA.

Comment 7 jcallaha 2016-05-25 17:14:27 UTC
Verified in Satellite 6.2 Beta Snap 12.

{
  "template": "<%#\nkind: snippet\nname: chief_client\ndescription: this is a single entry point for chef-client bootstrapping, it selects\n    a bootstrapping strategy based on host parameter named \"chef_bootstrap_template\"\n    note that it can be set per hostgroup, os, domain etc.\n    if there's no strategy set, omnibus is used by default\n%>",
  "locked": false,
  "snippet": true,
  "audit_comment": null,
  "created_at": "2016-05-25 15:35:15 UTC",
  "updated_at": "2016-05-25 15:35:15 UTC",
  "id": 111,
  "name": "chief_client",
  "template_kind_id": null,
  "template_kind_name": null,
  "template_combinations": [],
  "operatingsystems": [],
  "os_default_templates": [],
  "locations": [
    {
      "id": 2,
      "name": "Default Location",
      "title": "Default Location",
      "description": null
    }
  ],
  "organizations": [
    {
      "id": 1,
      "name": "Default Organization",
      "title": "Default Organization",
      "description": null
    }
  ]
}

Comment 9 errata-xmlrpc 2016-07-27 08:52:50 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