I'm Applying a local manifest to test an exec and file resource:
class test_file {
exec { "touch /tmp/testfile":
path => ["/bin", "/usr/bin", "/sbin", "/usr/sbin"],
unless => "test -d /tmp 2>/dev/null",
}
file { "/tmp/success":
mode => "0777",
owner => "root",
group => "staff",
source => "file:///Users/Shared/success",
require => Exec["touch /tmp/testfile"],
}
}
**What I expect to happen:**
the exec runs and exits because the unless statement returns 0, so the file resource never runs. so neither file is created in /tmp
**What Actually happens:**
The file resource always runs, and copies the "success" file to /tmp
I've run this on macOS 10.11 and 10.12 with both puppet agent 4.10 and 5.3.2 ... with the same results. I'm simply trying to run a conditional that says don't copy a file if some command exits successful. Any insights or directions would be appreciate.
↧