On 10/31/2014 11:35 AM, JonY wrote:
> I've simplified the script to this:
>
> #!/usr/local/bin/ruby
>
> open('test.out', 'w') { |f|
> f.puts "Hello"
> }
Well, writing to a relative file path is bound to be potentially
problematic.
> .. and it still gives me 'error 1' when run as an ENC.
No, it states that 'the script returned 1'. Which is weird, yes.
> While it's true that the puppet server is using ruby 1.8.7 this
> shouldn't matter for the above code.
Right.
> What would the effect of outputting incorrect YAML be? I'm wondering
> about the syntax of what's being printed.
I disbelieve that the content of stdout is the issue. The Ruby process
exits with a non-zero status, meaning that something goes wrong.
Can you wrap the Ruby in a shell script and tee its output somewhere?
#!/bin/bash
/path/to/ruby-enc 2>&1 | tee /tmp/enc-output
Configure that scriptlet as your ENC script and see what ends up in the
file.
BTW, rereading your first mail - I don't think puppet should own the
script. That's just horrible security. It should have permission to
execute it, but only root (or a privileged user account) should be able
to write it. Unless I'm missing something about ENC theory (never used
those).
HTH,
Felix