Project

General

Profile

Actions

Bug #35658

closed

Ansible fact parser fails to parse Windows facts if they do not contain os_name

Added by Evgeni Golov over 1 year ago. Updated over 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Facts
Target version:
-
Difficulty:
Triaged:
Yes
Fixed in Releases:
Found in Releases:

Description

Reported in https://community.theforeman.org/t/ansible-callback-with-windows-openssh-server-produces-a-500-server-error-internal/25689/33

Log:

2022-10-20T13:23:51 [I|app|d3408894] Started POST "/api/v2/hosts/facts" for 192.168.1.90 at 2022-10-20 13:23:51 +0200
2022-10-20T13:23:51 [I|app|d3408894] Processing by Api::V2::HostsController#facts as JSON
2022-10-20T13:23:51 [I|app|d3408894]   Parameters: {"name"=>"win10test002.testdom.local", "facts"=>"[FILTERED]", "apiv"=>"v2", "host"=>{"name"=>"win10test002.testdom.local"}}
2022-10-20T13:23:52 [I|app|d3408894] Import facts for 'win10test002.testdom.local' completed. Added: 100, Updated: 0, Deleted 0 facts
2022-10-20T13:23:52 [W|app|d3408894] Action failed
2022-10-20T13:23:52 [I|app|d3408894] Backtrace for 'Action failed' error (NoMethodError): undefined method `tr' for nil:NilClass
 d3408894 | Did you mean?  try
 d3408894 | /usr/share/foreman/app/services/foreman_ansible/operating_system_parser.rb:82:in `os_name'
 d3408894 | /usr/share/foreman/app/services/foreman_ansible/operating_system_parser.rb:7:in `operatingsystem'

The problem is that Ansible does not report the `ansible_os_name` and `ansible_distribution` facts when executed without Admin privileges (see https://github.com/ansible-collections/ansible.windows/pull/78 and https://github.com/ansible-collections/ansible.windows/issues/389 for details, but the issue existed before the PR too, just less obviously).

Actions #1

Updated by The Foreman Bot over 1 year ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/9476 added
Actions #2

Updated by The Foreman Bot over 1 year ago

  • Fixed in Releases 3.5.0 added
Actions #3

Updated by Evgeni Golov over 1 year ago

  • Status changed from Ready For Testing to Closed
Actions #4

Updated by Ewoud Kohl van Wijngaarden over 1 year ago

  • Triaged changed from No to Yes
Actions

Also available in: Atom PDF