Skip to content

update_hosts method works from the 2nd time #86

Description

@miarmak

So here are 2 methods of foreman.client.Foreman(), that work incorrect for me:
update_hosts
hosts.update

It take 2 arguments: host and id. So I'm trying to invoke any of those methods from my code with these 2 args:
self.foreman_client.hosts.update(host=host_update_dict, id=1)

And here is the result from the first call:

(server side log)

2017-06-16T00:53:31 [app] [I] Started PUT "/api/hosts/1" for <foreman_ip> at 2017-06-16 00:53:31 +0000
2017-06-16T00:53:31 [app] [I] Processing by Api::V2::HostsController#update as JSON
2017-06-16T00:53:31 [app] [I]   Parameters: {"apiv"=>"v2", "id"=>"1", :host=>{}}

The host argument was sent empty for some reason.

And if I add the same LOC right after the first one, it works:

(my code)
self.foreman_client.hosts.update(host=host_update_dict, id=1)
self.foreman_client.hosts.update(host=host_update_dict, id=1)

(server side log)

2017-06-16T00:55:25 [app] [I] Started PUT "/api/hosts/1" for <foreman_ip> at 2017-06-16 00:55:25 +0000
2017-06-16T00:55:25 [app] [I] Processing by Api::V2::HostsController#update as JSON
2017-06-16T00:55:25 [app] [I]   Parameters: {"apiv"=>"v2", "id"=>"1", :host=>{}}
....................
2017-06-16T00:55:26 [app] [I] Started PUT "/api/hosts/1" for <foreman_ip> at 2017-06-16 00:55:26 +0000
2017-06-16T00:55:26 [app] [I] Processing by Api::V2::HostsController#update as JSON
2017-06-16T00:55:26 [app] [I]   Parameters: {"host"=>{"host_parameters_attributes"=>[{"id"=>1, "value"=>"[FILTERED]", "name"=>"option"}]}, "id"=>"1", "apiv"=>"v2"}

And every next the same request will work as well.

Foreman version: 1.14.3
python-foreman: 0.4.19

So in this case, am I doing something wrong or is it a bug?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions