Project

General

Profile

Actions

Bug #30976

closed

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

Added by Shira Maximov over 3 years ago. Updated almost 3 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
Difficulty:
Triaged:
Yes
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
Actions #1

Updated by Tomer Brisker over 3 years 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
Actions #2

Updated by Oleh Fedorenko over 3 years ago

  • Project changed from Foreman to Ansible
Actions #3

Updated by Ondřej Ezr almost 3 years ago

  • Triaged changed from No to Yes
Actions #4

Updated by yifat makias almost 3 years ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/hammer-cli-foreman-ansible/pull/7 added
Actions #5

Updated by The Foreman Bot almost 3 years ago

  • Fixed in Releases hammer-cli-foreman-ansible 0.3.3 added
Actions #6

Updated by yifat makias almost 3 years ago

  • Status changed from Ready For Testing to Closed
Actions

Also available in: Atom PDF