Issue #14283 has been updated by Josh Cooper.

Status changed from Needs More Information to In Topic Branch Pending Review
Assignee changed from Stefan Schulte to Josh Cooper
Branch changed from https://github.com/puppetlabs/puppet/pull/830 to 
https://github.com/puppetlabs/puppet/pull/1025

>From Stephan:

@joshcooper I cannot say anything about aix but I checked Solaris at $WORK 
today and `"can't open your crontab"` does indeed return with a non zero 
exitcode. But I think we should move the

`return "" if output.include?("can't open your crontab")`

in the ensure block because "can't open your crontab" is raised when "the user 
can access the crontab command but no crontab file exists" 
<http://docs.oracle.com/cd/E19082-01/819-2380/sysrescron-60/index.html> so the 
user should not see a prefetching failed message in this case I guess.
----------------------------------------
Bug #14283: Solaris 11 cron provider oddities
https://projects.puppetlabs.com/issues/14283#change-68937

Author: Ben Hughes
Status: In Topic Branch Pending Review
Priority: Normal
Assignee: Josh Cooper
Category: cron
Target version: 2.7.x
Affected Puppet version: 
Keywords: solaris cron
Branch: https://github.com/puppetlabs/puppet/pull/1025


# Overview #

Solaris 11/Sparc with Puppet 2.7.14ish 
(a47c42d6b9c7ed6022b0e7d37505b0c694a5b8d2).

The Cron provider doesn't appear to actually provide multiple crons..

# Expected Behaviour #

Crontab contains all the correct cron entries from say:

<pre>
  cron{ 'zfs_scrubber':
    command     => 'for x in $( zpool list -H | cut -f 1 ); do zpool scrub 
"${x}" ; done',
    user        => 'root',
    environment => 'PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin',
    hour        => '3',
    minute      => '33',
    weekday     => '6',
  }
</pre>


# Actual Behaviour #

<pre>
[root@mundilfari:/var]# crontab -l root 
# HEADER: This file was autogenerated at Wed Apr 25 19:10:12 -0700 2012 by 
puppet.
# HEADER: While it can still be managed manually, it is definitely not 
recommended.
# HEADER: Note particularly that the comments starting with 'Puppet Name' should
# HEADER: not be deleted, as doing so could cause duplicate cron jobs.
#ident  "%Z%%M% %I%     %E% SMI"
#
# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#
# The root crontab should be used to perform accounting data collection.
#
#
10 3 * * * /usr/sbin/logadm
15 3 * * 0 [ -x /usr/lib/fs/nfs/nfsfind ] && /usr/lib/fs/nfs/nfsfind
30 3 * * * [ -x /usr/lib/gss/gsscred_clean ] && /usr/lib/gss/gsscred_clean
# Puppet Name: puppet agent
42 * * * * /opt/csw/bin/puppet agent --onetime --no-daemonize >/dev/null
</pre>

Now I run puppet on said host:

<pre>
[root@mundilfari:/var]# time puppet agent -t --environment solarisnagios
info: Retrieving plugin
info: Loading facts in /var/lib/puppet/lib/facter/concat_basedir.rb
info: Caching catalog for mundilfari.example.org
info: Applying configuration version '460d9de'
notice: /Stage[main]/Zfs::Scrubber/Cron[zfs_scrubber]/ensure: created
# HEADER: This file was autogenerated at Wed May 02 13:36:28 -0700 2012 by 
puppet.
# HEADER: While it can still be managed manually, it is definitely not 
recommended.
# HEADER: Note particularly that the comments starting with 'Puppet Name' should
# HEADER: not be deleted, as doing so could cause duplicate cron jobs.
#ident  "%Z%%M% %I%     %E% SMI"
#
# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#
# The root crontab should be used to perform accounting data collection.
#
#
10 3 * * * /usr/sbin/logadm
15 3 * * 0 [ -x /usr/lib/fs/nfs/nfsfind ] && /usr/lib/fs/nfs/nfsfind
30 3 * * * [ -x /usr/lib/gss/gsscred_clean ] && /usr/lib/gss/gsscred_clean
# Puppet Name: puppet agent
42 * * * * /opt/csw/bin/puppet agent --onetime --no-daemonize >/dev/null
# Puppet Name: zfs_scrubber
PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
33 3 * * 6 for x in $( zpool list -H | cut -f 1 ); do zpool scrub "${x}" ; done
notice: It is highly recommended that you set 'wgetopts=-nv' in your 
pkgutil.conf.
notice: /Stage[main]/Zfs::Snapshots/Cron[zfs weekly snapshot]/ensure: created
# HEADER: This file was autogenerated at Wed May 02 13:36:57 -0700 2012 by 
puppet.
# HEADER: While it can still be managed manually, it is definitely not 
recommended.
# HEADER: Note particularly that the comments starting with 'Puppet Name' should
# HEADER: not be deleted, as doing so could cause duplicate cron jobs.
#ident  "%Z%%M% %I%     %E% SMI"
#
# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#
# The root crontab should be used to perform accounting data collection.
#
#
10 3 * * * /usr/sbin/logadm
15 3 * * 0 [ -x /usr/lib/fs/nfs/nfsfind ] && /usr/lib/fs/nfs/nfsfind
30 3 * * * [ -x /usr/lib/gss/gsscred_clean ] && /usr/lib/gss/gsscred_clean
# Puppet Name: puppet agent
42 * * * * /opt/csw/bin/puppet agent --onetime --no-daemonize >/dev/null
# Puppet Name: zfs_scrubber
PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
33 3 * * 6 for x in $( zpool list -H | cut -f 1 ); do zpool scrub "${x}" ; done
# Puppet Name: zfs weekly snapshot
PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin
15 2 * * 0 /usr/local/bin/zfs-snapshot.rb -r -c 5 -s weekly
notice: /Stage[main]/Zfs::Snapshots/Cron[zfs hourly snapshot]/ensure: created
notice: Finished catalog run in 97.97 seconds
</pre>

I actually snipped a few there, as it was getting lengthy...

But now we run crontab -l root and get...

<pre>
[root@mundilfari:/var]# crontab -l root 
# HEADER: This file was autogenerated at Wed Apr 25 19:10:12 -0700 2012 by 
puppet.
# HEADER: While it can still be managed manually, it is definitely not 
recommended.
# HEADER: Note particularly that the comments starting with 'Puppet Name' should
# HEADER: not be deleted, as doing so could cause duplicate cron jobs.
#ident  "%Z%%M% %I%     %E% SMI"
#
# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#
# The root crontab should be used to perform accounting data collection.
#
#
10 3 * * * /usr/sbin/logadm
15 3 * * 0 [ -x /usr/lib/fs/nfs/nfsfind ] && /usr/lib/fs/nfs/nfsfind
30 3 * * * [ -x /usr/lib/gss/gsscred_clean ] && /usr/lib/gss/gsscred_clean
# Puppet Name: puppet agent
42 * * * * /opt/csw/bin/puppet agent --onetime --no-daemonize >/dev/null
</pre>

So where did they go?!

# Detail #

So the cronjob, at least as far as my Solaris-fu is concerned, doesn't appear 
to exist.

<pre>
[root@mundilfari:~]# gfind /etc /var -xdev -type f -print0 | xargs -0 ggrep -il 
zfs_scrubber  
/var/lib/puppet/client_yaml/catalog/mundilfari.dc1.puppetlabs.net.yaml
/var/lib/puppet/state/resources.txt
/var/lib/puppet/state/state.yaml
/var/lib/puppet/state/last_run_report.yaml
/var/adm/messages
/var/adm/messages.0
</pre>

# Work Around #

Not use Solaris.



-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.

Reply via email to