Project

General

Profile

Bug #20725

'hammer host update' removes existing host parameters

Added by Anthony Chevalet about 1 year ago. Updated about 2 months ago.

Status:
Closed
Priority:
High
Assignee:
Category:
Hosts
Target version:
-
Difficulty:
trivial
Triaged:
Bugzilla link:
Team Backlog:
Fixed in Releases:
Found in Releases:

Description

# rpm -q foreman
foreman-1.15.3-1.el7.noarch
# hammer --version
hammer (0.10.2)
 * hammer_cli_foreman (0.10.2)
 * hammer_cli_foreman_bootdisk (0.1.3)
 * hammer_cli_foreman_docker (unknown version)
 * hammer_cli_foreman_remote_execution (unknown version)
 * hammer_cli_foreman_tasks (unknown version)
 * hammer_cli_import (0.11.3)
 * hammer_cli_katello (0.10.0)
# hammer host info --name client1.local | grep param
# hammer host update --name client1.local --parameters param1=value1,param2=value2
Host updated
# hammer host info --name client1.local | grep param    param1 => value1
    param2 => value2
# hammer host update --name client1.local --parameters param3=value3
Host updated
# hammer host info --name client1.local | grep param
    param3 => value3
# hammer host update --name client1.local 
Host updated
# hammer host info --name client1.local | grep param
#

Associated revisions

Revision 1b8d8237 (diff)
Added by Rahul Bajaj about 2 months ago

Fixes #20725 - retain data while host update in hammer

History

#1 Updated by Ivan Necas about 1 year ago

  • Project changed from Foreman to Hammer CLI

The requested change would mean backward-incompatible API change, that I don't think we're going to make.

Doesn't hammer host set-parameter and hammer host delete-parameter address your use-case?

#2 Updated by Tomáš Strachota about 1 year ago

  • Category set to Hosts
  • Difficulty set to trivial

Ivan, I don't think {set,delete}-parameter would help here. The issue is hammer clears the parameters when option --parameters isn't used in the update command:

> hammer host update --id 7 --parameters param1=value1,param2=value2
Host updated

> hammer host info --id 7
...
Parameters:
    param1 => value1
    param2 => value2
All parameters:
    param1 => value1
    param2 => value2
    testname => testvalue
    diskinfo2 => test
...

> hammer host update --id 7 
Host updated

> hammer host info --id 7
...
Parameters:               

All parameters:
    testname => testvalue
    diskinfo2 => test
...

From the log:

[ INFO 2017-08-25T13:40:03 API] PUT /api/hosts/7
[DEBUG 2017-08-25T13:40:03 API] Params: {
    "host" => {
                   "compute_attributes" => {
            "volumes_attributes" => {}
        },
             "content_facet_attributes" => {},
        "subscription_facet_attributes" => {},
           "host_parameters_attributes" => [],
                "interfaces_attributes" => []
    }
}

This is a hammer issue. API works fine.

#3 Updated by Tomáš Strachota about 1 year ago

  • Bugzilla link set to 1486696

#4 Updated by Rahul Bajaj about 1 year ago

  • Assignee set to Rahul Bajaj

#5 Updated by Rahul Bajaj about 1 year ago

  • Target version set to 220

#6 Updated by Rahul Bajaj 12 months ago

  • Target version changed from 220 to 230

#7 Updated by Ivan Necas 5 months ago

  • Bugzilla link changed from 1486696 to 1554774

#8 Updated by The Foreman Bot 5 months ago

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

#9 Updated by Rahul Bajaj about 2 months ago

  • Status changed from Ready For Testing to Closed

Also available in: Atom PDF