Bug #10388
Recursive File audit does not appear to work.
| Status: | Accepted | Start date: | 10/31/2011 | |
|---|---|---|---|---|
| Priority: | High | Due date: | ||
| Assignee: | % Done: | 0% |
||
| Category: | - | |||
| Target version: | 2.7.x | |||
| Affected Puppet version: | 2.6.5 | Branch: | ||
| Keywords: | ||||
| Votes: | 1 |
Description
With the following code:
file { '/root/test':
audit => 'checksum',
owner => 'root',
group => 'root',
mode => '644',
recurse => 'true',
checksum => 'md5',
notify => Exec['foo']
}
exec { 'foo':
command => '/bin/echo "bar"',
refreshonly => 'true',
logoutput => 'true'
}
Adding a file under /root/test causes the following error with ‘puppet apply’
otice: /File[/root/test/blah]/mode: mode changed '600' to '644' err: /File[/root/test/blah]: Could not evaluate: undefined method `notice' for nil:NilClass notice: /Stage[main]//Exec[foo]: Dependency File[/root/test/blah] has failures: true warning: /Stage[main]//Exec[foo]: Skipping because of failed dependencies
Changing a file under /root/test has absolutely no effect and does not fire off Exec[foo] (which it should).
History
Updated by Trevor Vaughan 7 months ago
Changing audit to ‘all’ does record the audit values for the sub-files but does not fire the exec when a sub-file is changed. Nor does puppet appear to record the changed checksum of the subfile once the content is changed.
Updated by Josh Cooper 7 months ago
- Status changed from Unreviewed to Investigating
- Affected Puppet version changed from 2.7.6 to 2.6.5
This was first broken in 2.6.5 in commit 7fff7808e25491a5ea1e207b8de3ade0c4f95f4f for issue #5408
I’m using a slightly different manifest, that doesn’t require root:
file { '/Users/josh/tmp/test':
audit => 'checksum',
owner => 'josh',
group => 'staff',
mode => '644',
recurse => 'true',
checksum => 'md5',
notify => Exec['foo']
}
exec { 'foo':
command => '/bin/echo "bar"',
refreshonly => 'true',
logoutput => 'true'
}
In 2.6.4, I get:
debug: /Stage[main]//File[/Users/josh/tmp/test]/notify: subscribes to Exec[foo] info: Applying configuration version '1320097198' debug: Finishing transaction 2165797600 ... info: Creating state file /Users/josh/.puppet/var/state/state.yaml
In 2.6.5 and up, I get:
err: /Stage[main]//File[/Users/josh/tmp/test]: Could not evaluate: undefined method `notice' for nil:NilClass notice: /Stage[main]//Exec[foo]: Dependency File[/Users/josh/tmp/test] has failures: true warning: /Stage[main]//Exec[foo]: Skipping because of failed dependencies info: Creating state file /Users/josh/.puppet/var/state/state.yaml
This is the line that is causing the problem (resource.property(:checksum) is returning nil
resource.property(param_name).notice "audit change: newly-recorded value #{current_values[param_name]}"
In order to reproduce, make sure to delete your .puppet directory between runs, otherwise it will pickup the historical value from before and not trigger this code path.
Updated by Nigel Kersten 4 months ago
- Status changed from Investigating to Accepted
- Assignee set to Jason McKerr
- Target version set to 2.7.x