opscode/chef — pull request #2107 by sax (2014-09-23 16:19:47+00:00)
Title: Reading crontab of non-root unix user should read as that user

Crontab on Solaris and Illumos systems with auditing enabled audits root attempts to read non-root user crontabs. If chef-client runs without an auditing context (as happens by default when running in SMF), these crontab calls will fails with exit status 1.

By switching to the non-root user first (which somehow does not require auditing), we should be able to read user crontabs without an auditing context.

Note that I'm doing some jank at the end to ensure the existing crontab has a trailing newline. I'm open to suggestions if there's a less janky and preferred alternative.