| Let resource A be a dependency of resource B Let resource A be no-op Problem Puppet will always consider B's dependency to be satisfied, even if resource A is detected to be out-of-sync. Resource A is in no-op mode so it cannot "fail". Puppet will never skip resource B due to a dependency failure. However, resource A is out-of-sync, and is known to be in an incorrect state. Logically, this should cause resource B to be skipped, just as it would be if resource A were to be marked out-of-sync due to a sync failure. Depending on your dependency chains this behavior can cause problems, when Puppet cannot successfully configure resource B unless or until resource A is in-sync. Example Manifest
file { 'dependency': |
path => '/tmp/never-create-me', |
ensure => present, |
noop => true, |
} |
|
notify { 'reliant': |
message => 'I rely on dependency being in-sync to operate correctly', |
require => File['dependency'], |
} |
Behavior Today Output of puppet apply:
Notice: Compiled catalog for reids-macbook-pro.local in environment production in 0.03 seconds |
Notice: /Stage[main]/Main/File[dependency]/ensure: current_value 'absent', should be 'present' (noop) |
Notice: I rely on dependency being in-sync to operate correctly |
Notice: /Stage[main]/Main/Notify[reliant]/message: defined 'message' as 'I rely on dependency being in-sync to operate correctly' |
Notice: Applied catalog in 0.02 seconds |
Notice how a dependency of Notify[reliant] is out-of-sync, but Puppet will still attempt to sync Notify[reliant]. Desired Behavior What the output of puppet apply should be:
Notice: Compiled catalog for reids-macbook-pro.local in environment production in 0.03 seconds Notice: /Stage[main]/Main/File[dependency]/ensure: current_value 'absent', should be 'present' (noop) |
Notice: /Stage[main]/Main/Notify[reliant]: Dependency File[dependency] in sync: false |
Warning: /Stage[main]/Main/Notify[reliant]: Skipping because of out of sync dependencies |
Considerations While it is desirable to expect that an out-of-sync dependency will cause resources that rely on it to be skipped, this behaviour would need to be feature flagged as it is a different behavior than what we have today. This likely hasn't caused wider confusion mostly because no-op is frequently an all-or-nothing operation; it's less common to no-op some resources and not others, though doing so is highly sought after by many Puppet-as-a-Service customers and is made easier to do using patterns and modules like the popular trlinkin-noop. Maybe something like... resource_dependency_requirement?
[main] |
resource_dependency_requirement = none_failed |
resource_dependency_requirement = in_sync
|
|