You try to run a unit test in Puppet Development Kit by running PDK test unit
in the PDK Docker container as a non-root user. It fails with an unable to open analytics.yml
error.
Error messages
/opt/puppetlabs/pdk/private/ruby/2.5.9/lib/ruby/gems/2.5.0/gems/pdk-2.3.0/lib/pdk/config/namespace.rb:331:in `rescue in save_data': Unable to open /.config/ puppet/analytics.yml for writing (PDK::Config::LoadError)
Version and installation information
PDK version: 2.3.0
Installation type: Docker container image
Solution
PDK is designed to be run as the root user in a Docker container, so analytics.yml
is normally written to the root directory. To run it as a non-root user, set the HOME
variable as writable by UID 1000.
For example:
docker run -u 1000:1000 -e HOME=/project --workdir /project --rm -v $(pwd):/project puppet/pdk test unit
How can we improve this article?
0 comments
Please sign in to leave a comment.
Related articles