Bug 1777298

Summary: When importing multiple ansible role variables in satellite that have the same variable name, they are considered globally unique and not local to the rule
Product: Red Hat Satellite Reporter: Francisco Peralta <fperalta>
Component: Ansible - Configuration ManagementAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED DUPLICATE QA Contact: Lukas Pramuk <lpramuk>
Severity: high Docs Contact:
Priority: urgent    
Version: 6.6.0CC: bkearney, dmatoule, mhulan, oezr
Target Milestone: 6.6.1Keywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-03-12 22:45:55 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Francisco Peralta 2019-11-27 10:54:59 UTC
This bug was initially created as a copy of Bug #1777293

I am copying this bug because: 

We are not sure if it will be considered a bug or an enhancement but we think the variables of imported rules should be considered local to the rule and not as currently imported as a global flat unique list of variables in satellite (with the risk to have conflicting names of variables when you have many roles, coming from different sources and community like galaxy).

Description of problem:

If you try to import some ansible roles in satellite 6.6 that contain the same variable name the GUI will not warn nor give an error but silently import the variables and the last imported variable with the same name wins.


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

Satellite 6.6.0

How reproducible:

1. Create two roles that have a default variable with the same name.
2. Import them: only the last variable will be visible/used in the GUI.

Actual results:

Only the last imported variable with the same name will be present/used.

Expected results:

We would expect that the two or more variables would be considered locally to the related role (so not overwriting each other) or at least have a warning message for the user to know that he just overwrote a variable with another in two roles (he could eventually rename them and reimport them again)

Additional info:

If roles are developed by different teams or as often is the case imported from galaxy or the comunity you cannot be sure or enforce that the variable name will be unique for *all* roles, thus you should foresee this and avoid them to be global, but local to the rule or at least give a warning to take countermeasures by using best practices in variable naming (prefixing with role name etc).

Comment 4 Marek Hulan 2019-12-09 09:23:29 UTC
This is definitely a bug. The patch from BZ 1741187 may have caused it, though looking at the code, it should actually work exactly as expected. Variable needs to be unique but scoped by ansible role it's attached to.

Comment 7 Dominik Matoulek 2020-03-02 12:34:33 UTC
Created redmine issue https://projects.theforeman.org/issues/29236 from this bug