puppetlabs-toy-chest / puppetlabs-puppetserver_gem

This module provides management of Ruby gems for Puppet Server.
3 stars 24 forks source link

Provider pupppetserver_gem is not functional on this host #31

Closed optiz0r closed 5 years ago

optiz0r commented 5 years ago

Puppet runs are failing with:

Debug: Puppet::Type::Package::ProviderPuppetserver_gem: file  does not exist
Debug: Puppet::Type::Package::ProviderPuppetserver_gem: file  does not exist
Error: /Stage[main]/Site_puppet::Server/Package[puppetserver-hiera-eyaml-gpg]: Provider puppetserver_gem is not functional on this host
Error: /Stage[main]/Site_puppet::Server/Package[puppetserver-ruby_gpg]: Provider puppetserver_gem is not functional on this host

puppet resource fails when attempting to ensure an already installed gem is installed with:

# puppet resource package hiera-eyaml-gpg provider=puppetserver_gem ensure=present
Error: Could not prefetch package provider 'puppetserver_gem': no implicit conversion of Array into String
Error: Could not run: no implicit conversion of Array into String

With some quick printf debugging of the puppet core, I have the following stracktrace:

# puppet resource --codedir /data/puppet package hiera-eyaml-gpg provider=puppetserver_gem ensure=present
File being checked is: ["/opt/puppetlabs/bin/puppetserver", "gem"]
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/provider/package_targetable.rb:57:in `file?'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/provider/package_targetable.rb:57:in `validate_command'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/provider/package/gem.rb:52:in `execute_gem_command'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/provider/package/gem.rb:90:in `gemlist'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/provider/package/gem.rb:67:in `instances'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/provider/package_targetable.rb:31:in `block in prefetch'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/provider/package_targetable.rb:30:in `each'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/provider/package_targetable.rb:30:in `prefetch'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction.rb:364:in `prefetch'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction.rb:256:in `prefetch_if_necessary'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction.rb:111:in `block in evaluate'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/graph/relationship_graph.rb:119:in `traverse'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction.rb:174:in `evaluate'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/resource/catalog.rb:239:in `block (2 levels) in apply'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:518:in `block in thinmark'
/opt/puppetlabs/puppet/lib/ruby/2.5.0/benchmark.rb:308:in `realtime'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:517:in `thinmark'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/resource/catalog.rb:238:in `block in apply'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/log.rb:165:in `with_destination'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction/report.rb:146:in `as_logging_destination'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/resource/catalog.rb:237:in `apply'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/indirector/resource/ral.rb:40:in `save'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/indirector/indirection.rb:285:in `save'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application/resource.rb:221:in `find_or_save_resources'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application/resource.rb:142:in `block in main'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/context.rb:65:in `override'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet.rb:266:in `override'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application/resource.rb:137:in `main'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application.rb:390:in `run_command'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application.rb:382:in `block in run'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:684:in `exit_on_fail'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application.rb:382:in `run'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/command_line.rb:139:in `run'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/command_line.rb:77:in `execute'
/opt/puppetlabs/puppet/bin/puppet:5:in `<main>'
Error: Could not prefetch package provider 'puppetserver_gem': no implicit conversion of Array into String
Error: Could not run: no implicit conversion of Array into String

# ls -ld "/opt/puppetlabs/bin/puppetserver"
lrwxrwxrwx 1 root root 44 Jul 21 16:22 /opt/puppetlabs/bin/puppetserver -> ../server/apps/puppetserver/bin/puppetserver

Path being passed to File.file? is an array of arguments to be executed, not just the first argument which is the executable file on disk: ["/opt/puppetlabs/bin/puppetserver", "gem"] instead of /opt/puppetlabs/bin/puppetserver.

Gems installed:

# /opt/puppetlabs/bin/puppetserver gem list

*** LOCAL GEMS ***

cmath (default: 1.0.0)
csv (default: 1.0.0)
deep_merge (1.0.1)
fast_gettext (1.1.2)
fileutils (default: 1.1.0)
gettext (3.2.2)
hiera-eyaml (3.0.0)
hiera-eyaml-gpg (0.7.3)
highline (1.6.21)
hocon (1.2.5)
ipaddr (default: 1.2.0)
jar-dependencies (default: 0.3.12)
jruby-openssl (default: 0.10.0 java)
jruby-readline (default: 1.2.2 java)
json (default: 2.1.0 java)
locale (2.1.2)
multi_json (1.13.1)
optimist (3.0.0)
psych (default: 3.0.2 java)
puppet-resource_api (1.8.5)
puppetserver-ca (1.3.1)
rake-ant (default: 1.0.4)
rdoc (default: 6.0.1)
ruby_gpg (0.3.2)
scanf (default: 1.0.0)
semantic_puppet (1.0.2)
text (1.3.1)
webrick (default: 1.4.2)

OS version: CentOS 7.5.1804 Puppet agent 6.6.0 Puppetserver version 6.4.0 Puppetserver_gem version 1.1.1

optiz0r commented 5 years ago

False alarm. After a few hours I tracked down a conflicting old version of camptocamp-puppetserver module in the modulepath which was providing an incompatible copy of puppetserver_gem.rb which was taking precedence over the one provided by this puppetserver_gem module during pluginsync. Updating to the latest version of the puppetserver module (since moved to puppet-pupetserver in the voxpupuli github organisation) which uses this module as a dependency now rather than providing its own has fixed the issue. Apologies for the noise, and hopefully this report will help someone else with the same problem in future.