Project

General

Profile

Actions

Bug #16119

closed

Cannot update smart variable name with --new-name

Added by Ivan Necas over 7 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Foreman commands (obsolete)
Target version:
Difficulty:
Triaged:
Team Backlog:
Fixed in Releases:
Found in Releases:
In Kanboard:

Description

Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1367032
Description of problem:

Before Update:
hammer -v -u admin -p changeme smart-variable info --id="100"
Id: 100
Name: YJIQOcdDFQ1
Default Value:
Type: string
Puppet class: ntp
Description:
Hidden Value?: false
Validator:
Type:
Rule:
Override values:
Merge overrides: no
Merge default value: no
Avoid duplicates: no
Order: fqdn, hostgroup, os, domain
Values:
Created at: 2016/08/15 10:36:30
Updated at: 2016/08/15 10:42:18

Updating entity:
hammer -v -u admin -p changeme --output=csv smart-variable update --id="100" --new-name="XO4txkfDEUD" --puppet-class="ntp"
Message,Id
Smart variable [YJIQOcdDFQ1] updated,100

Nothing happened and entity has old name:
hammer -v -u admin -p changeme smart-variable info --id="100"
Id: 100
Name: YJIQOcdDFQ1
Default Value:
Type: string
Puppet class: ntp
Description:
Hidden Value?: false
Validator:
Type:
Rule:
Override values:
Merge overrides: no
Merge default value: no
Avoid duplicates: no
Order: fqdn, hostgroup, os, domain
Values:
Created at: 2016/08/15 10:36:30
Updated at: 2016/08/15 10:42:36

Always

Steps to Reproduce:
1. Create smart variable for any puppet class
2. Try to update it with new value for its name
3.

Actual results:
Entity is not updated

Expected results:
Entity updated properly

Actions #1

Updated by Dominic Cleal over 7 years ago

  • Project changed from Foreman to Hammer CLI
  • Subject changed from Cannot update smart variable name to Cannot update smart variable name with --new-name
  • Category set to Foreman commands (obsolete)

hammer smart-variable update --variable NEW_NAME works, suggesting this is a Hammer bug - passing --new-name generates a name API parameter, which isn't documented.

2016-08-16 03:37:13 [Worker 1] [app] [I] Started PUT "/api/smart_variables/51" for 127.0.0.1 at 2016-08-16 03:37:13 -0400
2016-08-16 03:37:13 [Worker 1] [app] [I] Processing by Api::V2::SmartVariablesController#update as JSON
2016-08-16 03:37:13 [Worker 1] [app] [I]   Parameters: {"smart_variable"=>{"name"=>"test"}, "name"=>"test", "apiv"=>"v2", "id"=>"51"}

vs --variable:

2016-08-16 03:37:39 [Worker 1] [app] [I] Started PUT "/api/smart_variables/51" for 127.0.0.1 at 2016-08-16 03:37:39 -0400
2016-08-16 03:37:39 [Worker 1] [app] [I] Processing by Api::V2::SmartVariablesController#update as JSON
2016-08-16 03:37:39 [Worker 1] [app] [I]   Parameters: {"smart_variable"=>{"variable"=>"test"}, "apiv"=>"v2", "id"=>"51"}

(please show server logs with API bug reports)

Actions #2

Updated by Tomáš Strachota over 7 years ago

The problem is in searchable options for smart variables, where we define --name as a searchable key. I think we should change the searchables to

s("variable", _("Variable name to search by"), :editable => true)

and update the query for looking up variables to use option_variable instead of option_name. That will make commands info, update and delete use option --variable instead of --name. Similarly update will also use --new-variable.

Actions #3

Updated by The Foreman Bot over 7 years ago

  • Status changed from New to Ready For Testing
  • Assignee set to Shimon Shtein
  • Pull request https://github.com/theforeman/hammer-cli-foreman/pull/256 added
Actions #4

Updated by Shimon Shtein over 7 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100
Actions #5

Updated by Ivan Necas over 7 years ago

  • Target version set to 1.6.1
Actions

Also available in: Atom PDF