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

helper functions in custom function

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: PUP 3.7.1
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Template:

      Description

      Hi,
      I have a problem with helper functions in custom function

      My puppet-Version: v3.7.1
      If you need more information, let me know.
      My custom function in very short from, but with the same error.

      module Puppet::Parser::Functions
        newfunction(:httpd_modules, :type => :rvalue) do |args|
          def helper_function(value)
            value
          end
       
          result = 1 + helper_function(3)
          result
        end
      end
      

      Puppet-Trace:

      Error: Could not retrieve catalog from remote server: Error 400 on SERVER: undefined method `helper_function' for #<Puppet::Parser::Scope:0x007fac297fbd68> at /www/data/puppet-environment/production/modules/httpd/manifests/webserver.pp:193 on node rpm-repo.pixelpark.com
      /usr/lib/ruby/site_ruby/1.8/puppet/indirector/rest.rb:207:in `is_http_200?'
      /usr/lib/ruby/site_ruby/1.8/puppet/indirector/rest.rb:100:in `find'
      /usr/lib/ruby/site_ruby/1.8/puppet/indirector/indirection.rb:201:in `find'
      /usr/lib/ruby/site_ruby/1.8/puppet/configurer.rb:256:in `retrieve_new_catalog'
      /usr/lib/ruby/site_ruby/1.8/puppet/util.rb:327:in `thinmark'
      /usr/lib/ruby/1.8/benchmark.rb:308:in `realtime'
      /usr/lib/ruby/site_ruby/1.8/puppet/util.rb:326:in `thinmark'
      /usr/lib/ruby/site_ruby/1.8/puppet/configurer.rb:255:in `retrieve_new_catalog'
      /usr/lib/ruby/site_ruby/1.8/puppet/configurer.rb:60:in `retrieve_catalog'
      /usr/lib/ruby/site_ruby/1.8/puppet/configurer.rb:103:in `prepare_and_retrieve_catalog'
      /usr/lib/ruby/site_ruby/1.8/puppet/configurer.rb:170:in `run'
      /usr/lib/ruby/site_ruby/1.8/puppet/agent.rb:47:in `run'
      /usr/lib/ruby/site_ruby/1.8/puppet/agent/locker.rb:20:in `lock'
      /usr/lib/ruby/site_ruby/1.8/puppet/agent.rb:47:in `run'
      /usr/lib/ruby/site_ruby/1.8/puppet/agent.rb:117:in `with_client'
      /usr/lib/ruby/site_ruby/1.8/puppet/agent.rb:44:in `run'
      /usr/lib/ruby/site_ruby/1.8/puppet/agent.rb:82:in `run_in_fork'
      /usr/lib/ruby/site_ruby/1.8/puppet/agent.rb:43:in `run'
      /usr/lib/ruby/site_ruby/1.8/puppet/application.rb:179:in `call'
      /usr/lib/ruby/site_ruby/1.8/puppet/application.rb:179:in `controlled_run'
      /usr/lib/ruby/site_ruby/1.8/puppet/agent.rb:41:in `run'
      /usr/lib/ruby/site_ruby/1.8/puppet/application/agent.rb:355:in `onetime'
      /usr/lib/ruby/site_ruby/1.8/puppet/application/agent.rb:321:in `run_command'
      /usr/lib/ruby/site_ruby/1.8/puppet/application.rb:371:in `run'
      /usr/lib/ruby/site_ruby/1.8/puppet/application.rb:477:in `plugin_hook'
      /usr/lib/ruby/site_ruby/1.8/puppet/application.rb:371:in `run'
      /usr/lib/ruby/site_ruby/1.8/puppet/util.rb:479:in `exit_on_fail'
      /usr/lib/ruby/site_ruby/1.8/puppet/application.rb:371:in `run'
      /usr/lib/ruby/site_ruby/1.8/puppet/util/command_line.rb:137:in `run'
      /usr/lib/ruby/site_ruby/1.8/puppet/util/command_line.rb:91:in `execute'
      /usr/bin/puppet:8
      

      Thanks for your help
      Philipp

        Attachments

          Activity

            People

            • Assignee:
              philipp.dallig Philipp
              Reporter:
              philipp.dallig Philipp
            • Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Zendesk Support