Bug 1883503
| Summary: | Unable to set "override-value-order" for ansible variable via hammer CLI in Red Hat Satellite 6 | ||
|---|---|---|---|
| Product: | Red Hat Satellite | Reporter: | Sayan Das <saydas> |
| Component: | Ansible - Configuration Management | Assignee: | satellite6-bugs <satellite6-bugs> |
| Status: | CLOSED ERRATA | QA Contact: | Danny Synk <dsynk> |
| Severity: | medium | Docs Contact: | |
| Priority: | medium | ||
| Version: | 6.7.0 | CC: | ahumbe, apatel, kgaikwad, oezr, ofedoren, osousa, rabajaj, zhunting |
| Target Milestone: | 6.10.0 | Keywords: | Triaged |
| Target Release: | Unused | ||
| Hardware: | All | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | tfm-rubygem-hammer_cli_foreman_ansible-0.3.3 | Doc Type: | If docs needed, set a value |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2021-11-16 14:09:27 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: | |||
Created redmine issue https://projects.theforeman.org/issues/30976 from this bug Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/30976 has been resolved. Verified on Satellite 6.10, snap 20 (tfm-rubygem-hammer_cli_foreman_ansible-0.3.4-1.el7sat.noarch).
Steps to Test:
1. Import an Ansible role to Satellite 6.10.
2. Create a new Ansible variable assigned to the role imported in step 1.
3. Check the current override value order for the new Ansible variable:
~~~
# hammer ansible variables info --name "my_role"
Id: 24
Variable: my_role
Default Value: Admin
Type: string
Role: theforeman.foreman_scap_client
Description:
Hidden Value?: no
Validator:
Type:
Rule:
Override values:
Override: yes
Merge overrides: no
Merge default value: no
Avoid duplicates: no
Order:
fqdn
hostgroup
os
domain
Values:
Created at: 2021/09/28 15:03:29
Updated at: 2021/09/28 15:04:28
~~~
4. Modify the override value order for the variable using hammer:
# hammer ansible variables update --ansible-role theforeman.foreman_scap_client --variable my_role --override-value-order "hostgroup, fqdn, os, domain" --variable-type string --default-value 'Admin' --override true --id 24
5. Check the override value order for the variable again:
~~~
# hammer ansible variables info --name "my_role"
Id: 24
Variable: my_role
Default Value: Admin
Type: string
Role: theforeman.foreman_scap_client
Description:
Hidden Value?: no
Validator:
Type:
Rule:
Override values:
Override: yes
Merge overrides: no
Merge default value: no
Avoid duplicates: no
Order:
hostgroup
fqdn
os
domain
Values:
Created at: 2021/09/28 15:03:29
Updated at: 2021/09/28 15:10:25
~~~
Note:
- It is necessary to use comma-separated values (e.g. `hostgroup, fqdn, os, domain` or `hostgroup,fqdn,os,domain`) as the arguments for the `--override-value-order` parameter when modifying the order. When using spaces or newline characters, the arguments are concatenated into a single string as reported in the description of this bug.
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 (Moderate: Satellite 6.10 Release), 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-2021:4702 |
Description of problem: The hammer command to set "override-value-order" sets the order of multiple attributes in a string format rather than setting them in the ORDER specified for any ansible variables. Version-Release number of selected component (if applicable): Red Hat Satellite 6.7 How reproducible: Always. Steps to Reproduce: 1. Import an ansible role on satellite server with custom variable my_role. 2. Check the information about that variable and note down the order and ID. # hammer ansible variables info --name "my_role" 3. Try to set the order in which values are resolved for that variable. # hammer ansible variables update --ansible-role motd --variable my_role --override-value-order "hostgroup fqdn os domain" --variable-type string --default-value 'Admin' --override true --id XX 4. Repeat step 2. Actual results: At step 2, ~~ # hammer ansible variables info --name "my_role" Id: 91 Variable: my_role Default Value: Admin Type: string Role: motd Description: Hidden Value?: yes Validator: Type: Rule: Override values: Override: no Merge overrides: no Merge default value: no Avoid duplicates: no Order: fqdn hostgroup os domain Values: Created at: 2020/09/29 11:57:56 Updated at: 2020/09/29 11:57:56 ~~ At Step 4 i.e. after update, ~~ # hammer ansible variables info --name "my_role" Id: 91 Variable: my_role Default Value: Admin Type: string Role: motd Description: Hidden Value?: yes Validator: Type: Rule: Override values: Override: yes Merge overrides: no Merge default value: no Avoid duplicates: no Order: hostgroupfqdnosdomain Values: Created at: 2020/09/29 11:57:56 Updated at: 2020/09/29 12:15:30 ~~ Expected results: It should be able to set the ORDER properly rather than accepting the values passed as a simple string. Additional info: 1. Even if we try with CSV\ARRAY format to pass the value for "--override-value-order" , that will accept the value as it is and print it. Tried following. * hostgroup\nfqdn\nos\ndomain * hostgroup\\nfqdn\\nos\\ndomain * hostgroup,fqdn,os,domain * hostgroup, fqdn, os, domain 2. For puppet variables the issue is not present. As per code for smart_variables, I can see that it processes the value correctly. ~~ def request_params params = super override_order = params['smart_variable']['override_value_order'] params['smart_variable']['override_value_order'] = override_order.join("\n") if override_order.is_a?(Array) params end end ~~ --> But i couldn't find any similar code for the ansible_variables