Jira (PUP-10500) Puppet settings catalog requires codedir to be a directory

6 views
Skip to first unread message

Molly Waggett (Jira)

unread,
May 11, 2020, 4:25:04 PM5/11/20
to puppe...@googlegroups.com
Molly Waggett moved an issue
 
Puppet / Bug PUP-10500
Puppet settings catalog requires codedir to be a directory
Change By: Molly Waggett
Key: SERVER PUP - 2794 10500
Project: Puppet Server
Add Comment Add Comment
 
This message was sent by Atlassian Jira (v8.5.2#805002-sha1:a66f935)
Atlassian logo

Maggie Dreyer (Jira)

unread,
May 11, 2020, 7:43:04 PM5/11/20
to puppe...@googlegroups.com
Maggie Dreyer updated an issue
Change By: Maggie Dreyer
When file-sync is in {{versioned_deploys}} mode, we turn the target of Puppet's codedir setting into a symlink that points at the most recently-deployed version of the code. However, Puppet's internal settings catalog tries to ensure that {{codedir}} is a directory. When it finds a symlink instead, it errors, causing server startup to fail.
{code:java}

2020-05-06T16:27:25.444Z ERROR [clojure-agent-send-pool-0] [puppetserver] Puppet Could not set 'directory' on ensure: File exists - /etc/puppetlabs/code/latest
File exists - /etc/puppetlabs/code/latestorg/jruby/RubyDir.java:632:in `mkdir'/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/type/file/ensure.rb:93:in `block in set_directory'/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/property.rb:490:in `set'/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/property.rb:570:in `sync'/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/type/file/ensure.rb:189:in `sync'/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction/resource_harness.rb:241:in `sync'/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction/resource_harness.rb:136:in `sync_if_needed'/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction/resource_harness.rb:82:in `perform_changes'/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction/resource_harness.rb:21:in `evaluate'/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction.rb:267:in `apply'/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction.rb:287:in `eval_resource'org/jruby/RubyMethod.java:119:in `call'/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction.rb:191:in `block in evaluate'/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:521:in `block in thinmark'uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/benchmark.rb:308:in `realtime'/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:520:in `thinmark'/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction.rb:191:in `block in evaluate'/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/graph/relationship_graph.rb:122:in `traverse'/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction.rb:178:in `evaluate'/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/resource/catalog.rb:240:in `block in apply'/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:521:in `block in thinmark'uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/benchmark.rb:308:in `realtime'/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:520:in `thinmark'/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/resource/catalog.rb:239: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:238:in `apply'/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/settings.rb:1070:in `use'uri:classloader:/puppetserver-lib/puppet/server/puppet_config.rb:89:in `initialize_puppet'uri:classloader:/puppetserver-lib/puppet/server/master.rb:37:in `initialize'
{code}

Josh Cooper (Jira)

unread,
May 15, 2020, 8:23:03 PM5/15/20
to puppe...@googlegroups.com
Josh Cooper commented on Bug PUP-10500
 
Re: Puppet settings catalog requires codedir to be a directory

I think this may only be an issue if confdir is a dangling symlink or if the symlink points to a file. If I create a symlink pointing to a directory:

$ bx puppet apply -e "file { '$HOME/.puppetlabs/etc/puppet-target': ensure => directory }; file { '$HOME/.puppetlabs/etc/puppet-conf': ensure => link, target => '$HOME/.puppetlabs/etc/puppet-target' }"
...
$ ls -la ~/.puppetlabs/etc/puppet-conf
lrwxr-xr-x  1 josh  staff    41B May 15 13:21 /Users/josh/.puppetlabs/etc/puppet-conf@ -> /Users/josh/.puppetlabs/etc/puppet-target
$ ls -la ~/.puppetlabs/etc/puppet-conf/
total 0
drwxr-xr-x  2 josh  staff    64B May 15 13:20 ./
drwxr-xr-x  6 josh  staff   192B May 15 13:21 ../

Then puppet runs ok and resolves the confdir:

$ bx puppet apply -e 'notice($settings::confdir)' --confdir $HOME/.puppetlabs/etc/puppet-conf
Notice: Scope(Class[main]): /Users/josh/.puppetlabs/etc/puppet-conf

But if I delete the target of the symlink then it blows up:

$ rm -rf /Users/josh/.puppetlabs/etc/puppet-target
$ bx puppet apply -e "" --confdir $HOME/.puppetlabs/etc/puppet-conf
Error: Could not set 'directory' on ensure: File exists @ dir_s_mkdir - /Users/josh/.puppetlabs/etc/puppet-conf
...

I wouldn't expect puppet settings to try to recover from a dangling symlink, so I'd be fine closing this, unless there's some JRuby issue?

Molly Waggett (Jira)

unread,
May 18, 2020, 1:49:03 PM5/18/20
to puppe...@googlegroups.com

Now that CODEMGMT-1272 is resolved, I can no longer reproduce this issue.
Your analysis seems accurate, Josh Cooper.
Closing.

Reply all
Reply to author
Forward
0 new messages