Bug 1785547

Summary: [UI] Importing Templates - Associate "new" is working as "always"
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: medium Docs Contact:
Priority: unspecified    
Version: 6.7.0CC: asharvit, egolov, mhulan, oprazak
Target Milestone: 6.7.0Keywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: tfm-rubygem-foreman_templates-7.0.7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-04-14 13:38:52 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    

Description Jitendra Yejare 2019-12-20 08:08:31 UTC
Description of problem:
While importing templates from UI, the templates are being assigned to the taxonomies they are being imported + the taxonomies that are mentioned in templates metadata. Here the '+' part is functioning as an associate "always".

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

How reproducible:
always from UI

Steps to Reproduce:
1. Keep(in local dir/git) the templates to be imported in a satellite that has multiple orgs and locs in their metadata. Make sure all the taxonomies in metadata are available in the satellite.
2. Attempt to import those templates in org and loc by switching the taxonomies context in satellite. 
3. Observe the taxonomies associated with imported templates.

Actual results:
While importing templates from UI, the templates are being assigned to the taxonomies they are being imported + the taxonomies that are mentioned in templates metadata. Here the '+' part is functioning as an associate "always".

Expected results:
Only the taxonomies from where the templates are imported should be assigned to imported templates.

Additional info:

Comment 3 Ondřej Pražák 2020-01-03 09:53:14 UTC
Created redmine issue https://projects.theforeman.org/issues/28626 from this bug

Comment 4 Ondřej Pražák 2020-01-03 09:54:32 UTC
There is a problem that form ignores current context and does not send the current location/organization on form submit, cloning upstream.

Comment 5 Bryan Kearney 2020-01-29 11:01:16 UTC
Upstream bug assigned to oprazak

Comment 6 Bryan Kearney 2020-01-29 11:01:19 UTC
Upstream bug assigned to oprazak

Comment 8 Bryan Kearney 2020-03-02 17:01:22 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue https://projects.theforeman.org/issues/28626 has been resolved.

Comment 9 Jitendra Yejare 2020-03-09 15:31:00 UTC
FailedQA !

@Satellite 6.7 snap 15
@tfm-rubygem-foreman_templates-7.0.7-1.el7sat.noarch


Steps:
---------
As per Description of this bug 


Observation:
--------------
1. The taxonomies are not being updated in Template from where the templates are being imported. {FAIL}
2. The template is being imported in taxonomies mentioned in template.erb {FAIL}

Comment 10 Ondřej Pražák 2020-03-10 10:53:47 UTC
Comment 9 makes me think I misunderstood the reported issue.

1. The taxonomies are not being updated in Template from where the templates are being imported. {FAIL} - Assuming 'taxonomies from where the templates are imported' refers to current organization/location, does this mean import is expected to modify metadata in template? If so, it should be a new RFE as we currently do not modify the content of templates on import.

2. The template is being imported in taxonomies mentioned in template.erb {FAIL} - True if 'associate' setting is set to 'never'. The current behaviour is as follows:

A. importing new templates with 'associate: never' imports the templates into current organization/location regardless of taxonomies in template metadata
B. importing new templates with 'associate: new' or 'associate: always' and taxonomies in template metadata imports the templates only into organizations/locations specified in metadata. Templates are imported into current organization/location only if their names are specified in metadata.

This seems to be the originally expected behaviour as the issue reported templates being always imported into the taxonomies from metadata. Is this acceptable? If not, could you specify the expected behaviour that would resolve this issue?

Comment 11 Avi Sharvit 2020-03-11 09:20:26 UTC
Based on the last comment, can we move it to 6.8 as more information and development is needed?

Comment 12 Jitendra Yejare 2020-03-12 15:05:57 UTC
(In reply to Ondřej Pražák from comment #10)
> Comment 9 makes me think I misunderstood the reported issue.
> 
> 1. The taxonomies are not being updated in Template from where the templates
> are being imported. {FAIL} - Assuming 'taxonomies from where the templates
> are imported' refers to current organization/location, does this mean import
> is expected to modify metadata in template? If so, it should be a new RFE as
> we currently do not modify the content of templates on import.

No, it's not about updating the template metadata. But I mean the taxonomies assigned to the template after importing doesnt have current taxonomies. Lets say I import x template from org1 and loc2 then, the imported template is not imported in org1 and loc2. Its associated with the taxonomies which are only mentioned in the template(local_path/x.erb) metadata. Is this expected behavior? 

For me the expected behavior is, only associating the current taxonomies to imported template and disassociate the taxonomies mentioned in template metadata.

> 
> 2. The template is being imported in taxonomies mentioned in template.erb
> {FAIL} - True if 'associate' setting is set to 'never'. The current
> behaviour is as follows:

Here in my case and in this bug, the associate is set to 'new' and this bug is all about new.
> 
> A. importing new templates with 'associate: never' imports the templates
> into current organization/location regardless of taxonomies in template
> metadata
But does imported template should be imported in taxonomies mentioned in template metadata in this case of 'associate : never'. ?

> B. importing new templates with 'associate: new' or 'associate: always' and
> taxonomies in template metadata imports the templates only into
> organizations/locations specified in metadata. Templates are imported into
> current organization/location only if their names are specified in metadata.

So here in this bug, the 'new' template with associate 'new', is not being assigned to the current location. It is only being assigned to taxonomies mentioned in template metadata. And thats what this bug is all about :)

> 
> This seems to be the originally expected behaviour as the issue reported
> templates being always imported into the taxonomies from metadata. Is this
> acceptable? If not, could you specify the expected behavior that would
> resolve this issue?
See my comments above, Let's have a meeting if this does not answer your questions.

Comment 13 Jitendra Yejare 2020-03-13 07:32:48 UTC
After meeting with Oprazak, 

I have concluded that now 'associate: new' is working as expected: By only importing the templates into the new taxonomies(which are not associated earlier) mentioned in template metadata(metadata can be changed to include the new taxonomies) regardless of current taxonomies.

So the observations I made in Comment 9 and 10 are the actual behavior.

Hence changing the bug state to Verified!

Comment 14 Bryan Kearney 2020-04-14 13:38:52 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