HomePhorge

(#14283) Fix suntab filetype when run as normal user
4cd6686be486Unpublished

Unpublished Commit ยท Learn More

Repository Importing: This repository is still importing.

Description

(#14283) Fix suntab filetype when run as normal user

Running puppet as an unpriviledged user to manage its own crontab caused
two problems under solaris:

The uid argument was passed to the execute method to set the correct uid
before executing the crontab command. The execute method has a default
argumenthash with the key :failonfail set to true. Because the suntab
filetype passed it's own hash, failonfail was nil so if crontab
completes with a non-zero exit code no error will be raised.

This is bad because running execute with :uid not only sets the correct
userid in the child process but also tries to run Process.initgroups
to set the correct supplementary groups of that user. This call will most
likely fail as a non priviledged user causing the whole child process to fail.

The fix now makes sure that failonfail is passed to the execute method
so failures can be handled correctly and uid is only passed if necessary
(which is not the case when the target user in the crontab resource is
the same user that is running puppet).

Since the execute method now raises an exception on non-zero exit
codes, we have to handle the case where the crontab file doesn't exist
for the user (and return '') versus other fatal errors.

Details

Provenance
Stefan Schulte <stefan.schulte@taunusstein.net>Authored on
Josh Cooper <josh@puppetlabs.com>Committed on Aug 10 2012, 12:40 AM
vanmeeuwenPushed on Jun 2 2015, 2:22 PM
Parents
rPUd2b4f089f324: maint: Refactor suntab and aixtab filetype
Branches
Unknown
Tags
Unknown

Event Timeline

Josh Cooper <josh@puppetlabs.com> committed rPU4cd6686be486: (#14283) Fix suntab filetype when run as normal user (authored by Stefan Schulte <stefan.schulte@taunusstein.net>).Aug 10 2012, 12:40 AM