Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attempting to use puppetdb-ruby in a custom function #11

Closed
abragg opened this issue Mar 17, 2015 · 1 comment
Closed

Attempting to use puppetdb-ruby in a custom function #11

abragg opened this issue Mar 17, 2015 · 1 comment

Comments

@abragg
Copy link

abragg commented Mar 17, 2015

The following custom function causes an agent run to fail. Below also is the captured stack trace. From outside puppet, I'm able to use puppetdb-ruby without issue on this host.

require 'puppetdb'

module Puppet::Parser::Functions
    newfunction(:test_ruby_puppetdb, :type => :rvalue) do |args|
        begin
            client = PuppetDB::Client.new({:server=>'http://localhost:8080'})
        rescue Exception
            puts $!, $@
        end
        return 1
    end
end

uninitialized constant PuppetDB::Client
/etc/puppet/modules/base/lib/puppet/parser/functions/test_ruby_puppetdb.rb:6:in block in <module:Functions>' /usr/local/share/ruby/gems/2.0/gems/puppet-3.7.4/lib/puppet/parser/functions.rb:164:inblock (2 levels) in newfunction'
/usr/local/share/ruby/gems/2.0/gems/puppet-3.7.4/lib/puppet/util/profiler/around_profiler.rb:58:in profile' /usr/local/share/ruby/gems/2.0/gems/puppet-3.7.4/lib/puppet/util/profiler.rb:51:inprofile'
/usr/local/share/ruby/gems/2.0/gems/puppet-3.7.4/lib/puppet/parser/functions.rb:157:in block in newfunction' /usr/local/share/ruby/gems/2.0/gems/puppet-3.7.4/lib/puppet/parser/ast/function.rb:42:inevaluate'
/usr/local/share/ruby/gems/2.0/gems/puppet-3.7.4/lib/puppet/parser/ast.rb:61:in safeevaluate' /usr/local/share/ruby/gems/2.0/gems/puppet-3.7.4/lib/puppet/parser/ast/vardef.rb:14:inevaluate'
/usr/local/share/ruby/gems/2.0/gems/puppet-3.7.4/lib/puppet/parser/ast.rb:61:in safeevaluate' /usr/local/share/ruby/gems/2.0/gems/puppet-3.7.4/lib/puppet/parser/ast/block_expression.rb:11:inblock in evaluate'
/usr/local/share/ruby/gems/2.0/gems/puppet-3.7.4/lib/puppet/parser/ast/block_expression.rb:10:in each' /usr/local/share/ruby/gems/2.0/gems/puppet-3.7.4/lib/puppet/parser/ast/block_expression.rb:10:inevaluate'
/usr/local/share/ruby/gems/2.0/gems/puppet-3.7.4/lib/puppet/parser/ast.rb:61:in safeevaluate' /usr/local/share/ruby/gems/2.0/gems/puppet-3.7.4/lib/puppet/resource/type.rb:127:inevaluate_code'
/usr/local/share/ruby/gems/2.0/gems/puppet-3.7.4/lib/puppet/parser/resource.rb:79:in evaluate' /usr/local/share/ruby/gems/2.0/gems/puppet-3.7.4/lib/puppet/parser/compiler.rb:425:inevaluate_main'
/usr/local/share/ruby/gems/2.0/gems/puppet-3.7.4/lib/puppet/parser/compiler.rb:131:in block (2 levels) in compile' /usr/local/share/ruby/gems/2.0/gems/puppet-3.7.4/lib/puppet/util/profiler/around_profiler.rb:58:inprofile'
/usr/local/share/ruby/gems/2.0/gems/puppet-3.7.4/lib/puppet/util/profiler.rb:51:in profile' /usr/local/share/ruby/gems/2.0/gems/puppet-3.7.4/lib/puppet/parser/compiler.rb:131:inblock in compile'
/usr/local/share/ruby/gems/2.0/gems/puppet-3.7.4/lib/puppet/context.rb:64:in override' /usr/local/share/ruby/gems/2.0/gems/puppet-3.7.4/lib/puppet.rb:244:inoverride'
/usr/local/share/ruby/gems/2.0/gems/puppet-3.7.4/lib/puppet/parser/compiler.rb:117:in compile' /usr/local/share/ruby/gems/2.0/gems/puppet-3.7.4/lib/puppet/parser/compiler.rb:34:incompile'
/usr/local/share/ruby/gems/2.0/gems/puppet-3.7.4/lib/puppet/indirector/catalog/compiler.rb:95:in block (2 levels) in compile' /usr/local/share/ruby/gems/2.0/gems/puppet-3.7.4/lib/puppet/util/profiler/around_profiler.rb:58:inprofile'
/usr/local/share/ruby/gems/2.0/gems/puppet-3.7.4/lib/puppet/util/profiler.rb:51:in profile' /usr/local/share/ruby/gems/2.0/gems/puppet-3.7.4/lib/puppet/indirector/catalog/compiler.rb:93:inblock in compile'
/usr/local/share/ruby/gems/2.0/gems/puppet-3.7.4/lib/puppet/util.rb:161:in block in benchmark' /usr/share/ruby/2.0/benchmark.rb:296:inrealtime'
/usr/local/share/ruby/gems/2.0/gems/puppet-3.7.4/lib/puppet/util.rb:160:in benchmark' /usr/local/share/ruby/gems/2.0/gems/puppet-3.7.4/lib/puppet/indirector/catalog/compiler.rb:92:incompile'
/usr/local/share/ruby/gems/2.0/gems/puppet-3.7.4/lib/puppet/indirector/catalog/compiler.rb:52:in find' /usr/local/share/ruby/gems/2.0/gems/puppet-3.7.4/lib/puppet/indirector/indirection.rb:201:infind'
/usr/local/share/ruby/gems/2.0/gems/puppet-3.7.4/lib/puppet/network/http/api/v1.rb:105:in do_find' /usr/local/share/ruby/gems/2.0/gems/puppet-3.7.4/lib/puppet/network/http/api/v1.rb:50:inblock in call'
/usr/local/share/ruby/gems/2.0/gems/puppet-3.7.4/lib/puppet/context.rb:64:in override' /usr/local/share/ruby/gems/2.0/gems/puppet-3.7.4/lib/puppet.rb:244:inoverride'
/usr/local/share/ruby/gems/2.0/gems/puppet-3.7.4/lib/puppet/network/http/api/v1.rb:49:in call' /usr/local/share/ruby/gems/2.0/gems/puppet-3.7.4/lib/puppet/network/http/route.rb:82:inblock in process'
/usr/local/share/ruby/gems/2.0/gems/puppet-3.7.4/lib/puppet/network/http/route.rb:81:in each' /usr/local/share/ruby/gems/2.0/gems/puppet-3.7.4/lib/puppet/network/http/route.rb:81:inprocess'
/usr/local/share/ruby/gems/2.0/gems/puppet-3.7.4/lib/puppet/network/http/handler.rb:63:in block in process' /usr/local/share/ruby/gems/2.0/gems/puppet-3.7.4/lib/puppet/util/profiler/around_profiler.rb:58:inprofile'
/usr/local/share/ruby/gems/2.0/gems/puppet-3.7.4/lib/puppet/util/profiler.rb:51:in profile' /usr/local/share/ruby/gems/2.0/gems/puppet-3.7.4/lib/puppet/network/http/handler.rb:61:inprocess'
/usr/local/share/ruby/gems/2.0/gems/puppet-3.7.4/lib/puppet/network/http/webrick/rest.rb:37:in block in service' /usr/local/share/ruby/gems/2.0/gems/puppet-3.7.4/lib/puppet/network/http/webrick/rest.rb:36:insynchronize'
/usr/local/share/ruby/gems/2.0/gems/puppet-3.7.4/lib/puppet/network/http/webrick/rest.rb:36:in service' /usr/share/ruby/2.0/webrick/httpserver.rb:138:inservice'
/usr/share/ruby/2.0/webrick/httpserver.rb:94:in run' /usr/local/share/ruby/gems/2.0/gems/puppet-3.7.4/lib/puppet/network/http/webrick.rb:33:inblock (2 levels) in listen'
/usr/share/ruby/2.0/webrick/server.rb:295:in call' /usr/share/ruby/2.0/webrick/server.rb:295:inblock in start_thread'

@dhollinger
Copy link
Member

@abragg Closing due to age. Please open a new issue is there are still issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants