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

resource_type face search/find returns empty results


    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Won't Fix
    • Affects Version/s: PUP 3.6.0, PUP 3.7.1
    • Fix Version/s: None
    • Component/s: None
    • Environment:

      puppet gem in Linux with several ruby versions.

    • Template:



      Up until 3.6, something like:

      require 'puppet/face'
      Puppet::Face[:resource_type, '0.0.1'].search('*')

      would return a list of Resource::Type by parsing all the manifests found according to configuration settings.

      At some point this (along with find and possibly other indirector-provided functions) got broken, because the current_environment in Puppet @context is not set correctly to production, but to *root*, When using the CLI, there is a step in application.rb where the current environment is set from Puppet options, so the CLI still works, but when using the face directly it does not.

      As a workaround:

            configured_environment = Puppet.lookup(:environments).get('production')
            Puppet.push_context({:current_environment => configured_environment})

      seems to work, but I am not sure it is the best way or why.

      It is still a mystery to me what '*root*' means (it comes from puppet.rb/self.bootstrap_context(). And why would it make a difference with 'production' when $basemodulepath modules should be loaded regardless of the environment anyway?

      I found this was the only relevant difference when running puppet resource_type search '*' vs. running the Face from Ruby (despite having populated Puppet.settings with all the necessary stuff).

      Not sure if or how many other faces are affected (since a few use the class Indirector and reuse some of the involved code).




            • Assignee:
              hsanjuan Hector Sanjuan
            • Votes:
              0 Vote for this issue
              5 Start watching this issue


              • Created:

                Zendesk Support