Details
-
Bug
-
Status: Closed
-
Normal
-
Resolution: Fixed
-
PUP 4.10.12, PUP 5.5.2, PUP 6.0.0
-
None
-
Coremunity
-
Platform Core KANBAN
-
Customer Feedback
-
Reviewed
-
33723
-
1
-
Bug Fix
-
Puppet will now log exceptions that happen during prefetch. Also exception handling in prefetch was fixed to the correct set of exceptions.
-
Needs Assessment
Description
While the puppet agent is applying a catalog, it will pre-fetch resource instances that share a common source. Such as packages from the same provider or cron jobs from the same crontab. Catalog application will abort with an error message if this prefetch operation fails. Often, these errors are terse, cryptic, and give no insight into which sort of resource type failed to fetch (cron job? package? SSH key?). In the case of types based on the ParsedFile provider, the prefetch code is shared among all types which means that the stack trace produced by --trace doesn't even help distinguish what type encountered the error.
Error messages should be clear about which type and provider failed so that users can proceed directly to debugging instead of puzzling out what happened.
Reproduction Case
- Install PE 2018.1.2 on CentOS 7.
- Configure site.pp in the production environment with a cron resource:
cat <<EOF > /etc/puppetlabs/code/environments/production/manifests/master_node.pp |
node '$(hostname -f)' { |
cron {'cron job to trigger prefetch': |
command => '/bin/true', |
user => 'root', |
hour => 1,
|
}
|
}
|
EOF
|
- Write garbage to root's crontab to trigger a parse failure:
printf '\0\0\0\0odelay' > /var/spool/cron/root |
- Run puppet agent -t
Outcome
The catalog fails to apply with a very terse, cryptic error message:
# puppet agent -t
|
Info: Using configured environment 'production'
|
Info: Retrieving pluginfacts
|
Info: Retrieving plugin
|
Info: Retrieving locales
|
Info: Loading facts
|
Info: Caching catalog for pe-201812-master.puppetdebug.vlan
|
Info: Applying configuration version '1530028114'
|
Error: Failed to apply catalog: Could not parse line "\u0000\u0000\u0000\u0000odelay" (file: root, line: 2)
|
Expected Outcome
Error message should include the type and provider name as is done when prefetch fails due to a LoadError or Puppet::MissingCommand error:
# puppet agent -t
|
Info: Using configured environment 'production'
|
Info: Retrieving pluginfacts
|
Info: Retrieving plugin
|
Info: Retrieving locales
|
Info: Loading facts
|
Info: Caching catalog for pe-201812-master.puppetdebug.vlan
|
Info: Applying configuration version '1530028653'
|
Error: Failed to apply catalog: Could not prefetch cron provider 'crontab': Could not parse line "\u0000\u0000\u0000\u0000odelay" (file: root, line: 2)
|
Attachments
Issue Links
- relates to
-
PUP-7630 "Successful" puppet agent reports hide provider errors
-
- Closed
-