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

The addition of dig to puppet functions breaks puppetlabs-stdlib

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • PUP 4.5.0, PUP 4.5.1, PUP 4.5.2
    • None
    • Language
    • None

    Description

      With puppet 4.5.X we have introduced dig as a function. This is not documented @ https://docs.puppet.com/puppet/latest/reference/function.html

      When running puppetlabs-stdlib dig with puppet 4, it uses puppets dig function not stdlib. This is causing weird behaviour, also breaking the acceptance tests for the module.

      To replicate:

      • checkout the puppetlabs stdlib module.
      • export PUPPET_GEM_VERSION="= 4.5.0"
      • bundle install --path .bundle/gems/
      • bundle exec rspec ./spec/functions/dig_spec.rb

      output from pry / testing

       => 14:   it{ require 'pry'; binding.pry}
          15:     it { is_expected.to run.with_params({}, 'bad').and_raise_error(ArgumentError) }
          16:
          17:  #   it { pending "the puppet 4 implementation"; is_expected.to run.with_params({}, []).and_return({}) }
          18:  #   it { pending "the puppet 4 implementation"; is_expected.to run.with_params({"a" => "b"}, ["a"]).and_return("b") }
          19:  #   it { pending "the puppet 4 implementation"; is_expected.to run.with_params({"a" => {"b" => "c"}}, ["a", "b"]).and_return("c") }
       
      [1] pry(#<RSpec::ExampleGroups::Dig::SignatureValidationInPuppet4>)> subject
      => #<#<Class:0x007fe2d4e1e7e0>:0x007fe2d4de68e0
       @closure_scope={},
       @loader=
        #<Puppet::Pops::Loader::ModuleLoaders::FileBased:0x007fe2d4e7d178
         @last_name=
          #<Puppet::Pops::Loader::Loader::TypedName:0x007fe2d4e3f030 @compound_name="function/dig", @hash=-827445405795289085, @name="dig", @name_parts=["dig"], @type=:function>,
         @last_result=
          #<Puppet::Pops::Loader::Loader::NamedEntry:0x007fe2d4de68b8
           @origin="/Users/tp/workspace/git/puppetlabs-stdlib/.bundle/gems/ruby/2.2.0/gems/puppet-4.5.0-universal-darwin/lib/puppet/pops/loader/../../../puppet/functions/dig.rb",
           @typed_name=
      

      Whilst this is still broken, we cannot merge PRs for stdlib, due to failing acceptance.

      Attachments

        Issue Links

          Activity

            People

              ntpttr Nate Potter
              tp Thomas Honey
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Zendesk Support