dgolja / golja-gnupg

Puppet module for managing GnuPG package and public keys
Apache License 2.0
13 stars 46 forks source link

Applying gnupg_key fails if an Agent-side directory environment is missing #15

Open mattock opened 8 years ago

mattock commented 8 years ago

Applying gnupg_key resources fail if the node running the agent is missing a directory environment matching the environment given in /etc/puppetlabs/puppet/puppet.conf (or on the command-line):

$ puppet agent --test
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Info: Caching catalog for server.domain.com
Info: Applying configuration version '1447410145'
Error: Could not find a directory environment named 'testing' anywhere in the path: /etc/puppetlabs/code/environments. Does the directory exist?
Error: /Stage[main]/Freight::Config::Gnupg/Gnupg_key[freight-public-key]/ensure: change from absent to present failed: Could not find a directory environment named 'testing' anywhere in the path: /etc/puppetlabs/code/environments. Does the directory exist?
Error: Could not find a directory environment named 'testing' anywhere in the path: /etc/puppetlabs/code/environments. Does the directory exist?
Error: /Stage[main]/Freight::Config::Gnupg/Gnupg_key[freight-private-key]/ensure: change from absent to present failed: Could not find a directory environment named 'testing' anywhere in the path: /etc/puppetlabs/code/environments. Does the directory exist?
Notice: Applied catalog in 0.36 seconds

This problem can be circumvented by creating the said directory environment on the node that runs the Puppe Agent:

$ mkdir /etc/puppetlabs/code/environments/testing
$ puppet agent --test
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Info: Caching catalog for server.domain.com
Info: Applying configuration version '1447410758'
Notice: /Stage[main]/Freight::Config::Gnupg/Gnupg_key[freight-public-key]/ensure: created
Notice: /Stage[main]/Freight::Config::Gnupg/Gnupg_key[freight-private-key]/ensure: created
Notice: Applied catalog in 0.43 seconds

This problem is reproducible on Puppet 4.2.3. I have not tested any of the earlier versions. On the puppetserver side the environment is correctly configured, and nothing suspicious shows up in /var/log/puppetlabs/puppetserver/puppetserver.log. So this failure occurs strictly on the agent side.

dgolja commented 8 years ago

Hey tnx for that. Officially this module does not support puppet 4.2.X, but I will definitely have a look and try to find a solution for that.

mrbanzai commented 7 years ago

I, too, am running into this issue (again, with Puppet 4). I'm guessing it has something to do with one of the lookups in the provider, but I'm sadly ignorant when it comes to the Puppet Ruby API. If I do manage to nail it down, I'll try to contribute a PR.

flhe commented 7 years ago

Same here. Ubuntu 16.04 and Puppet 4.X. Is the code still maintained in github ?

mattock commented 5 years ago

This problem still exists with Puppet 5.x and Ubuntu 18.04. With r10k and feature branches/environments this is pretty bad, because during development you won't be running the Puppet Agent in the production environment (the only environment which tends to exist even on Agent nodes).