Bug 2223891

Summary: ERF42-4237 [Foreman::Exception]: Unknown input command for template Install Package - Katello Script Default, while customizing remote exucution job.
Product: Red Hat Satellite Reporter: Akshay Kapse <akapse>
Component: Remote ExecutionAssignee: kmalyjur
Status: CLOSED ERRATA QA Contact: Peter Ondrejka <pondrejk>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.14.0CC: aruzicka, juwatts, rlavi, zhunting
Target Milestone: 6.14.0Keywords: Regression, Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: rubygem-foreman_remote_execution-10.0.6 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-11-08 14:19:57 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:

Comment 1 Akshay Kapse 2023-07-19 08:08:42 UTC
Description of problem:
ERF42-4237 [Foreman::Exception]: Unknown input command for template Install Package - Katello Script Default, while customizing remote exucution job (via customized remote execution) to Enable Tracer through Satellite Web UI.


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

How reproducible:
100%

Steps to Reproduce:
1. Go to hosts page on Satellite Web Ui and click on 'Enable Traces' --> via customized remote execution job.
2. Edit the job template as:

Job category * :   Commands
Job template   :   Run Command - Script Default
Taget Hosts    :   hostname
command        :   yum install katello-host-tools-tracer


Actual results:
Could not submit the job due to pop up error:
~~~
ERF42-4237 [Foreman::Exception]: Unknown input command for template Install Package - Katello Script Default
~~~

Expected results:
This should not happen as Job template fields are updated.
I am able to submit the job using Hosts --> All Hosts --> Schedule Remote Execution path.

Additional info:
--- Attaching screenshot.

Comment 2 Adam Ruzicka 2023-07-19 10:40:50 UTC
Alternative steps to reproduce:
1) Go to /job_invocations/new?feature=run_script
2) Change job category to "packages" and job template to "Package Action - Script Default"
3) Fill in the rest of the wizard, submit

Actual results:
The wizard ignores the category and template selection sets job template id to nil and uses the original feature, but with the inputs from the template selected by the user. The request fails with "Unknown input action for template Run Command - Script Default".

2023-07-19T06:37:02 [I|app|65cf436d] Started POST "/api/job_invocations" for 192.168.122.1 at 2023-07-19 06:37:02 -0400
2023-07-19T06:37:02 [I|app|65cf436d] Processing by Api::V2::JobInvocationsController#create as JSON
2023-07-19T06:37:02 [I|app|65cf436d]   Parameters: {"location"=>{"id"=>2, "title"=>"Default Location"}, "organization"=>{"id"=>1, "title"=>"Default Organization"}, "job_invocation"=>{"job_template_id"=>nil, "targeting_type"=>"static_query", "inputs"=>{"action"=>"install", "package"=>"tmux", "pre_script"=>"", "options"=>"", "post_script"=>"", "refresh_subscription"=>""}, "ssh_user"=>nil, "ssh"=>{"effective_user"=>""}, "recurrence"=>nil, "scheduling"=>nil, "concurrency_control"=>{"time_span"=>"", "concurrency_level"=>""}, "bookmark_id"=>nil, "search_query"=>"id ^ (1)", "description_format"=>"%{action} package(s) %{package}", "execution_timeout_interval"=>"", "feature"=>"run_script", "time_to_pickup"=>""}, "apiv"=>"v2"}

Expected results:
It does the package action instead of trying to do the mix of the two.

Note:
A similar issue exists when you rerun a job and then change the category and template to a one which has different inputs.

Comment 6 Peter Ondrejka 2023-08-17 14:26:01 UTC
Verified on Satellite 6.14 snap 12

Comment 9 errata-xmlrpc 2023-11-08 14:19:57 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 (Important: Satellite 6.14 security and bug fix update), 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-2023:6818