On Wed, Oct 24, 2012 at 03:38:20AM -0700, Gavin Williams wrote:
> Ok, I've gone about it a slightly different way now, and have stripped the 
> 'commands' argument from the domain function provider, and am trying to 
> validate the presence of asadmin at the main asadmin.rb level. 
> 
> I've created an 'exists?' definition, but it doesn't appear to be getting 
> called. Any ideas how I can force it to be called prior to attempting to 
> execute asadmin? 
> 
> Latest code commit has been pushed to github, available here: 
> https://github.com/fatmcgav/puppet-glassfish/commit/429f9e8e1d08e99c69d8ffdcb3043648af5fa18a
> 
> Any comments welcome. 
> 
> Regards
> Gavin 

Your exists? method in puppet/provider/domain/el.rb overwrites the
exists? method in puppet/provider/asadmin.rb. I don't know if you get
problems when you have an el.rb file but you define an asadmin provider
here. This may create classname clashes with the asadmin provider defined in
provider/asadmin.rb

The exists? method in asadmin.rb is not going to work because `commands`
is a class method while `exists` is an instance method. It does make no
sense to call `commands` inside an instance method.

What exactly are you trying to archive anyhow? If the excutable is not in
PATH how should your provider work? The best approach in my opinion
is to always specify the full path to the executable. If you want your
provider considered suitable even if commands are missing, you can use

  optional_commands :asadmin => 'binary_that_may_be_absent'

If you want the user to supply the path to the binary via a resource
parameter then you cannot realize this at a class level but at an
instance level. That beeing said, you cannot define your executables
with use the `commands` method.

To execute something you can use the execute method. You then have to
do something like.

  output = execute([resource[:asadmin_binary], "arg1", "arg2"])

-Stefan

> 
> On Wednesday, 26 September 2012 17:01:47 UTC+1, Gavin Williams wrote:
> >
> > Hi there, 
> >
> > I'm trying to setup Glassfish config management using puppet. 
> > I've found larstobi's module here 
> > <https://github.com/larstobi/puppet-glassfish/>which I've cloned and am 
> > starting to tweak, as it would appear that the mentioned module is based on 
> > Solaris, therefore I'm starting to add support for EL. My code tree is 
> > here <https://github.com/fatmcgav/puppet-glassfish>.
> >
> > The challenge I'm hitting currently is that upon executing, it's failing 
> > with 
> >
> >> *err: Could not find a suitable provider for domain*
> >>
> >
> > When running at debug level, I can see the following:
> >
> >> *debug: Puppet::Type::Domain::ProviderAsadmin: file asadmin does not 
> >> exist
> >> debug: Class[Glassfish::Domain]: The container Stage[main] will propagate 
> >> my refresh event
> >> err: Could not find a suitable provider for domain
> >> *
> >
> >
> > I've verified that the asadmin file exists, as follows:
> >
> >> *notice: /Stage[main]/Glassfish::Domain/Notify[gfdomain]/message: 
> >> defined 'message' as 'Creating Glassfish domain cms using portbase 9000.
> >>  Asadmin file is: /usr/local/glassfish-3.1.2/bin/asadmin.'*
> >>
> >
> > *# file /usr/local/glassfish-3.1.2/bin/asadmin
> >> /usr/local/glassfish-3.1.2/bin/asadmin: POSIX shell script text executable
> >> *
> >>
> >
> > So the file definitely exists, and is a valid 'asadmin' file. 
> >
> > Any ideas? 
> >
> > Cheers
> > Gavin 
> >
> 
> -- 
> 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/-/_pJvxmzaEmUJ.
> 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.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
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.

Reply via email to