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

5752 rescue parsedfile prefetch errors #1533

Merged
merged 3 commits into from
Mar 18, 2013
Merged

5752 rescue parsedfile prefetch errors #1533

merged 3 commits into from
Mar 18, 2013

Conversation

adrienthebo
Copy link
Contributor

This is a fixup of GH-1100.

If a read error occurs while the parsedfile provider is prefetching targets, it will propagate that error up to the transaction and will not prefetch any more records. This has the side effect of wiping out all unmanaged resources that haven't been prefetched. This set of commits explicitly handles read errors in the parsedfile provider to rescue read errors and try to prefetch as many targets as possible.

stschulte and others added 3 commits March 13, 2013 17:07
The parsedfile provider can handle multiple targets (multiple files,
multiple crontabs, etc) but the provider does not handle the case when
retrieving a target during prefetch fails. When the provider does only
handle one target this doesn't really matter because a possible error is
caught at a higher level (inside Puppet::Transaction). But if the
provider handles multiple targets, one error will cause the whole
prefetching method to fail and all targets are treated as empty.

One example of the issue is described in #5752: Multiple crontabs are
manages with crontab resources and one cronresource describes a
cronentry of an absent user. Because prefetching the crontab of the
absent user fails, the crontab of *all* users are purged and every
crontab entry which is not managed by puppet is lost.

The change now handles the error inside the parsedfile provider itself,
so only the target that is causing troubles is treated as empty.
The current behavior of read errors in file types is to raise a generic
error, which is difficult to rescue without rescuing everything. This
commit adds a new exception subclass that can be explicitly rescued
without rescuing every other error.
Without this commit the parsedfile provider will rescue any error
generated from filetypes, regardless of if it's something that can be
handled. This commit explicitly rescues errors generated when read
errors occur so that errors that can't be handled are correctly
propagated.
@jeffmccune
Copy link
Contributor

Looks good to me, 👍

adrienthebo added a commit that referenced this pull request Mar 18, 2013
…etch_errors

5752 rescue parsedfile prefetch errors
@adrienthebo adrienthebo merged commit 2ac1b27 into puppetlabs:master Mar 18, 2013
@adrienthebo adrienthebo deleted the 5752-rescue_parsedfile_prefetch_errors branch March 18, 2013 17:39
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

Successfully merging this pull request may close these issues.

3 participants