Details
-
Bug
-
Status: Resolved
-
Normal
-
Resolution: Fixed
-
PUP 3.8.4, PUP 4.5.0, PUP 4.8.0, PUP 4.8.2, PUP 4.10.4
-
None
-
Debian Testing (stretch) with Puppet 3.8.4
-
Night's Watch
-
3
-
NW - 2021-06-30, NW - 2021-07-14
-
Enhancement
-
Description
This issue was first reported here: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=809786
Hi,
the puppet type reference describes the "posix" provider of the "exec"
resource like this: [0]
posix
Executes external binaries directly, without passing through a shell or
performing any interpolation. This is a safer and more predictable way to
execute most commands, but prevents the use of globbing and shell built-ins
(including control logic like “for” and “if” statements).
However:
root@shepard:~# cat manifest.pp
|
$input = 'foo; if false; then exit 23; else exit 42; fi'
|
exec { "/bin/echo ${input}":
|
provider => 'posix',
|
}
|
root@shepard:~# puppet apply manifest.pp
|
Notice: Compiled catalog for shepard.kurtz.be in environment production in 0.04 seconds
|
Notice: /Stage[main]/Main/Exec[/bin/echo foo; if false; then exit 23; else exit 42; fi]/returns: foo
|
Error: /bin/echo foo; if false; then exit 23; else exit 42; fi returned 42 instead of one of [0]
|
Error: /Stage[main]/Main/Exec[/bin/echo foo; if false; then exit 23; else exit 42; fi]/returns: change from notrun to 0 failed: /bin/echo foo; if false; then exit 23; else exit 42; fi returned 42 instead of one of [0]
|
Notice: Finished catalog run in 0.08 seconds
|
root@shepard:~#
|
I'm not really sure what to make of this, but it seems... unexpected.
What do you guys think?
Best regards
Alexander Kurtz
[0] https://docs.puppetlabs.com/references/3.8.latest/type.html#exec-provider-posix