Bug #30889
Updated by Tomer Brisker about 4 years ago
Since we upgrade we get some strange errors. There is no correlation in time or method we call. We get for example `internal server error` when requesting a `compute_profile`:
<pre><code class="text">
2020-09-21T11:39:49 [I|app|4202d8c4] Started GET "/api/compute_profiles/23" for 44.128.0.8 at 2020-09-21 11:39:49 +0000
2020-09-21T11:39:49 [I|app|4202d8c4] Processing by Api::V2::ComputeProfilesController#show as JSON
2020-09-21T11:39:49 [I|app|4202d8c4] Parameters: {"apiv"=>"v2", "id"=>"23"}
2020-09-21T11:39:49 [I|app|4202d8c4] Rendering api/v2/compute_profiles/show.json.rabl
2020-09-21T11:39:49 [I|app|4202d8c4] Rendered api/v2/compute_profiles/show.json.rabl (Duration: 19.4ms | Allocations: 4244)
2020-09-21T11:39:49 [W|app|4202d8c4] Action failed
2020-09-21T11:39:49 [I|app|4202d8c4] Rendering api/v2/errors/standard_error.json.rabl within api/v2/layouts/error_layout
2020-09-21T11:39:49 [I|app|4202d8c4] Rendered api/v2/errors/standard_error.json.rabl within api/v2/layouts/error_layout (Duration: 0.7ms | Allocations: 276)
2020-09-21T11:39:49 [I|app|4202d8c4] Completed 500 Internal Server Error in 37ms (Views: 5.0ms | ActiveRecord: 12.8ms | Allocations: 13285)
</code></pre>
With the corresponding ansible error:
<pre><code class="text">
fatal: [localhost]: FAILED! => {"changed": false, "error": {"message": "undefined method `detect' for #<String:0x00007f5476c41bd0>"}, "msg": "Failed to show resource: 500 Server Error: Internal Server Error for url: https://foreman.example.net/api/compute_profiles/23"}
</code></pre>
Or we get an error from foreman inventory module:
<pre><code class="text">
2020-09-21T11:46:41 [I|app|d1433698] Processing by Api::V2::HostsController#index as JSON
2020-09-21T11:46:41 [I|app|d1433698] Parameters: {"page"=>"1", "per_page"=>"250", "apiv"=>"v2"}
2020-09-21T11:46:41 [I|app|d1433698] invalid user
2020-09-21T11:46:41 [W|app|d1433698] SSO failed
2020-09-21T11:46:41 [I|app|d1433698] Rendering api/v2/errors/unauthorized.json.rabl within api/v2/layouts/error_layout
2020-09-21T11:46:41 [I|app|d1433698] Rendered api/v2/errors/unauthorized.json.rabl within api/v2/layouts/error_layout (Duration: 5.2ms | Allocations: 5364)
2020-09-21T11:46:41 [I|app|d1433698] Filter chain halted as :authorize rendered or redirected
2020-09-21T11:46:41 [I|app|d1433698] Completed 401 Unauthorized in 148ms (Views: 9.9ms | ActiveRecord: 11.9ms | Allocations: 13067)
2020-09-21T11:46:41 [I|app|9e73f1e3] Started GET "/api/v2/hosts?page=1&per_page=250" for 44.128.0.8 at 2020-09-21 11:46:41 +0000
2020-09-21T11:46:41 [I|app|9e73f1e3] Processing by Api::V2::HostsController#index as JSON
2020-09-21T11:46:41 [I|app|9e73f1e3] Parameters: {"page"=>"1", "per_page"=>"250", "apiv"=>"v2"}
2020-09-21T11:46:41 [I|app|9e73f1e3] invalid user
2020-09-21T11:46:41 [W|app|9e73f1e3] SSO failed
2020-09-21T11:46:41 [I|app|9e73f1e3] Rendering api/v2/errors/unauthorized.json.rabl within api/v2/layouts/error_layout
2020-09-21T11:46:41 [I|app|9e73f1e3] Rendered api/v2/errors/unauthorized.json.rabl within api/v2/layouts/error_layout (Duration: 3.4ms | Allocations: 5211)
2020-09-21T11:46:41 [I|app|9e73f1e3] Filter chain halted as :authorize rendered or redirected
2020-09-21T11:46:41 [I|app|9e73f1e3] Completed 401 Unauthorized in 83ms (Views: 6.3ms | ActiveRecord: 4.0ms | Allocations: 12853)
</code></pre>
with the following ansible error:
<pre><code class="text">
/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py:988: InsecureRequestWarning: Unverified HTTPS request is being made to host 'foreman.example.com'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
InsecureRequestWarning,
[WARNING]: * Failed to parse /builds/infra/infrastructure-
lifecycle_management/ansible/spock.foreman.yml with auto plugin: 401 Client
Error: Unauthorized for url:
https://foreman.example.com/api/v2/hosts?page=1&per_page=250
[WARNING]: * Failed to parse /builds/infra/infrastructure-
lifecycle_management/ansible/spock.foreman.yml with yaml plugin: Plugin
configuration YAML file, not YAML inventory
[WARNING]: * Failed to parse /builds/infra/infrastructure-
lifecycle_management/ansible/spock.foreman.yml with ini plugin: Invalid host
pattern 'plugin:' supplied, ending in ':' is not allowed, this character is
reserved to provide a port.
[WARNING]: * Failed to parse /builds/infra/infrastructure-
lifecycle_management/ansible/spock.foreman.yml with foreman plugin: 401 Client
Error: Unauthorized for url:
https://foreman.example.com/api/v2/hosts?page=1&per_page=250
[WARNING]: Unable to parse /builds/infra/infrastructure-
lifecycle_management/ansible/spock.foreman.yml as an inventory source
</code></pre>
The `user` is correct and works pretty on other tasks with the same inventory source file:
<pre><code class="yaml">
plugin: foreman
user: test
url: "https://foreman.example.com"
validate_certs: False
want_facts: True
want_params: True
want_ansible_ssh_host: True
</code></pre>
No idea was went wrong. First of all I think we need some help in debugging this issue to give more input.