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

WSA not initalized before loading custom facts

    Details

    • Template:
    • Acceptance Criteria:
      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."
    • Team:
      Agent
    • Story Points:
      2
    • Sprint:
      AP 2017-01-11
    • Release Notes:
      Bug Fix
    • Release Notes Summary:
      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).
    • QA Risk Assessment:
      No Action
    • QA Risk Assessment Reason:
      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

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

              Dates

              • Created:
                Updated:
                Resolved:

                Zendesk Support