crayfishx / hiera-gpg

GPG Backend to HIera
http://github.com/crayfishx/hiera-gpg
Other
101 stars 25 forks source link

undefined method `empty?' #15

Closed llowder closed 11 years ago

llowder commented 11 years ago

My hierarchy:


---
#This file is managed via puppet.
:hierarchy:
  - "%{node_id}"
  - common
:backends:
  - yaml
  - gpg
:yaml:
  :datadir: '/etc/puppet/hieradata'
:gpg:
  :datadir: /etc/puppet/hieradata
  :key_dir: /etc/puppet/gpgkeys

Whenever I have 'common.gpg' in my hieradata dir, I get the following on every puppet run:

Could not retrieve catalog from remote server: Error 400 on SERVER: undefined method `empty?' for #<Puppet::Util::Log:0x7f98a0295a28>

My master is on puppet 3.0.2, Ubuntu 12.04 LTS.

My nodes are a mix of 3.0.2 (test) and 2.7.x (prod), and a mix of Ubuntu 10.04 and 12.04.

I have hiera-gpg 1.1.0 installed via gems.

neoCrimeSecurity commented 11 years ago

Also, good to note when using hiera that you can give it two options:

return = hiera( key, default_value )

This way you can write your module to adapt for errors, or perhaps even use a default value when one is not set in hiera.

llowder commented 11 years ago

From the command line, I can pull values out of the gpg file. But when I do a puppet run, even if that node doesn't use anything from the gpg'd data store, I still get that error.

crayfishx commented 11 years ago

As @neoCrimeLabs said, make sure that you can read /etc/puppet/gpgkeys/secring.gpg from the user that you are running Puppet as..... can you call hiera from the command line as the puppet user succesfully?

llowder commented 11 years ago

If I do "sudo hiera test_key" I get the result I am expecting.

If I do "hiera test_key" as my normal account, I get 'nil'

if I do "sudo su puppet hiera test_key" (or using the www-data user, as I am using Apache+Passenger) I get:

/usr/local/bin/hiera: line 9: require: command not found
/usr/local/bin/hiera: line 11: version: command not found
/usr/local/bin/hiera: hiera: line 13: syntax error near unexpected token `('
/usr/local/bin/hiera: hiera: line 13: `if ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then'

(I get this same error regardless of if the .gpg is in place)

If there are no .gpg files in hieradata, then puppet runs complete normally

llowder commented 11 years ago

After running the master in debug, it turned out to be a problem with the keyring. I nuked and recreatedit, and now it is working as expected.

TomPoulton commented 11 years ago

I have this error as well, I can run "sudo hiera ..." and get the right value but puppet throws the empty error.

My keys are in the default location (/root/.gnupg/) and I'm pretty sure puppet master is running as root (it's puppet open source running through passenger and apache, and httpd is running as root). The permissions seem fine, I haven't played with them after gpg did it's thing.

Any ideas?