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 1416040

Summary: GET /api/v2/provisioning_templates/build_pxe_default returns error "Resource provisioning_template not found by id 'build_pxe_default'
Product: Red Hat Satellite Reporter: Stanislav Tkachenko <stkachen>
Component: Provisioning TemplatesAssignee: Swapnil Abnave <sabnave>
Status: CLOSED NOTABUG QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 6.3.0CC: bbuckingham, jcallaha, mhulan, sabnave
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-02-14 13:09:42 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 Stanislav Tkachenko 2017-01-24 12:52:31 UTC
Description of problem:


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


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 1 Stanislav Tkachenko 2017-01-24 13:02:14 UTC
(In reply to Stanislav Tkachenko from comment #0)

Please ignore initial comment, 'Enter' accidentally was pressed.

Description of problem:
GET /api/v2/provisioning_templates/build_pxe_default returns:
> "error": {"message":"Resource provisioning_template not found by id 'build_pxe_default'"}

However, deprecated GET /api/v2/config_templates/build_pxe_default works as expected:
> {"message":"PXE Default file has been deployed to all Capsules"}

Version-Release number of selected component (if applicable):
Satellite 6.3.0 Snap 8 / Foreman 1.13.2.2-1
Satellite 6.2.7 Snap 3.0 / Foreman 1.11.0.65-1

How reproducible:
Always


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 2 Stanislav Tkachenko 2017-01-24 13:35:50 UTC
Tail of production.log:
2017-01-24 08:33:47 d58fe0fa [app] [I] Started GET "/api/v2/config_templates/build_pxe_default" for 10.36.7.37 at 2017-01-24 08:33:47 -0500
2017-01-24 08:33:47 d58fe0fa [app] [I] Processing by Api::V2::ConfigTemplatesController#build_pxe_default as JSON
2017-01-24 08:33:47 d58fe0fa [app] [I]   Parameters: {"apiv"=>"v2"}
2017-01-24 08:33:47 d58fe0fa [templates] [I] Rendering template 'pxegrub2_chainload'
2017-01-24 08:33:47 d58fe0fa [templates] [I] Rendering template 'pxegrub2_discovery'
2017-01-24 08:33:47 d58fe0fa [templates] [I] Rendering template 'pxelinux_chainload'
2017-01-24 08:33:47 d58fe0fa [templates] [I] Rendering template 'pxelinux_discovery'
2017-01-24 08:33:47 d58fe0fa [templates] [I] Rendering template 'pxegrub_chainload'
2017-01-24 08:33:47 d58fe0fa [templates] [I] Rendering template 'pxegrub_discovery'
2017-01-24 08:33:47 d58fe0fa [app] [I] Completed 200 OK in 224ms (Views: 0.4ms | ActiveRecord: 11.3ms)
2017-01-24 08:34:05 d58fe0fa [app] [I] Started GET "/api/v2/provisioning_templates/build_pxe_default" for 10.36.7.37 at 2017-01-24 08:34:05 -0500
2017-01-24 08:34:05 d58fe0fa [app] [I] Processing by Api::V2::ProvisioningTemplatesController#show as JSON
2017-01-24 08:34:05 d58fe0fa [app] [I]   Parameters: {"apiv"=>"v2", "id"=>"build_pxe_default"}
2017-01-24 08:34:05 d58fe0fa [app] [I] Couldn't find ProvisioningTemplate with 'id'=build_pxe_default [WHERE "templates"."type" IN ('ProvisioningTemplate')] (ActiveRecord::RecordNotFound)
2017-01-24 08:34:05 d58fe0fa [app] [I]   Rendered api/v2/errors/not_found.json.rabl within api/v2/layouts/error_layout (1.3ms)
2017-01-24 08:34:05 d58fe0fa [app] [I] Completed 404 Not Found in 19ms (Views: 3.0ms | ActiveRecord: 3.8ms)

Comment 4 Swapnil Abnave 2017-02-14 09:36:37 UTC
> Description of problem:
> GET /api/v2/provisioning_templates/build_pxe_default returns:
> > "error": {"message":"Resource provisioning_template not found by id 'build_pxe_default'"}
> 

The API request should be POST instead of GET.

POST /api/v2/provisioning_templates/build_pxe_default

--

GET call however works for "api/v2/config_templates/build_pxe_default" but it's depricated.

Please have a look at https://bugzilla.redhat.com/1127576

--

Two ways this bug can be marked closed:
1. Obsolete GET api/v2/config_templates/build_pxe_default
2. Add GET api/v2/provisioning_templates/build_pxe_default

Later doesn't make sense to me, since it would unnecessarily leverage the use of GET instead of POST on an update action.

Comment 5 Satellite Program 2017-02-14 11:01:14 UTC
Upstream bug assigned to sabnave

Comment 6 Satellite Program 2017-02-14 11:01:17 UTC
Upstream bug assigned to sabnave

Comment 7 Swapnil Abnave 2017-02-14 13:09:42 UTC
Hi Stanislav,

As discussed here https://github.com/theforeman/foreman/pull/4278, the GET API can't be made obsolete in this version.

You need to restrict the use of un-documented API(GET api/v2/config_templates/build_pxe_default) and use documented API(POST api/v2/config_templates/build_pxe_default).