-
-
Save MikaelSmith/024807c1fdb1296a7118a559059d0c6d to your computer and use it in GitHub Desktop.
deferred issue
This file contains 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
notify { "hello ${Deferred('pid', [])}": } | |
notify { "hello ${pid()}": } | |
file { '/tmp/foo': | |
ensure => file, | |
content => Deferred('pid', []), | |
} |
This file contains 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
Puppet::Functions.create_function(:pid) do | |
def pid | |
Process.pid.to_s | |
end | |
end |
If you do it like this, it should work
notify { 'hello notify':
message => "hello ${Deferred('pid', [])}",
}
Still an issue even with that change.
You cannot have Deferred inside of an interpolation and expect that to be resolved on the agent. You need to send the string and the arguments and do a Deferred sprintf
or similar.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Put
pid.rb
atfoo/lib/puppet/functions/pid.rb
. Then run