Skip to content

Commit 58172f9

Browse files
committed
fix idempotency for empty environment
1 parent 2f037fd commit 58172f9

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/puppet/provider/cron/crontab.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ def self.prefetch_hook(records)
221221
record[:unmanaged] = true
222222
end
223223
if envs.nil? || envs.empty?
224-
record[:environment] = :absent
224+
record[:environment] = []
225225
else
226226
# Collect all of the environment lines, and mark the records to be skipped,
227227
# since their data is included in our crontab record.

spec/acceptance/tests/resource/cron/should_be_idempotent_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@
1818
compatible_agents.each do |agent|
1919
it "ensures idempotency on #{agent}" do
2020
step 'Cron: basic - verify that it can be created'
21-
result = apply_manifest_on(agent, 'cron { "myjob": command => "/bin/true", user => "tstuser", hour => "*", minute => [1], ensure => present,}')
21+
result = apply_manifest_on(agent, 'cron { "myjob": command => "/bin/true", user => "tstuser", hour => "*", minute => [1], ensure => present, environment => [],}')
2222
expect(result.stdout).to match(%r{ensure: created})
2323

2424
result = run_cron_on(agent, :list, 'tstuser')
2525
expect(result.stdout).to match(%r{. . . . . .bin.true})
2626

2727
step 'Cron: basic - should not create again'
28-
result = apply_manifest_on(agent, 'cron { "myjob": command => "/bin/true", user => "tstuser", hour => "*", minute => [1], ensure => present,}')
28+
result = apply_manifest_on(agent, 'cron { "myjob": command => "/bin/true", user => "tstuser", hour => "*", minute => [1], ensure => present, environment => [],}')
2929
expect(result.stdout).not_to match(%r{ensure: created})
3030
end
3131
end

0 commit comments

Comments
 (0)