Jira (PUP-10667) if pluginsync fails puppet should apply cached catalog

13 views
Skip to first unread message

Ciprian Badescu (Jira)

unread,
Sep 15, 2020, 5:12:03 AM9/15/20
to puppe...@googlegroups.com
Ciprian Badescu created an issue
 
Puppet / Bug PUP-10667
if pluginsync fails puppet should apply cached catalog
Issue Type: Bug Bug
Assignee: Unassigned
Created: 2020/09/15 2:11 AM
Priority: Normal Normal
Reporter: Ciprian Badescu

This ticket relates to https://tickets.puppetlabs.com/browse/PUP-1763 and https://tickets.puppetlabs.com/browse/PUP-10598

In the case we have ignore_plugin_errors==false and usecacheonfailure==true, puppet should apply cached catalog when pluginsync fails

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v8.5.2#805002-sha1:a66f935)
Atlassian logo

Ciprian Badescu (Jira)

unread,
Sep 15, 2020, 5:27:03 AM9/15/20
to puppe...@googlegroups.com
Ciprian Badescu commented on Bug PUP-10667
 
Re: if pluginsync fails puppet should apply cached catalog

Josh Cooper, while digging in the code to properly implement this (since basic implementation from https://github.com/puppetlabs/puppet/pull/8328/files will show to the user that the use of cached catalog was requested, due to https://github.com/puppetlabs/puppet/blob/84bf2d8607a6ac9ffde4a061d25016afc06165b5/lib/puppet/configurer.rb#L74), I think we open the door to problems similar to the initial ticket.

1. ignore_plugin_errors==true could lead to inconsistencies between modules and catalog, since we might have new catalog and old modules on the agent - problem solved with ignore_plugin_errors==false
2. ignore_plugin_errors==false and using cached catalog could lead to similar inconsistencies, since modules could be partly updated (downloaded failed on latest file) and cached catalog will be run.

Josh Cooper (Jira)

unread,
Sep 15, 2020, 12:30:04 PM9/15/20
to puppe...@googlegroups.com
Josh Cooper commented on Bug PUP-10667

About https://github.com/puppetlabs/puppet/blob/84bf2d8607a6ac9ffde4a061d25016afc06165b5/lib/puppet/configurer.rb#L74, the issue is we can't differentiate between the user wanted to used a cached catalog puppet agent --use_cached_catalog vs we're falling back to using the cached catalog. Can we modify the configurer so it uses Puppet[:use_cached_catalog] to determine what the initial intent was, while it uses a local variable to determine which mode we're currently in. And then if pluginsync fails, we change the local variable, but not Puppet[:use_cached_catalog]?

About the inconsistencies when ignore_plugin_errors==false due to partial downloads, yeah, we have that issue now (prior to the ignore_plugin_errors when falling back to cached catalog). For example, normal daemonized agent does pluginsync, fails and the failure is ignored, agent requests catalog, which fails and falls back to cached catalog, but plugins may not match. I think to fix this plugins need to be downloaded in an atomic way. One option is to create a secure directory with the same parent as Puppet[:libdir] and use it to pluginsync. To avoid downloading files we already have, you'd have to copy everything from Puppet[:libdir] to libnew. So maybe something like:

1. create lib.new using ruby equivalent of mktemp -d lib.new and restrict permissions so only the current user can write
2. Pluginsync to lib.new
3. Rename Puppet[:libdir] to lib.old
4. Rename lib.new to Puppet[:libdir]
5. Delete lib.old recursively

It's possible for puppet to crash/ctrl-c between any of those points. If it occurs between 3 and 4, then puppet will have lost all of its plugins. To account for that, if puppet starts and lib.old exists, but Puppet[:libdir] doesn't, then have recover its plugins by renaming lib.old to Puppet[:libdir].

If the crash occurs between 4 and 5, then the new plugins have been committed. So when puppet starts, if Puppet[:libdir] exists, have it delete the stale lib.old.

That said, I'm thinking we should file a separate ticket to ensure pluginsync is atomic (since there's always been an opportunity for inconsistent plugins when falling back to a cached catalog). Thoughts?

Mihai Buzgau (Jira)

unread,
Sep 16, 2020, 5:16:04 AM9/16/20
to puppe...@googlegroups.com

Mihai Buzgau (Jira)

unread,
Sep 16, 2020, 5:16:04 AM9/16/20
to puppe...@googlegroups.com

Mihai Buzgau (Jira)

unread,
Sep 16, 2020, 5:22:03 AM9/16/20
to puppe...@googlegroups.com

Ciprian Badescu (Jira)

unread,
Sep 16, 2020, 7:21:03 AM9/16/20
to puppe...@googlegroups.com

Ciprian Badescu (Jira)

unread,
Sep 16, 2020, 10:14:04 AM9/16/20
to puppe...@googlegroups.com

Luchian Nemes (Jira)

unread,
Oct 13, 2020, 11:26:04 AM10/13/20
to puppe...@googlegroups.com

Luchian Nemes (Jira)

unread,
Oct 13, 2020, 11:59:02 AM10/13/20
to puppe...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages