Created
January 4, 2012 18:28
-
-
Save gmcinnes/1561356 to your computer and use it in GitHub Desktop.
default_unless broken example?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # /backups/attributes/client.rb | |
| # Jankily set a random time between midnight and 6am | |
| hours = rand(6) | |
| minutes = rand(59) | |
| minutes = "0#{minutes}" if minutes < 10 | |
| random_time = "0#{hours}:#{minutes}" | |
| default_unless['backups']['start_time'] = "everyday at #{random_time}" | |
| default['backups']['extra_includes'] = [] | |
| default['backups']['extra_excludes'] = [] | |
| default['backups']['external_backup_user'] = 'external-backup' | |
| default['backups']['external_backup_host'] = 'backups.marsdd.com' | |
| default['backups']['external_backup_directory'] = "/var/external-backup/backups/#{node['ipaddress']}/" | |
| # I expect the default_unless statement above to only set a new random time if there isn't already a | |
| # key value pair for node['backups']['start_time']. It seems to reset it on every chef run instead | |
| # /backups/recipies/client.rb | |
| template "/etc/backup.d/90.rdiff" do | |
| source "backup.d/90.rdiff.erb" | |
| owner "root" | |
| group "root" | |
| mode "0600" | |
| variables :extra_includes => node['backups']['extra_includes'], | |
| :extra_excludes => node['backups']['extra_excludes'], | |
| :external_backup_user => node['backups']['external_backup_user'], | |
| :external_backup_host => node['backups']['external_backup_host'], | |
| :external_backup_directory => node['backups']['external_backup_directory'] | |
| end | |
| # Relevant debug output | |
| [Wed, 04 Jan 2012 12:12:06 -0500] DEBUG: Processing template[/etc/backupninja.conf] on varnish1.comms.marsdd.com | |
| [Wed, 04 Jan 2012 12:12:06 -0500] INFO: Processing template[/etc/backupninja.conf] action create (backups::client line 32) | |
| [Wed, 04 Jan 2012 12:12:06 -0500] DEBUG: Not storing cookbooks/backups/templates/default/backupninja.conf.erb, as the cache is up to date. | |
| [Wed, 04 Jan 2012 12:12:06 -0500] DEBUG: Current content's checksum: 5ed8826f65ee9976e739f96bf2af57060ae8d8c547b50cc2471165ad4612189e | |
| [Wed, 04 Jan 2012 12:12:06 -0500] DEBUG: Rendered content's checksum: 0903da725324a76d27b157c31793e45262b21f7448e4833450de2119176be020 | |
| [Wed, 04 Jan 2012 12:12:06 -0500] INFO: template[/etc/backupninja.conf] backed up to /var/lib/chef/etc/backupninja.conf.chef-20120104121206 | |
| [Wed, 04 Jan 2012 12:12:06 -0500] INFO: template[/etc/backupninja.conf] removed backup at /var/lib/chef/./etc/backupninja.conf.chef-20120104115536 | |
| [Wed, 04 Jan 2012 12:12:06 -0500] INFO: template[/etc/backupninja.conf] mode changed to 644 | |
| [Wed, 04 Jan 2012 12:12:06 -0500] INFO: template[/etc/backupninja.conf] updated content |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment