On Wednesday, April 29, 2015 at 9:20:37 AM UTC-5, Jacob W. wrote: > > Hi all, > > I'm trying to run some scripts provided by Red Hat to test for select > security vulnerabilities. They're as-is from Red Hat, excluding a minor > modification so I get emailed when it finds a vulnerable system (noted in > bold/highlighted). I can run the command from the script and it works fine, > and I can run the script by hand and it works fine. However, when I try > calling it from Puppet it fails with: > > Notice: /Stage[main]/patches_security::test_ghost/Exec[/tmp/ghost-test.sh > ]/returns: Error: Could not execute posix command: Exec format error - > /tmp/ghost-test.sh > Error: /Stage[main]/patches_security::test_ghost/Exec[/tmp/ghost-test.sh]: > Failed to call refresh: /tmp/ghost-test.sh returned 1 instead of one of [0 > ] > Error: /Stage[main]/patches_security::test_ghost/Exec[/tmp/ghost-test.sh]: > /tmp/ghost-test.sh returned 1 instead of one of [0] > >
Those messages say that you're getting the 'posix' provider for your Exec resource, and they suggest that your script is not recognized as having a valid format (per execve(2) and the related exec-family functions). But your script *does* appear to have a valid format, inasmuch as it starts with a shebang line that ought to be valid, and execve() handles that. Usually when a program succeeds when run directly but fails when run from Puppet, the problem is related to environment (variables) or security context. The agent does provide a very sparse environment to commands it Execs (and in particular, it looks like you may want to check that `HOSTNAME` is among them). If you need additional environment variables then you provide them via Exec's 'environment' parameter <https://docs.puppetlabs.com/references/3.4.stable/type.html#exec-attribute-environment> . The error message does not look like it indicates an environment issue, however. Although you shouldn't need to do so, I'm going to suggest you try to invoke bash explicitly: exec { '/bin/bash /tmp/ghost-test.sh': # ... OR try using the 'shell' provider: exec { '/tmp/ghost-test.sh': provider => 'shell', # ... Please let us know whether one or both of those solves your problem. John -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/c137a78d-bb4b-4975-b66d-994d4c637db1%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
