Project

General

Profile

Bug #30976

Unable to set "override-value-order" for ansible variable via hammer CLI

Added by Shira Maximov about 2 months ago. Updated about 2 months ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Difficulty:
Triaged:
No
Bugzilla link:
Pull request:
Fixed in Releases:
Found in Releases:

Description

Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1883503

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,
~~
  1. 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,
~~
  1. 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

History

#1 Updated by Tomer Brisker about 2 months ago

  • Subject changed from Unable to set "override-value-order" for ansible variable via hammer CLI in Red Hat Satellite 6 to Unable to set "override-value-order" for ansible variable via hammer CLI

Also available in: Atom PDF