Bug 1785654

Summary: [UI] Importing job templates from throws NonUniqueInputsError
Product: Red Hat Satellite Reporter: Jitendra Yejare <jyejare>
Component: Templates PluginAssignee: Ondřej Pražák <oprazak>
Status: CLOSED ERRATA QA Contact: Jitendra Yejare <jyejare>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.7.0CC: egolov, mhulan, oprazak, zhunting
Target Milestone: 6.7.0Keywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: tfm-rubygem-foreman_remote_execution-2.0.8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-04-14 13:28:12 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:    
Bug Blocks: 1778146    
Attachments:
Description Flags
cycle in foreign input sets metadata none

Description Jitendra Yejare 2019-12-20 15:07:49 UTC
Description of problem:
Getting this error when importing job templates from local dir - "This template is locked. Please clone it to a new template to customize.ERF45-3514 [JobTemplate::NonUniqueInputsError]: Duplicated inputs detected: ["pre_script", "package", "post_script"]".

Version-Release number of selected component (if applicable):
Satellite 6.7 snap 6

How reproducible:
Always

Steps to Reproduce:
1. Attempt to import the job templates from local/git repo.

Actual results:
Job Template import throws an error "This template is locked. Please clone it to a new template to customize.ERF45-3514 [JobTemplate::NonUniqueInputsError]: Duplicated inputs detected: ["pre_script", "package", "post_script"]".
"

Expected results:
Successful import of job template or the appropriate human-readable error.

Additional info:

Comment 3 Ondřej Pražák 2020-01-03 12:46:57 UTC
Community templates sync without problems, I tried to add template input with a duplicate name to a job template, but I did not get error as described. Do we have a template (or a whole template repo) that causes this?

Comment 5 Ondřej Pražák 2020-01-06 14:37:55 UTC
Created redmine issue https://projects.theforeman.org/issues/28647 from this bug

Comment 6 Bryan Kearney 2020-01-07 15:02:00 UTC
Upstream bug assigned to oprazak

Comment 7 Bryan Kearney 2020-01-07 15:02:10 UTC
Upstream bug assigned to oprazak

Comment 8 Bryan Kearney 2020-01-29 09:01:36 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue https://projects.theforeman.org/issues/28647 has been resolved.

Comment 9 Ondřej Pražák 2020-01-31 08:11:52 UTC
Created attachment 1656674 [details]
cycle in foreign input sets metadata

The issue is caused by invalid metadata - when template uses itself as a source for foreign input sets, an attempt is made to create duplicate template inputs. While it is correct that template is not imported, the error message does not point to the cause of the problem. I added a validation that checks for this kind of cyclic dependencies.

Comment 10 Jitendra Yejare 2020-02-27 09:01:40 UTC
Verified!

@ Satellite 6.7 snap 13


Steps:
----------------
1.  Attempt to import the job templates from local/git repo that has invalid metadata as per comment 9.


Observation:
-----------------

The template is not being imported and Satellite is showing the correct reason for it as below:

ERF45-3514 [JobTemplate::NonUniqueInputsError]: Duplicated inputs detected: ["errata"]

Comment 13 errata-xmlrpc 2020-04-14 13:28:12 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/RHSA-2020:1454