ahuffman / sat6-create-hosts

An Ansible role to create new virtual and bare-metal hosts in Satellite 6.x. v2 of Satellite6 API is required.
MIT License
4 stars 7 forks source link

[sat6_create_hosts : Obtain Satellite6 Location ID] 400 error #6

Open michaelsstuff opened 5 years ago

michaelsstuff commented 5 years ago

Hi,

following tested with commit 57a1b7c

Task "Obtain Satellite6 Location ID" stops with fatal:

"content": "{\"status\":400,\"error\":\"There was a problem in the JSON you submitted: 751: unexpected token at '{\\\"search\\\": 'name=\\\"Nürnberg\\\"'}'\"}",

I am not 100% sure what is happening, but are you sending a search data body? I think Locations does not support this? https://theforeman.org/api/1.22/apidoc/v2/locations.html

The yaml files is this:

---
- name: "Satellite 6 create new hosts"
  hosts: "localhost"
  tasks:
    - name: "Provision Satellite 6 Hosts"
      include_role:
        name: "sat6_create_hosts"
      vars:
        sat6_fail_on_existing: False
        sat6_hosts:
          - name: "dev-app-1"
            domain: "mydomain.de"
            host_group: "Ansible/API"
            location: "Nürnberg"
            ipv4: "XXX.XXX.XXX.XXX"
            subnet: "255.255.255.128"
            compute_resource: "vcsa"
            compute_profile: "API APP"
            parameters:
              - name: "kt_activation_keys"
                value: "rhel7"
ahuffman commented 5 years ago

@michaelsstuff can you provide the playbook log output in verbose mode? I need to see what the task is doing with your location name, but my first guess is the umlaut in the location name, as I do not have this problem in my lab while specifying a location.

Are you running this against Satellite6 or Foreman/Katello? I've only tested and built this role for Satellite6, although it may properly function with upstream Foreman/Katello.

ahuffman commented 5 years ago

@michaelsstuff did some testing in my lab by creating a location called "Nürnberg". It fails, so I'm able to reproduce.

If I switch the location name to "Nurnberg" with no umlaut and a 'u' everything works.

If I view the location via the API, the name matches what I'm searching on. I'm not positive on how to totally resolve since Ansible uses utf-8 it shouldn't be a problem.

In short, until I figure out a real solution to this, a simple work-around is to change your location name to "Nurnberg".

michaelsstuff commented 5 years ago

Renaming to Nurnberg worked. Thank you!

ahuffman commented 5 years ago

Thanks for confirming the work-around is acceptable. I'll leave this one open until I come up with a solution on how to handle this going forward. Thanks again for reporting the issue, it helps out!