Bug 1741187 - Can create duplicate ansible variables for one role
Summary: Can create duplicate ansible variables for one role
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Ansible - Configuration Management
Version: 6.6.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: 6.6.0
Assignee: Ondřej Pražák
QA Contact: Lukas Pramuk
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-08-14 13:17 UTC by Lukas Pramuk
Modified: 2019-10-22 19:50 UTC (History)
2 users (show)

Fixed In Version: tfm-rubygem-foreman_ansible-3.0.7.1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-10-22 19:50:36 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 27663 0 'Normal' 'Closed' 'Can create duplicate ansible variables for one role' 2019-12-09 09:21:43 UTC

Description Lukas Pramuk 2019-08-14 13:17:59 UTC
Description of problem:
I can create duplicate ansible variables of the same name for the same role.
These duplicates can be of different types

Duplicates shouldn't be allowed similarly to puppet classes

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

How reproducible:
deterministic

Steps to Reproduce:
1. Import ansible roles: 
# hammer ansible roles import --proxy-id 1

2. Create ansible variable "my_var" assigned to "theforeman.foreman_scap_client" role:
# hammer ansible variables create --variable my_var --variable-type string --ansible-role theforeman.foreman_scap_client
Ansible variable [my_var] was created.

3. Try to create variable of the same name once again:
# hammer ansible variables create --variable my_var --variable-type boolean --ansible-role theforeman.foreman_scap_client
Ansible variable [my_var] was created.


Actual results:
# hammer ansible variables list --search name=my_var
---|----------|---------------|---------|-------------------------------
ID | VARIABLE | DEFAULT VALUE | TYPE    | ROLE                          
---|----------|---------------|---------|-------------------------------
28 | my_var   |               | boolean | theforeman.foreman_scap_client
27 | my_var   |               | string  | theforeman.foreman_scap_client
---|----------|---------------|---------|-------------------------------

>>> duplicate vars for one role are allowed

Expected results:
2nd "my_var" creation fails with something like
"Validation failed: my_var for the role already exists"

Comment 4 Ondřej Pražák 2019-08-20 06:46:20 UTC
Created redmine issue https://projects.theforeman.org/issues/27663 from this bug

Comment 5 Bryan Kearney 2019-08-20 08:00:24 UTC
Upstream bug assigned to oprazak

Comment 6 Bryan Kearney 2019-08-20 08:00:26 UTC
Upstream bug assigned to oprazak

Comment 7 Lukas Pramuk 2019-09-27 12:21:27 UTC
VERIFIED.

@Satellite 6.6.0 Snap21
tfm-rubygem-foreman_ansible-3.0.7.1-1.el7sat.noarch

by the reproducer described in comment#0:

# hammer ansible roles import --proxy-id 1
Result:   
  The following ansible roles were changed
Imported: 
 1) RedHatInsights.insights-client
 2) theforeman.foreman_scap_client

# hammer ansible variables create --variable my_var --variable-type string --ansible-role theforeman.foreman_scap_client
Ansible variable [my_var] was created.

# hammer ansible variables create --variable my_var --variable-type boolean --ansible-role theforeman.foreman_scap_client
Could not create the ansible variable:
  Key has already been taken

>>> duplicate ansible vars for a role are no longer allowed

Comment 8 Bryan Kearney 2019-10-22 19:50:36 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-2019:3172


Note You need to log in before you can comment on or make changes to this bug.