Issue #14283 has been updated by Ben Hughes.
Manifest stolen from out of our repo:
<pre>
[root@mundilfari:~]# cat snapshots.pp
class zfs::snapshots {
$env = $operatingsystem ? {
'freebsd' => 'PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin',
'solaris' => undef,
'sunos' => undef,
default => undef,
}
cron {
'zfs hourly snapshot':
user => root,
minute => 5,
command => '/usr/local/bin/zfs-snapshot.rb -r -c 25 -s hourly',
environment => $env;
'zfs daily snapshot':
user => root,
minute => 10,
hour => 1,
command => '/usr/local/bin/zfs-snapshot.rb -r -c 8 -s daily',
environment => $env;
'zfs weekly snapshot':
user => root,
minute => 15,
hour => 2,
weekday => 0,
command => '/usr/local/bin/zfs-snapshot.rb -r -c 5 -s weekly',
environment => $env;
}
file {
'/usr/local/bin/zfs-snapshot.sh':
ensure => absent,
}
}
include zfs::snapshots
</pre>
And run it
<pre>
[root@mundilfari:~]# puppet apply -v snapshots.pp
info: Loading facts in /var/lib/puppet/lib/facter/whereami.rb
info: Loading facts in /var/lib/puppet/lib/facter/concat_basedir.rb
info: Loading facts in /var/lib/puppet/lib/facter/bacula.rb
info: Loading facts in /var/lib/puppet/lib/facter/printers.rb
info: Loading facts in /var/lib/puppet/lib/facter/haszfs.rb
info: Loading facts in /var/lib/puppet/lib/facter/puppet_vardir.rb
info: Loading facts in /var/lib/puppet/lib/facter/facter_dot_d.rb
info: Loading facts in /var/lib/puppet/lib/facter/certname.rb
info: Loading facts in /var/lib/puppet/lib/facter/root_home.rb
info: Loading facts in /var/lib/puppet/lib/facter/systemid.rb
info: Loading facts in /var/lib/puppet/lib/facter/confenv.rb
info: Loading facts in /var/lib/puppet/lib/facter/lastuser.rb
info: Applying configuration version '1340833290'
notice: /Stage[main]/Zfs::Snapshots/Cron[zfs weekly snapshot]/ensure: created
# HEADER: This file was autogenerated at Wed Jun 27 14:41:34 -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
# 42 * * * * /opt/csw/bin/puppet agent --onetime --no-daemonize >/dev/null
# Puppet Name: puppet agent
43 3 * * * [ -x /opt/csw/bin/gupdatedb ] && /opt/csw/bin/gupdatedb
--prunepaths="/dev /devices /proc /tmp /var/tmp" 1>/dev/null 2>&1 # Added by
CSWfindutils
# Puppet Name: zfs weekly snapshot
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
# HEADER: This file was autogenerated at Wed Jun 27 14:41:35 -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
# 42 * * * * /opt/csw/bin/puppet agent --onetime --no-daemonize >/dev/null
# Puppet Name: puppet agent
43 3 * * * [ -x /opt/csw/bin/gupdatedb ] && /opt/csw/bin/gupdatedb
--prunepaths="/dev /devices /proc /tmp /var/tmp" 1>/dev/null 2>&1 # Added by
CSWfindutils
# Puppet Name: zfs weekly snapshot
15 2 * * 0 /usr/local/bin/zfs-snapshot.rb -r -c 5 -s weekly
# Puppet Name: zfs hourly snapshot
5 * * * * /usr/local/bin/zfs-snapshot.rb -r -c 25 -s hourly
notice: /Stage[main]/Zfs::Snapshots/Cron[zfs daily snapshot]/ensure: created
# HEADER: This file was autogenerated at Wed Jun 27 14:41:35 -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
# 42 * * * * /opt/csw/bin/puppet agent --onetime --no-daemonize >/dev/null
# Puppet Name: puppet agent
43 3 * * * [ -x /opt/csw/bin/gupdatedb ] && /opt/csw/bin/gupdatedb
--prunepaths="/dev /devices /proc /tmp /var/tmp" 1>/dev/null 2>&1 # Added by
CSWfindutils
# Puppet Name: zfs weekly snapshot
15 2 * * 0 /usr/local/bin/zfs-snapshot.rb -r -c 5 -s weekly
# Puppet Name: zfs hourly snapshot
5 * * * * /usr/local/bin/zfs-snapshot.rb -r -c 25 -s hourly
# Puppet Name: zfs daily snapshot
10 1 * * * /usr/local/bin/zfs-snapshot.rb -r -c 8 -s daily
notice: Finished catalog run in 2.43 seconds
</pre>
And lo and behold:
<pre>
[root@mundilfari:~]# crontab -l
# HEADER: This file was autogenerated at Wed Jun 27 14:41:35 -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
# 42 * * * * /opt/csw/bin/puppet agent --onetime --no-daemonize >/dev/null
# Puppet Name: puppet agent
43 3 * * * [ -x /opt/csw/bin/gupdatedb ] && /opt/csw/bin/gupdatedb
--prunepaths="/dev /devices /proc /tmp /var/tmp" 1>/dev/null 2>&1 # Added by
CSWfindutils
# Puppet Name: zfs weekly snapshot
15 2 * * 0 /usr/local/bin/zfs-snapshot.rb -r -c 5 -s weekly
# Puppet Name: zfs hourly snapshot
5 * * * * /usr/local/bin/zfs-snapshot.rb -r -c 25 -s hourly
# Puppet Name: zfs daily snapshot
10 1 * * * /usr/local/bin/zfs-snapshot.rb -r -c 8 -s daily
</pre>
----------------------------------------
Bug #14283: Solaris 11 cron provider oddities
https://projects.puppetlabs.com/issues/14283#change-65872
Author: Ben Hughes
Status: In Topic Branch Pending Review
Priority: Normal
Assignee:
Category: cron
Target version:
Affected Puppet version:
Keywords: solaris cron
Branch: https://github.com/puppetlabs/puppet/pull/830
# 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.