Uploaded image for project: 'Puppet'
  1. Puppet
  2. PUP-3000

Could not get fact fqdn/ipaddress

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Normal
    • Resolution: Won't Fix
    • PUP 3.6.2
    • None
    • None

    Description

      I have a weird issue where the Puppet Master is generating a certificate called ".mydomain.com" (ie: ".$domain").

      Looking into the logs, I see the following:

      Aug  1 00:01:14 kungfumaster puppet-master[447]: Could not retrieve fact fqdn
      Aug  1 00:01:14 kungfumaster puppet-master[447]: Could not retrieve fact ipaddress
      

      In the codebase it's located here: https://github.com/puppetlabs/puppet/blob/07a37ff92efac39e264f8279613594c95d650d63/lib/puppet/indirector/catalog/compiler.rb#L169

      When I insert the following code in the set_server_facts method:

      Facter.loadfacts
      Puppet.warning Facter.to_hash
      

      I see the following output in syslog:

      Aug  1 02:10:40 kungfumaster puppet-master[5565]: {"domain"=>"mydomain.com", "timezone"=>"UTC", "uptime"=>"6 days", "memorysize"=>"0.00 MB", "memoryfree"=>"0.00 MB", "memorysize_mb"=>"0.00", "memoryfree_mb"=>"0.00", "ps"=>"ps -ef", "uptime_days"=>6, "uptime_seconds"=>518934, "path"=>":/usr/sbin:/sbin", "puppetversion"=>"3.6.2", "augeasversion"=>"1.2.0", "sshdsakey"=>"AAAAB3NzaC1kc3MAAACBALgbR5MWx0PsKsLGV9o+krvqbiSc55TKavimNdXKjDGTZ6GQQ8CjyJKP52rt2QrxwkiCcFk+KibsY1VOyBVdZvH5fWo551xqpSVt9YaY74SxgyvVMcX6ROVTbm3jWVBlEzS312jtoMFbWZMxQP2CN2IOi9wu15+sHj8VUTqihRShAAAAFQDFWCgbS/u9Ld3o/Oyvq1Ab3SOORQAAAIACfGOvHQb5jVXmsQWi1HKOsVQx8mC2qXwa8bqQSHTN1O+91vQ9czjZY/ZlibvBirtqlG3L14kMDehzf9GueVgzF7YK8UVYx5AsZ3GBp/xUw6QmQV874RwKq8PO4+j8ze4/xi3oiJKQOHWWN5HHAiW4bMFaqTfY9ClIDyiY290vhAAAAIBEhHD1qvlZAqVtg83Itmz9qArM9KghkWpT3TIqcCCCVJaQahX9ESj/i28bDSyMpPsUpga/7yPGpZ1x997a37Ez3wR/+KNkjCN3FkjY1Kr3C64v4JWAviQid33V3wJfpVI+VIfayR/OS8qy1ZrIqdUlsiLr27TBg/umZmtfx1g9Iw==", "sshfp_dsa"=>"SSHFP 2 1 ba4c2e9a86297ff0ad38b522425d624d888ce778\nSSHFP 2 2 25c636a0682c8ea0d546aaa2ab4e12016ea6cfc603a241a84c0907fc9c22a388", "sshrsakey"=>"AAAAB3NzaC1yc2EAAAADAQABAAABAQCfOO6ZxMjN53A6XpEs/yUFhp5GhDem6gCcMxfYTNvcyaEFiaVb7p6F9C3aFVs6cf2rG6/ToHktMWvdn4ctNFaH1kwGvlY7BJvsqQ9MlYhIHYb23Uk+9PE83d6aNJuvR8QuEtZAmBq1Wwku5c0G4gHVvJj/U/NaZlTE70JSyMax5EGo8m0JYiFL4Z+pQubUi3rqwRGhZYsyXwzZrAMfWsuG+sPUCPpejoUY/XXRIwQ3gfvsbzrn99zVeGxQ90eZkAQTs+s/iEiWQ8zToMG0PyYu/Dht52gu98GfZqC8yT7mCwl771u9IcibdyHU+XHFRyWO89avpbUDgIpSafH1bJJj", "sshfp_rsa"=>"SSHFP 1 1 a02b44bd5d841119d359a38cdec285f4e107a12f\nSSHFP 1 2 1337686dc142d375e803c9b09413509629141baa0e7abe1d2aa8fb7a88369883", "sshecdsakey"=>"AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBC8AtVEIzCTjKv1efUC7AGPqcqnrSrbe5Mt3tVhhT9lP2Rn8ZtCQYwaey+YKvbs7wEFZ+BEeR2aMnjXPXSoWcGc=", "sshfp_ecdsa"=>"SSHFP 3 1 02935f27031c5b8a1ea125ba0e7c99c78722b407\nSSHFP 3 2 2f95d655a7fe1a41ce15e23721678a0cdb4acc36bbeaba1642588b996dbc1975", "sshed25519key"=>"AAAAC3NzaC1lZDI1NTE5AAAAIK3eXW1MyH61XmaLCmii1uNH2L5DAmg1GbroeTWahV/7", "sshfp_ed25519"=>"SSHFP 4 1 479b19005f3f428e031753bce06ef2ea5e02086e\nSSHFP 4 2 fe6ffd9e147621fbef429b3e190c4cdc56e1ac1b8a368682f183bd8cc0c1f85e", "facterversion"=>"2.1.0", "rubysitedir"=>"/usr/local/lib/site_ruby/1.9.1", "uptime_hours"=>144, "rubyversion"=>"1.9.3"}
      

      As you can see, there's no IP address present there or FQDN in the facts for some reason.

      Using Ruby on the same machine, I can get the FQDN and IP address facts easily:

      require "facter"
      puts Facter.value("fqdn")
      puts Facter.value("ipaddress")
      

      The above code works without any problems just running "irb". The "facter" command-line tool also works without issue.

      Since I though that it might be a permissions-based issue, as the Puppet Master is running as user "puppet," I tried running the same code as the "puppet" user and it works.

      For some reason, a large number of facts simply aren't present in Facter at the time that this code runs.

      I'm running the latest Passenger from Phusion's APT repository and the latest NGINX from there as well.

      Ruby Version: 1.9.3p484
      Passenger Version: 4.0.48
      NGINX Version: 1.6.0
      Puppet Version: 3.6.2
      Facter Version: 2.1.0

      Configuration files:
      /etc/nginx/sites-enabled/puppetmaster: http://pastebin.com/ZnFy8S1z
      /etc/nginx/nginx.conf: http://pastebin.com/E2Jb39VC
      /etc/puppet/puppet.conf: http://pastebin.com/D8iYR2u9
      /usr/share/puppet/rack/puppetmaster/config.ru: http://pastebin.com/HNS7Nskn

      The problem does not happen when I use the WEBrick server with "puppet master --no-daemonize --verbose", therefore I think the problem has to do with Passenger and the provided config.ru.

      ---------------------

      The problem is apparently caused by PATH not being defined when Passenger runs the Puppet Master. The fix is either to do this in config.ru:

      if not ENV['PATH']
          ENV['PATH'] = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
      end
      

      Or to do the same thing inside of the Puppet Master as it starts up.

      Attachments

        Activity

          People

            andy Andrew Parker
            rfkrocktk Naftuli Tzvi Kay
            Kurt Wall Kurt Wall
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Zendesk Support