Uploaded image for project: 'Facter'
  1. Facter
  2. FACT-1551

WSA not initalized before loading custom facts

    XMLWordPrintable

Details

    • Hide

      On Windows, a custom fact using using net/http to query a network service does not fail with "getaddrinfo: Either the application has not called WSAStartup, or WSAStartup failed."

      Show
      On Windows, a custom fact using using net/http to query a network service does not fail with "getaddrinfo: Either the application has not called WSAStartup, or WSAStartup failed."
    • Agent
    • 2
    • AP 2017-01-11
    • Bug Fix
    • An issue has been corrected that could cause custom Ruby facts running on Windows to fail to run if they made use of the Ruby network stack (such as Net::HTTP).
    • No Action
    • covered by unit tests

    Description

      Customer reports: I have implemented a custom fact using net/http to query a service on the local host, however when the code is run from facter on Windows Server 2012R2/2016 the following error is received:

      ERROR puppetlabs.facter - error while resolving custom fact "testy": getaddrinfo: Either the application has not called WSAStartup, or WSAStartup failed.

      Simplified example code:

      require 'net/http'
      Facter.add('testy') do
        setcode do
          uri = URI("http://www.apple.com")
          if ( Net::HTTP.get_response(uri) )
            'Apple II Forever'
          else
            'Altair'
          end
        end
      end
      

      The same, minus 'Facter.add('testy') do setcode do' succeeds using puppet ruby outside of facter.

      Attachments

        Activity

          People

            ethan Ethan Brown
            tom.kishel Thomas Kishel
            Eric Thompson Eric Thompson
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Zendesk Support