Project

General

Profile

Bug #10993

Error adding Windows host

Added by Felipe Ortega about 4 years ago. Updated about 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Importers
Target version:
Difficulty:
Triaged:
Bugzilla link:
Team Backlog:
Fixed in Releases:
Found in Releases:

Description

I've found several issues after adding a new Windows host to Foreman 1.8.

The Windows test client is 2003 Server, running Puppet client 3.8.1.

I've tried installing Foreman in various test environments:
OS: Debian 7.8 (minimal basic installation) + Foreman 1.7 (using foreman-installer): no problem at all
OS: Debian 7.8 (minimal basic installation) + Foreman 1.8 (using foreman-installer): host is added, but
- no "Operating system", "Environment", "Model" info is shown in "Hosts"->"All hosts" dashboard for the Windows host (see attached 'screenshot1').
- no "Properties" is shown in host's detailed page (left click on the host) (see attached 'screenshot2' and 'screenshot3').
- wrong number of "windows 5.2" hosts in "Hosts"->"Operating systems". In fact, it seems to be the number of Puppet runs in that client (if they are run in different minutes) (see attached 'screenshot4'). Also, clicking in "Hosts" column shows no hosts (see attached 'screenshot5')
OS: Debian 8.1 (minimal basic installation) + Foreman 1.8 (using foreman-installer): same issues that with Debian 7.8 + Foreman 1.8

The problem seems to be related to the way interfaces are handled in Foreman 1.8. In fact, there is an exception shown in /var/log/foreman/production.log (see attached file with the excerpt)

production.log production.log 15.5 KB Debian 7.8 + Foreman 1.8 log excerpt Felipe Ortega, 07/03/2015 07:37 AM
screenshot1.png View screenshot1.png 36.1 KB Hosts dashboard Felipe Ortega, 07/03/2015 07:49 AM
screenshot2.png View screenshot2.png 64.1 KB Host's details (empty properties) Felipe Ortega, 07/03/2015 07:49 AM
screenshot3.png View screenshot3.png 60.7 KB Host's details (NICs info) Felipe Ortega, 07/03/2015 07:49 AM
screenshot4.png View screenshot4.png 33.3 KB Operating systems Felipe Ortega, 07/03/2015 07:49 AM
screenshot5.png View screenshot5.png 23 KB (windows 5.2 => os_id=2) Felipe Ortega, 07/03/2015 07:49 AM
facter.yaml facter.yaml 2.72 KB Yoann Le Garff, 10/02/2015 06:26 AM
Screenshot1 Screenshot2 Screenshot3 Screenshot4 Screenshot5

Associated revisions

Revision b064a42c (diff)
Added by Marek Hulán almost 4 years ago

Fixes #10993 - handle no interfaces in facts correctly

History

#1 Updated by Dominic Cleal about 4 years ago

  • Category set to Importers

#2 Updated by Yoann Le Garff almost 4 years ago

Hello,

I have the exactly the same bug with Foreman 1.9.2 : my Windows 2003 Server will not back properties.

Is a fix is planned ?

Thanks.

#3 Updated by Marek Hulán almost 4 years ago

Could you please provide an output of facter --yaml from the windows host? As a workaround you can try disable interface importing by changing "Ignore Puppet facts for provisioning" setting to false. You can find it under Administer -> Settings -> Provisioning.

#4 Updated by Yoann Le Garff almost 4 years ago

Thanks for the tip.

As a workaround, in /usr/share/foreman/app/models/host/base.rb:150, it is better if i change this

set_interfaces(parser) if parser.parse_interfaces?

to this

begin
    set_interfaces(parser) if parser.parse_interfaces?
rescue
end

(to keep provisioning for servers where this issue does not cause problems) ?

Facter output is in attachment.

#5 Updated by Marek Hulán almost 4 years ago

Interesting, in your case the "interfaces" fact is empty. For some reason WMI does not seems to report any interface on your host. We should be able to handle this situation but it would be interesting to find out the real cause.

#6 Updated by Yoann Le Garff almost 4 years ago

The module Facter::Util::IP used by the fact interfaces use this method :

Facter::Util::IP::Windows.interfaces # line 62 in /usr/lib/ruby/vendor_ruby/facter/util/ip.rb
  def self.interfaces # line 42 in /usr/lib/ruby/vendor_ruby/facter/util/ip/windows.rb
    interface_names = []

    network_adapter_configurations.map do |nic|
      Facter::Util::WMI.execquery("SELECT * FROM Win32_NetworkAdapter WHERE Index = #{nic.Index} AND NetEnabled = TRUE").each do |nic|
        interface_names << nic.NetConnectionId unless nic.NetConnectionId.nil? or nic.NetConnectionId.empty?
      end
    end

    interface_names.uniq
  end

The problem is that the WMI class Win32_NetworkAdapter doesn't provide the NetEnabled property on Windows 2003 but does on 2008/2012.

#7 Updated by The Foreman Bot almost 4 years ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/2778 added
  • Pull request deleted ()

#8 Updated by Marek Hulán almost 4 years ago

  • Assignee set to Marek Hulán

#9 Updated by Marek Hulán almost 4 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

#10 Updated by Marek Hulán almost 4 years ago

  • Legacy Backlogs Release (now unused) set to 63

Also available in: Atom PDF