Unverified Commit ddc4d076 authored by Tim Smith's avatar Tim Smith Committed by GitHub
Browse files

Merge pull request #114 from mark-from-usds/fix-random-delay

Finish implementing the random_delay property
parents 9a05e426 94ff194a
......@@ -49,6 +49,7 @@ property :shell, [String, NilClass]
property :comment, [String, NilClass]
property :environment, Hash, default: {}
property :mode, [String, Integer], default: '0600'
property :random_delay, [Integer, NilClass]
def after_created
raise 'The cron_d resource requires Linux as it needs support for the cron.d directory functionality.' unless node['os'] == 'linux'
......@@ -106,6 +107,7 @@ action_class do
home: new_resource.home,
shell: new_resource.shell,
comment: new_resource.comment,
random_delay: new_resource.random_delay,
environment: new_resource.environment
)
action create_action
......
......@@ -102,6 +102,13 @@ cron_d 'job.with.periods' do
action :create_if_missing
end
cron_d 'with_random_delay' do
command '/bin/true'
user 'appuser'
action :create_if_missing
random_delay 60
end
cron_d 'test-weekday-usage-report2' do
name 'test-weekday-usage-report'
minute '1'
......
......@@ -31,6 +31,9 @@ end
describe file('/etc/cron.d/job-with-periods') do
it { should exist }
end
describe file('/etc/cron.d/with_random_delay') do
its(:content) { should match(/RANDOM_DELAY=60/) }
end
# we created this in the test recipe and the provider should clean it up
describe file('/etc/cron.d/job.with.periods') do
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment