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

Multiple hiera functions in one string does not work with hiera v4

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: PUP 4.8.2, PUP 4.9.0
    • Component/s: None
    • Labels:
      None
    • Template:
    • Team:
      Puppet Developer Experience
    • Sprint:
      PDE 2017-01-11
    • Release Notes:
      Bug Fix
    • Release Notes Summary:
      Hide
      A regression introduced in Puppet 4.8.0 caused an attempt to lookup a string containing more than one interpolation that in turn used interpolation function hiera (e.g. %{hiera('some_key')} ) to fail when running with trace level set to debug. This regression is now fixed.
      Show
      A regression introduced in Puppet 4.8.0 caused an attempt to lookup a string containing more than one interpolation that in turn used interpolation function hiera (e.g. %{hiera('some_key')} ) to fail when running with trace level set to debug. This regression is now fixed.
    • QA Risk Assessment:
      No Action
    • QA Risk Assessment Reason:
      covered by unit tests

      Description

      After moving to hiera v4 and per environment hiera config files, I got this error while running puppet:

      Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Function Call, undefined method `pop' for nil:NilClass at /etc/puppetlabs/code/environments/production/site.pp:37:11 on node 
      

      puppet server:

      2017-01-04 03:48:07,181 ERROR [qtp870122728-64] [puppetserver] Puppet Evaluation Error: Error while evaluating a Function Call, undefined method `pop' for nil:NilClass at /etc/puppetlabs/code/environments/production/site.pp:37:11 on node 
      2017-01-04 03:48:07,182 ERROR [qtp870122728-64] [puppetserver] Puppet Server Error: Evaluation Error: Error while evaluating a Function Call, undefined method `pop' for nil:NilClass at /etc/puppetlabs/code/environments/production/site.pp:37:11 on node 
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/lookup/invocation.rb:79:in `with'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/data_providers/lookup_adapter.rb:149:in `do_lookup'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/data_providers/lookup_adapter.rb:72:in `lookup'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/lookup.rb:77:in `search_and_merge'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/lookup.rb:32:in `lookup'
      org/jruby/RubyKernel.java:1242:in `catch'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/lookup.rb:32:in `lookup'
      org/jruby/RubyArray.java:1613:in `each'
      org/jruby/RubyEnumerable.java:852:in `inject'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/lookup.rb:30:in `lookup'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/loader/../../../puppet/functions/lookup.rb:209:in `do_lookup'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/loader/../../../puppet/functions/lookup.rb:193:in `lookup_2'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/functions/dispatch.rb:47:in `invoke'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/functions/dispatcher.rb:36:in `dispatch'
      org/jruby/RubyKernel.java:1242:in `catch'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/functions/dispatcher.rb:35:in `dispatch'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/functions/function.rb:46:in `call'
      org/jruby/RubyKernel.java:1242:in `catch'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/functions/function.rb:45:in `call'
      /etc/puppetlabs/code/environments/production/site.pp:37:in `call_function'
      org/jruby/RubyKernel.java:1079:in `eval'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/evaluator/runtime3_support.rb:284:in `call_function'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/profiler/around_profiler.rb:58:in `profile'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/profiler.rb:51:in `profile'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/evaluator/runtime3_support.rb:282:in `call_function'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/evaluator/evaluator_impl.rb:941:in `call_function_with_block'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/evaluator/evaluator_impl.rb:910:in `eval_CallNamedFunctionExpression'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/visitor.rb:69:in `visit_this_1'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/evaluator/evaluator_impl.rb:82:in `evaluate'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/evaluator/evaluator_impl.rb:359:in `eval_AssignmentExpression'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/visitor.rb:69:in `visit_this_1'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/evaluator/evaluator_impl.rb:82:in `evaluate'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/evaluator/evaluator_impl.rb:638:in `eval_BlockExpression'
      org/jruby/RubyArray.java:1613:in `each'
      org/jruby/RubyEnumerable.java:852:in `inject'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/evaluator/evaluator_impl.rb:638:in `eval_BlockExpression'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/visitor.rb:69:in `visit_this_1'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/evaluator/evaluator_impl.rb:82:in `evaluate'
      /etc/puppetlabs/code/environments/production/site.pp:0:in `stack'
      org/jruby/RubyKernel.java:1079:in `eval'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/puppet_stack.rb:30:in `stack'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/evaluator/evaluator_impl.rb:715:in `eval_Program'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/visitor.rb:69:in `visit_this_1'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/evaluator/evaluator_impl.rb:82:in `evaluate'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/parser/evaluating_parser.rb:63:in `evaluate'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/parser/ast/pops_bridge.rb:132:in `evaluate'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/parser/ast.rb:31:in `safeevaluate'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/resource/type.rb:184:in `evaluate_code'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/parser/resource.rb:81:in `evaluate'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/profiler/around_profiler.rb:58:in `profile'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/profiler.rb:51:in `profile'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/parser/resource.rb:73:in `evaluate'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/parser/compiler.rb:639:in `evaluate_main'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/parser/compiler.rb:174:in `compile'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/profiler/around_profiler.rb:58:in `profile'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/profiler.rb:51:in `profile'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/parser/compiler.rb:174:in `compile'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/context.rb:65:in `override'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet.rb:241:in `override'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/parser/compiler.rb:162:in `compile'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/parser/compiler.rb:33:in `compile'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/indirector/catalog/compiler.rb:266:in `compile'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/profiler/around_profiler.rb:58:in `profile'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/profiler.rb:51:in `profile'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/indirector/catalog/compiler.rb:264:in `compile'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:223:in `benchmark'
      /opt/puppetlabs/server/apps/puppetserver/puppet-server-release.jar!/META-INF/jruby.home/lib/ruby/1.9/benchmark.rb:295:in `realtime'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:222:in `benchmark'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/indirector/catalog/compiler.rb:262:in `compile'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/indirector/catalog/compiler.rb:53:in `find'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/indirector/indirection.rb:194:in `find'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/network/http/api/indirected_routes.rb:121:in `do_find'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/network/http/api/indirected_routes.rb:48:in `call'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/context.rb:65:in `override'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet.rb:241:in `override'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/network/http/api/indirected_routes.rb:47:in `call'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/network/http/route.rb:82:in `process'
      org/jruby/RubyArray.java:1613:in `each'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/network/http/route.rb:81:in `process'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/network/http/route.rb:87:in `process'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/network/http/route.rb:87:in `process'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/network/http/handler.rb:60:in `process'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/profiler/around_profiler.rb:58:in `profile'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/profiler.rb:51:in `profile'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/network/http/handler.rb:58:in `process'
      file:/opt/puppetlabs/server/apps/puppetserver/puppet-server-release.jar!/puppetserver-lib/puppet/server/master.rb:42:in `handleRequest'
      Puppet$$Server$$Master_1866731659.gen:13:in `handleRequest'
      request_handler_core.clj:273:in `invoke'
      jruby_request.clj:46:in `invoke'
      jruby_request.clj:31:in `invoke'
      request_handler_service.clj:34:in `handle_request'
      request_handler.clj:3:in `invoke'
      request_handler.clj:3:in `invoke'
      core.clj:2515:in `invoke'
      ring_middleware.clj:284:in `invoke'
      core.clj:168:in `invoke'
      core.clj:211:in `invoke'
      core.clj:45:in `invoke'
      core.clj:343:in `invoke'
      core.clj:51:in `invoke'
      ringutils.clj:83:in `invoke'
      master_core.clj:428:in `invoke'
      ring.clj:21:in `invoke'
      ring.clj:12:in `invoke'
      comidi.clj:249:in `invoke'
      jetty9_core.clj:424:in `invoke'
      normalized_uri_helpers.clj:80:in `invoke'
      

      Removing this line in my common.yaml

      profile::proxy::url: "http://%{hiera('profile::proxy::host')}:%{hiera('profile::proxy::port')}"
      

      the error does not appears anymore.

        Attachments

          Activity

            jsd-sla-details-panel

              People

              • Assignee:
                Unassigned
                Reporter:
                jkroepke Jan-Otto Kröpke
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: