On Thursday, March 12, 2015 at 10:46:57 AM UTC-5, LinuxDan wrote: > > Thanks for the sanity check, John. > > Next question: If I want to make a type/provider that depends on an > external script (Python in this case), does anyone know of a good example I > can use as a blueprint ? >
If you have an executable Python script with a shebang line, such as would enable you to run it directly as a command, then your case is no different from any other provider. For instance, your provider implementation might use the 'commands' method to set up a method that runs the script, and to verify at runtime that it is present. That might be an especial boon if you need Puppet also to manage such a script, which would be one way to proceed if you don't already have one: #!/usr/bin/python import mymodule mymodule.do_stuff() PL's provider development docs <https://docs.puppetlabs.com/guides/provider_development.html> could get you started here (see the "Suitability" section), and many of the providers shipped with Puppet set up interfaces to host system commands this way. If you want your provider to run 'python -m mymodule' or some such then it's not really all that different, but Puppet provides a little less automagic support. You can still use the 'commands' method to set up a command for Python itself, and you can set up a generic wrapper method that uses that method to run 'python -m mymodule' with whatever additional arguments you want. You can then implement all the provider's needed methods in terms of that wrapper method. 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 puppet-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/3b001cd5-98de-4928-846b-767233e9bece%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.