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

Also issues with undefined method `empty? #24

Open
berndmweber opened this issue May 8, 2013 · 1 comment
Open

Also issues with undefined method `empty? #24

berndmweber opened this issue May 8, 2013 · 1 comment

Comments

@berndmweber
Copy link

Hey,

Don't seem to be able to get this to work. I read the earlier bug report but that didn't seem to solve my problems.
I changed the owner of /etc/puppet/gpgdata to puppet and made sure the permissions are 750 on the directory and 640 on all files inside.
When I execute hiera -d -c hiera.yaml mysql:server:root_passwd either as root or puppet I get the correct value back:

/etc/puppet$ sudo hiera -d -c hiera.yaml mysql:server:root_passwd
DEBUG: Wed May 08 21:34:11 +0000 2013: Hiera YAML backend starting
DEBUG: Wed May 08 21:34:11 +0000 2013: Looking up mysql:server:root_passwd in YAML backend
DEBUG: Wed May 08 21:34:11 +0000 2013: Looking for data source passwords
DEBUG: Wed May 08 21:34:11 +0000 2013: Data retrieved from /etc/puppet/hieradata/passwords.yaml is not a Hash, setting defaults
DEBUG: Wed May 08 21:34:11 +0000 2013: Looking for data source common
DEBUG: Wed May 08 21:34:11 +0000 2013: Data retrieved from /etc/puppet/hieradata/common.yaml is not a Hash, setting defaults
DEBUG: Wed May 08 21:34:11 +0000 2013: [gpg_backend]: Loaded gpg_backend
DEBUG: Wed May 08 21:34:11 +0000 2013: [gpg_backend]: Lookup called, key mysql:server:root_passwd resolution type is priority
DEBUG: Wed May 08 21:34:11 +0000 2013: [gpg_backend]: GNUPGHOME is /etc/puppet/gpgdata
DEBUG: Wed May 08 21:34:11 +0000 2013: [gpg_backend]: loaded cipher: /etc/puppet/hieradata/gpgdata/passwords.gpg
DEBUG: Wed May 08 21:34:11 +0000 2013: [gpg_backend]: result is a String ctx #<GPGME::Ctx:0x7fbe72436df8> txt ---
mysql:server:root_passwd: jona123
DEBUG: Wed May 08 21:34:11 +0000 2013: [gpg_backend]: GPG decrypt returned valid data
DEBUG: Wed May 08 21:34:11 +0000 2013: [gpg_backend]: Data contains valid YAML
DEBUG: Wed May 08 21:34:11 +0000 2013: [gpg_backend]: Key mysql:server:root_passwd found in YAML document, Passing answer to hiera
DEBUG: Wed May 08 21:34:11 +0000 2013: [gpg_backend]: Assigning answer variable
jona123

Whenever I try to run this through the puppet agent it fails:

...
Info: Loading facts in /var/lib/puppet/lib/facter/pe_version.rb
Debug: catalog supports formats: b64_zlib_yaml dot pson raw yaml; using pson
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Puppet::Parser::AST::Resource failed with error NoMethodError: undefined method `empty?' for #<Puppet::Util::Log:0x7fefea8fe558> at /etc/puppet/manifests/site.pp:18 on node ip-10-250-6-39.us-west-2.compute.internal
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run
Debug: Value of 'preferred_serialization_format' (pson) is invalid for report, using default (b64_zlib_yaml)
Debug: report supports formats: b64_zlib_yaml raw yaml; using b64_zlib_yaml

I'm wondering if I'm even installing this correctly. I used gem install hiera-gpg. I can see it and the hiera gem fine in the /var/lig/gems directory. But I'm suspecting that puppet is using it's own hiera version in /usr/lib/ruby/vendor_ruby ?! Which would explain the issues I'm seeing.

Some more information:
hiera.yaml:


---
:backends:
  - yaml
  - gpg

:logger: console

:hierarchy:
  - passwords
  - "%{operatingsystem}"
  - common

:yaml:
  :datadir: /etc/puppet/hieradata

:gpg:
  :datadir: /etc/puppet/hieradata/gpgdata
  :key_dir: /etc/puppet/gpgdata

The call to hiera is in manifests/site.pp:

...
node /testmachine.local/ {
  class { 'apache' : }
  class { 'ruby' : }
  class { 'passenger' : }
  class { 'puppet::master::apache' : }
  class { 'mysql' : }
  class { 'mysql::ruby' : }
  class { 'mysql::server' :
    config_hash => { 'root_password' => hiera( 'mysql:server:root_passwd' ) }
  }
  mysql::server::config { 'basic_config' :
    settings => {
      'mysqld' => {
        'default_storage_engine' => 'InnoDB',
      }
    }
  }
}

All my setup can be found here: https://github.com/berndmweber/open-source-puppet-master/tree/master/modules/puppet

Any feedback is appreciated!

@codylane
Copy link

Check your permissions on /etc/puppet/gpgdata and ensure the owner and group match the user that is running the puppet server.

In my case I am running the puppet master as the puppet user so I needed to do the following.

chown -R puppet:root /etc/puppet/keyrings
chmod 0770 /etc/puppet/keyrings

This worked for me and I was having the very same issues as you described above. Hope this helps.

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