2010/9/14 Lars Tobias Skjong-Børsting <li...@snota.no> > I am making a resource type to manage Glassfish domains. I'm not quite sure > how to specify provider commands with a sane default and in configurable > way. The location of the binary may be in other locations depending on where > Glassfish was installed. > > > http://github.com/larstobi/puppet-glassfish/blob/master/lib/puppet/provider/glassfish/asadmin.rb > > Does anyone have any advice on this? >
Check some hard coded path, and tries to detect if it's available in $PATH using which: case when File.executable?("/opt/NSBglassfish/bin/asadmin") commands :asadmin => "/opt/NSBglassfish/bin/asadmin" when File.executable?("/usr/local/NSBglassfish/bin/asadmin") commands :asadmin => "/usr/local/NSBglassfish/bin/asadmin" else asadmin_path = `which asadmin` if $?.exitstatus ==0 commands :asadmin => asadmin_path else raise Puppet::Error, "Unable to locate asadmin in $PATH" end end Disclaimer, I'm just looking into writing providers as well, so not sure if this is the best way. Anyone with more ruby experience feel free to chime in. Also if you run into other roadblocks, please try the puppet-dev mailing list as well. Thanks, Nan -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-us...@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.