Should hammer host update --parameters="a=b,c=d" clear existing host parameters?


Using the (ancient) foreman v1.9.3 if a host had a parameter “foo” and

hammer host update --name X --parameters "bar=baz"

was run the host would simply add “bar.” With 1.16.1 it now deletes “foo” as well. Is this intended?

I know that set-parameter is the correct way to do this.

Expected outcome:

Host would have both “foo” and “bar” parameters.

Foreman and Proxy versions:


Foreman and Proxy plugin versions:

Other relevant data:

I believe, this is intentional & it behaves like this since beginning.
As I can see in foreman v1.9.3 also it assigns new parameters directly so, I am not sure what you mentioned about (ancient) foreman v1.9.3.

I have discussed with @Ori_Rabin about the same. May be she will provide some insights.

@Tomas_Strachota, any thoughts?

As @kgaikwad said it is intentional and I believe(d) it was always like that. I checked in the repo and the set-parameter is there since when host command was introduced (hammer-cli-foreman-0.0.3, 5 years ago).

The behavior is consistent with how other list attributes behave on update - the list is replaced as a whole with what you provide. In parameters it was sometimes not what users wanted so the set-parameter/‘delete-parameter’ command was added to manipulate with single parameter.

I mention foreman 1.9.3 because that was the version we were using and that version operates how I describe. I tested it with hammer versions 0.9.0 and 0.11.0.

Thanks for clarifying @mbacovsky. I agree with you that for consistency it should act this way. I can now explain to my co-workers that the foreman developers do not believe this is a bug and we need to fix our use of hammer host update --parameters.