On Monday, January 14, 2013 10:38:33 AM UTC-6, Jakov Sosic wrote: > > > I guess a fix in the documentation of generate() function, explaining > what function returns to puppet DSL would be a good addition... >
That already seems pretty clear to me in the existing docs: Calls an external command on the Puppet master and *returns the results of the command*. Any arguments are passed to the external command as arguments. * If the generator does not exit with return code of 0, the generator is considered to have failed and a parse error is thrown*. Generators can only have file separators, alphanumerics, dashes, and periods in them. This function will attempt to protect you from malicious generator calls (e.g., those with ‘..’ in them), but it can never be entirely safe. No subshell is used to execute generators, so all shell metacharacters are passed directly to the generator. (Emphasis added.) How would you suggest improving that? I guess "results" could be changed to "output", but it's clear to me that the function does not return the command's exit code because any exit code other than zero constitutes a parse error. Returning the output of the command is anyway the whole point of this function -- that is, to "generate" a value for use in your manifest. Using it for the side effects of the command is not exactly improper, but it's not the use case toward which the function is targeted. Personally, I'd write a custom function for such a purpose, to try to ensure that the intent is clear. John -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/QQ1sgGfDRQ4J. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.