Uploaded image for project: 'Hiera'
  1. Hiera
  2. HI-69

CLI inventory service lookup doesn't work with Puppet 3

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Won't Do
    • Affects Version/s: HI 1.3.0
    • Fix Version/s: None
    • Component/s: None
    • Labels:
    • Template:
    • CS Priority:
      Normal

      Description

      Hiera's CLI tool does inventory service lookups, and uses a wacky and outdated way to initialize Puppet's settings. It's busted as of Puppet 3.something. Certainly broken in PE 3.0.1.

      bin/hiera, ca. ln.95:

            require 'puppet/util/run_mode'
            $puppet_application_mode = Puppet::Util::RunMode[:master]
            require 'puppet'
            Puppet.settings.parse
            Puppet::Node::Facts.indirection.terminus_class = :rest
            scope = YAML.load(Puppet::Node::Facts.indirection.find(source).to_yaml)
            # Puppet makes dumb yaml files that do not promote data reuse.
            scope = scope.values if scope.is_a?(Puppet::Node::Facts)
      

      I replaced it with this instead, and it started working again:

            require 'puppet'
            Puppet.initialize_settings()
            Puppet::Node::Facts.indirection.terminus_class = :rest
            scope = YAML.load(Puppet::Node::Facts.indirection.find(source).to_yaml)
            # Puppet makes dumb yaml files that do not promote data reuse.
            scope = scope.values if scope.is_a?(Puppet::Node::Facts)
      

      While I'm in here, I don't think that yaml dump/reload is necessary; I tried just calling .values on the object via irb, and it worked fine and gave me what I expected. (I ==-ed it against the same object via yaml roundtrip too, and it said they were the same.)

      Anyway, before checking the fix in, we need to check to see if the new Puppet 3 compatible way breaks Hiera under 2.7.

        Attachments

          Activity

            People

            Assignee:
            eric.sorenson Eric Sorenson
            Reporter:
            nick.fagerlund Nicholas Fagerlund
            Votes:
            2 Vote for this issue
            Watchers:
            5 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Zendesk Support