The both hosts exists.

I did the same operation api rest using hammer with -d option and I saw the 
command that uses.

[ INFO 2018-10-23 11:24:05 API] PUT 
/katello/api/host_collections/586/remove_hosts
[DEBUG 2018-10-23 11:24:05 API] Params: {
    "host_ids" => [
        [0] "1280"
    ]
}
[DEBUG 2018-10-23 11:24:05 API] Headers: {}
[DEBUG 2018-10-23 11:24:05 API] Using authenticator: 
HammerCLIForeman::Api::InteractiveBasicAuth
[DEBUG 2018-10-23 11:24:05 API] Response: {
    "displayMessages" => {
        "success" => [
            [0] "Successfully removed 1 Host(s)."
        ],
          "error" => []
    }

Then I removed de host with id 1280 from host_collection and I tried to add 
the host to hostname, but it fails.

  - name: Assign sat server {{server}} to {{host_collection}}
    uri:
    
       url: "https://xxxxxx/katello/api/host_collections/586/add_hosts/";
       user: "{{user}}"
       password: "{{password}}"
       method: PUT
       return_content: yes
       force_basic_auth: yes
       validate_certs: no
       body_format: json
       body: '{"hosts_ids":"[1280]"}'
       status_code: [200,201,202,204,301,401]


    "json": {
        "displayMessage": "undefined method `map' for nil:NilClass\nDid you 
mean?  tap", 
        "errors": [
            "undefined method `map' for nil:NilClass\nDid you mean?  tap"
        ]
    }, 


The json with the array is badly built?




El martes, 23 de octubre de 2018, 11:29:35 (UTC+2), Adrian Sebastian Dutu 
escribió:
>
> Can you do a get on both of those ids (972,1280)?  Seems like one of them 
> is not existing.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/fda03fab-a94e-4c39-a8ff-a8f37f0dd24b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to