Gavin Williams
2012-Sep-26 16:01 UTC
[Puppet Users] Glassfish custom provider and ''file does not exist''
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/-/A_85G-eU3TwJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Dick Davies
2012-Sep-27 11:53 UTC
Re: [Puppet Users] Glassfish custom provider and ''file does not exist''
At a guess the asadmin command isn''t in puppetd''s $PATH. Maybe try a full path to the executable to confirm? On 26 September 2012 17:01, Gavin Williams <fatmcgav@gmail.com> wrote:> Hi there, > > I''m trying to setup Glassfish config management using puppet. > I''ve found larstobi''s module here 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. > > 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/-/A_85G-eU3TwJ. > To post to this group, send email to puppet-users@googlegroups.com. > To unsubscribe from this group, send email to > puppet-users+unsubscribe@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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
fatmcgav
2012-Sep-27 11:57 UTC
Re: [Puppet Users] Glassfish custom provider and ''file does not exist''
Hi there I thought that initially as well, so I modified the provider to use a full path rather than assume it was on the path. The log files below are prints of the variables which are being passed around... Cheers Gav On Sep 27, 2012 12:53 PM, "Dick Davies" <rasputnik@hellooperator.net> wrote:> At a guess the asadmin command isn''t in puppetd''s $PATH. > Maybe try a full path to the executable to confirm? > > On 26 September 2012 17:01, Gavin Williams <fatmcgav@gmail.com> wrote: > > Hi there, > > > > I''m trying to setup Glassfish config management using puppet. > > I''ve found larstobi''s module here 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. > > > > 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/-/A_85G-eU3TwJ. > > To post to this group, send email to puppet-users@googlegroups.com. > > To unsubscribe from this group, send email to > > puppet-users+unsubscribe@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+unsubscribe@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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Stefan Schulte
2012-Sep-28 05:14 UTC
Re: [Puppet Users] Glassfish custom provider and ''file does not exist''
On Thu, Sep 27, 2012 at 12:57:01PM +0100, fatmcgav wrote:> Hi there > > I thought that initially as well, so I modified the provider to use a full > path rather than assume it was on the path. > > The log files below are prints of the variables which are being passed > around... > > Cheers > Gav > On Sep 27, 2012 12:53 PM, "Dick Davies" <rasputnik@hellooperator.net> wrote: >[...]> > >> 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[...] Has the file the executable bit set for the user that is running the script (probably root)? -Stefan -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
fatmcgav
2012-Sep-28 07:58 UTC
Re: [Puppet Users] Glassfish custom provider and ''file does not exist''
Stefan Was running puppet agent using ''sudo''... However just tried using root and no difference... Asadmin definitely exists and has got the right permissions, as shown below: # file /usr/local/glassfish-3.1.2/bin/asadmin> /usr/local/glassfish-3.1.2/bin/asadmin: POSIX shell script text executable > # ls -l /usr/local/glassfish-3.1.2/bin/asadmin > -rwxr-xr-x. 1 nobody glassfish 2262 Sep 18 16:23 > /usr/local/glassfish-3.1.2/bin/asadmin > >Thoughts? Cheers Gavin On 28 September 2012 06:14, Stefan Schulte <stefan.schulte@taunusstein.net>wrote:> On Thu, Sep 27, 2012 at 12:57:01PM +0100, fatmcgav wrote: > > Hi there > > > > I thought that initially as well, so I modified the provider to use a > full > > path rather than assume it was on the path. > > > > The log files below are prints of the variables which are being passed > > around... > > > > Cheers > > Gav > > On Sep 27, 2012 12:53 PM, "Dick Davies" <rasputnik@hellooperator.net> > wrote: > > > [...] > > > >> 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 > [...] > > Has the file the executable bit set for the user that is running the > script (probably root)? > > -Stefan > > -- > 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+unsubscribe@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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
fatmcgav
2012-Sep-28 09:39 UTC
Re: [Puppet Users] Glassfish custom provider and ''file does not exist''
Ok, so I thought I''d take another look, and try and get some debug logging out of the provider to make sure it''s constructing things correctly... I''ve applied the following patch to asadmin.rb, however I''m not seeing anything on the client trace... diff --git a/lib/puppet/provider/asadmin.rb b/lib/puppet/provider/asadmin.rb> index f95d6ab..c8bd4a7 100644 > --- a/lib/puppet/provider/asadmin.rb > +++ b/lib/puppet/provider/asadmin.rb > @@ -8,6 +8,7 @@ > passed_args.each { |arg| args << arg } > exec_args = args.join " " > command = "#{@resource[:asadminpath]} #{exec_args}" > + Puppet.debug("Command = #{command}") > command = "su - #{@resource[:user]} -c \"#{command}\"" if > @resource[:user] and > not command.match /create-service/ > self.debug command >Any ideas how I can get the provider logging??? Cheers Gavin On 28 September 2012 08:58, fatmcgav <fatmcgav@gmail.com> wrote:> Stefan > > Was running puppet agent using ''sudo''... > > However just tried using root and no difference... > > Asadmin definitely exists and has got the right permissions, as shown > below: > > # file /usr/local/glassfish-3.1.2/bin/asadmin >> /usr/local/glassfish-3.1.2/bin/asadmin: POSIX shell script text executable >> # ls -l /usr/local/glassfish-3.1.2/bin/asadmin >> -rwxr-xr-x. 1 nobody glassfish 2262 Sep 18 16:23 >> /usr/local/glassfish-3.1.2/bin/asadmin >> >> > Thoughts? > > Cheers > Gavin > > On 28 September 2012 06:14, Stefan Schulte <stefan.schulte@taunusstein.net > > wrote: > >> On Thu, Sep 27, 2012 at 12:57:01PM +0100, fatmcgav wrote: >> > Hi there >> > >> > I thought that initially as well, so I modified the provider to use a >> full >> > path rather than assume it was on the path. >> > >> > The log files below are prints of the variables which are being passed >> > around... >> > >> > Cheers >> > Gav >> > On Sep 27, 2012 12:53 PM, "Dick Davies" <rasputnik@hellooperator.net> >> wrote: >> > >> [...] >> > > >> 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 >> [...] >> >> Has the file the executable bit set for the user that is running the >> script (probably root)? >> >> -Stefan >> >> -- >> 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+unsubscribe@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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Stefan Schulte
2012-Sep-29 00:31 UTC
Re: [Puppet Users] Glassfish custom provider and ''file does not exist''
On Fri, Sep 28, 2012 at 10:39:11AM +0100, fatmcgav wrote:> Ok, so I thought I''d take another look, and try and get some debug logging > out of the provider to make sure it''s constructing things correctly... > > I''ve applied the following patch to asadmin.rb, however I''m not seeing > anything on the client trace... > > diff --git a/lib/puppet/provider/asadmin.rb b/lib/puppet/provider/asadmin.rb > > index f95d6ab..c8bd4a7 100644 > > --- a/lib/puppet/provider/asadmin.rb > > +++ b/lib/puppet/provider/asadmin.rb > > @@ -8,6 +8,7 @@ > > passed_args.each { |arg| args << arg } > > exec_args = args.join " " > > command = "#{@resource[:asadminpath]} #{exec_args}" > > + Puppet.debug("Command = #{command}") > > command = "su - #{@resource[:user]} -c \"#{command}\"" if > > @resource[:user] and > > not command.match /create-service/ > > self.debug command > > > > Any ideas how I can get the provider logging??? > > Cheers > Gavin >do you have the code somewhere? If you dropped the debug call in the create method or something it will never be executed if puppet thinks the provider is not valid at all. So having the actual provider code may make is more obvious why it is failing for you. -Stefan -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
fatmcgav
2012-Sep-29 07:21 UTC
Re: [Puppet Users] Glassfish custom provider and ''file does not exist''
Stefan Yes, the code is all in github. https://github.com/fatmcgav/puppet-glassfish Cheers Gav On Sep 29, 2012 1:28 AM, "Stefan Schulte" <stefan.schulte@taunusstein.net> wrote:> On Fri, Sep 28, 2012 at 10:39:11AM +0100, fatmcgav wrote: > > Ok, so I thought I''d take another look, and try and get some debug > logging > > out of the provider to make sure it''s constructing things correctly... > > > > I''ve applied the following patch to asadmin.rb, however I''m not seeing > > anything on the client trace... > > > > diff --git a/lib/puppet/provider/asadmin.rb > b/lib/puppet/provider/asadmin.rb > > > index f95d6ab..c8bd4a7 100644 > > > --- a/lib/puppet/provider/asadmin.rb > > > +++ b/lib/puppet/provider/asadmin.rb > > > @@ -8,6 +8,7 @@ > > > passed_args.each { |arg| args << arg } > > > exec_args = args.join " " > > > command = "#{@resource[:asadminpath]} #{exec_args}" > > > + Puppet.debug("Command = #{command}") > > > command = "su - #{@resource[:user]} -c \"#{command}\"" if > > > @resource[:user] and > > > not command.match /create-service/ > > > self.debug command > > > > > > > Any ideas how I can get the provider logging??? > > > > Cheers > > Gavin > > > > do you have the code somewhere? If you dropped the debug call in the > create method or something it will never be executed if puppet thinks > the provider is not valid at all. > > So having the actual provider code may make is more obvious why it is > failing for you. > > -Stefan > > -- > 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+unsubscribe@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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
fatmcgav
2012-Oct-15 10:40 UTC
Re: [Puppet Users] Glassfish custom provider and ''file does not exist''
Just got back from holiday, and need to get this one going... Any ideas on how I can proceed? Cheers Gavin On 29 September 2012 08:21, fatmcgav <fatmcgav@gmail.com> wrote:> Stefan > > Yes, the code is all in github. > https://github.com/fatmcgav/puppet-glassfish > > Cheers > Gav > On Sep 29, 2012 1:28 AM, "Stefan Schulte" <stefan.schulte@taunusstein.net> > wrote: > >> On Fri, Sep 28, 2012 at 10:39:11AM +0100, fatmcgav wrote: >> > Ok, so I thought I''d take another look, and try and get some debug >> logging >> > out of the provider to make sure it''s constructing things correctly... >> > >> > I''ve applied the following patch to asadmin.rb, however I''m not seeing >> > anything on the client trace... >> > >> > diff --git a/lib/puppet/provider/asadmin.rb >> b/lib/puppet/provider/asadmin.rb >> > > index f95d6ab..c8bd4a7 100644 >> > > --- a/lib/puppet/provider/asadmin.rb >> > > +++ b/lib/puppet/provider/asadmin.rb >> > > @@ -8,6 +8,7 @@ >> > > passed_args.each { |arg| args << arg } >> > > exec_args = args.join " " >> > > command = "#{@resource[:asadminpath]} #{exec_args}" >> > > + Puppet.debug("Command = #{command}") >> > > command = "su - #{@resource[:user]} -c \"#{command}\"" if >> > > @resource[:user] and >> > > not command.match /create-service/ >> > > self.debug command >> > > >> > >> > Any ideas how I can get the provider logging??? >> > >> > Cheers >> > Gavin >> > >> >> do you have the code somewhere? If you dropped the debug call in the >> create method or something it will never be executed if puppet thinks >> the provider is not valid at all. >> >> So having the actual provider code may make is more obvious why it is >> failing for you. >> >> -Stefan >> >> -- >> 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+unsubscribe@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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Gavin Williams
2012-Oct-19 16:35 UTC
Re: [Puppet Users] Glassfish custom provider and ''file does not exist''
Ok, I''ve found what was causing the provider to fail... Changed as follows: diff --git a/lib/puppet/provider/domain/asadmin.rb b/lib/puppet/provider/domain/asadmin.rb index 940c051..384f6ab 100644 --- a/lib/puppet/provider/domain/asadmin.rb +++ b/lib/puppet/provider/domain/asadmin.rb @@ -2,7 +2,7 @@ Puppet::Type.type(:domain).provide(:asadmin, :parent => Puppet::Provider::Asadmin) do desc "Glassfish support." - commands :asadmin => "asadmin" + commands :asadmin => "/usr/local/glassfish-3.1.2/bin/asadmin" def create args = [] Any ideas how I can make commands use a variable? Cheers Gavin On Monday, 15 October 2012 11:40:16 UTC+1, Gavin Williams wrote:> > Just got back from holiday, and need to get this one going... > > Any ideas on how I can proceed? > > Cheers > Gavin > > On 29 September 2012 08:21, fatmcgav <fatmcgav@gmail.com> wrote: > >> Stefan >> >> Yes, the code is all in github. >> https://github.com/fatmcgav/puppet-glassfish >> >> Cheers >> Gav >> On Sep 29, 2012 1:28 AM, "Stefan Schulte" <stefan.schulte@taunusstein.net> >> wrote: >> >>> On Fri, Sep 28, 2012 at 10:39:11AM +0100, fatmcgav wrote: >>> > Ok, so I thought I''d take another look, and try and get some debug >>> logging >>> > out of the provider to make sure it''s constructing things correctly... >>> > >>> > I''ve applied the following patch to asadmin.rb, however I''m not seeing >>> > anything on the client trace... >>> > >>> > diff --git a/lib/puppet/provider/asadmin.rb >>> b/lib/puppet/provider/asadmin.rb >>> > > index f95d6ab..c8bd4a7 100644 >>> > > --- a/lib/puppet/provider/asadmin.rb >>> > > +++ b/lib/puppet/provider/asadmin.rb >>> > > @@ -8,6 +8,7 @@ >>> > > passed_args.each { |arg| args << arg } >>> > > exec_args = args.join " " >>> > > command = "#{@resource[:asadminpath]} #{exec_args}" >>> > > + Puppet.debug("Command = #{command}") >>> > > command = "su - #{@resource[:user]} -c \"#{command}\"" if >>> > > @resource[:user] and >>> > > not command.match /create-service/ >>> > > self.debug command >>> > > >>> > >>> > Any ideas how I can get the provider logging??? >>> > >>> > Cheers >>> > Gavin >>> > >>> >>> do you have the code somewhere? If you dropped the debug call in the >>> create method or something it will never be executed if puppet thinks >>> the provider is not valid at all. >>> >>> So having the actual provider code may make is more obvious why it is >>> failing for you. >>> >>> -Stefan >>> >>> -- >>> 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+unsubscribe@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 view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/hGGzpUwCUxsJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Josh Cooper
2012-Oct-19 17:03 UTC
Re: [Puppet Users] Glassfish custom provider and ''file does not exist''
Hi Gavin, On Fri, Oct 19, 2012 at 9:35 AM, Gavin Williams <fatmcgav@gmail.com> wrote:> Ok, I''ve found what was causing the provider to fail... > > Changed as follows: > > diff --git a/lib/puppet/provider/domain/asadmin.rb > b/lib/puppet/provider/domain/asadmin.rb > index 940c051..384f6ab 100644 > --- a/lib/puppet/provider/domain/asadmin.rb > +++ b/lib/puppet/provider/domain/asadmin.rb > @@ -2,7 +2,7 @@ > Puppet::Type.type(:domain).provide(:asadmin, > :parent => Puppet::Provider::Asadmin) do > desc "Glassfish support." > - commands :asadmin => "asadmin" > + commands :asadmin => "/usr/local/glassfish-3.1.2/bin/asadmin" > > def create > args = [] > > Any ideas how I can make commands use a variable? > > Cheers > Gavin > > On Monday, 15 October 2012 11:40:16 UTC+1, Gavin Williams wrote: >> >> Just got back from holiday, and need to get this one going... >> >> Any ideas on how I can proceed? >> >> Cheers >> Gavin >> >> On 29 September 2012 08:21, fatmcgav <fatmcgav@gmail.com> wrote: >>> >>> Stefan >>> >>> Yes, the code is all in github. >>> https://github.com/fatmcgav/puppet-glassfish >>> >>> Cheers >>> Gav >>> >>> On Sep 29, 2012 1:28 AM, "Stefan Schulte" >>> <stefan.schulte@taunusstein.net> wrote: >>>> >>>> On Fri, Sep 28, 2012 at 10:39:11AM +0100, fatmcgav wrote: >>>> > Ok, so I thought I''d take another look, and try and get some debug >>>> > logging >>>> > out of the provider to make sure it''s constructing things correctly... >>>> > >>>> > I''ve applied the following patch to asadmin.rb, however I''m not seeing >>>> > anything on the client trace... >>>> > >>>> > diff --git a/lib/puppet/provider/asadmin.rb >>>> > b/lib/puppet/provider/asadmin.rb >>>> > > index f95d6ab..c8bd4a7 100644 >>>> > > --- a/lib/puppet/provider/asadmin.rb >>>> > > +++ b/lib/puppet/provider/asadmin.rb >>>> > > @@ -8,6 +8,7 @@ >>>> > > passed_args.each { |arg| args << arg } >>>> > > exec_args = args.join " " >>>> > > command = "#{@resource[:asadminpath]} #{exec_args}" >>>> > > + Puppet.debug("Command = #{command}") >>>> > > command = "su - #{@resource[:user]} -c \"#{command}\"" if >>>> > > @resource[:user] and >>>> > > not command.match /create-service/ >>>> > > self.debug command >>>> > > >>>> > >>>> > Any ideas how I can get the provider logging??? >>>> > >>>> > Cheers >>>> > Gavin >>>> > >>>> >>>> do you have the code somewhere? If you dropped the debug call in the >>>> create method or something it will never be executed if puppet thinks >>>> the provider is not valid at all. >>>> >>>> So having the actual provider code may make is more obvious why it is >>>> failing for you. >>>> >>>> -Stefan >>>> >>>> -- >>>> 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+unsubscribe@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 view this discussion on the web visit > https://groups.google.com/d/msg/puppet-users/-/hGGzpUwCUxsJ. > > To post to this group, send email to puppet-users@googlegroups.com. > To unsubscribe from this group, send email to > puppet-users+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en.Puppet uses its `path` setting to resolve unqualified executables in commands[1]. You can specify this on a per-agent basis, or you can provide an environment or I''ve recently filed a ticket to add a per-resource path metaparameter[2]. If you''re writing your own provider, you can also specify an environment that puppet will use to execute the child process. Josh [1] http://docs.puppetlabs.com/references/latest/configuration.html#path [2] http://projects.puppetlabs.com/issues/16997 -- Josh Cooper Developer, Puppet Labs -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
fatmcgav
2012-Oct-21 14:39 UTC
Re: [Puppet Users] Glassfish custom provider and ''file does not exist''
Josh Cheers for the info. Are there any references on how to set the path when executing child processes? Cheers Gavin On Oct 19, 2012 6:03 PM, "Josh Cooper" <josh@puppetlabs.com> wrote:> Hi Gavin, > > On Fri, Oct 19, 2012 at 9:35 AM, Gavin Williams <fatmcgav@gmail.com> > wrote: > > Ok, I''ve found what was causing the provider to fail... > > > > Changed as follows: > > > > diff --git a/lib/puppet/provider/domain/asadmin.rb > > b/lib/puppet/provider/domain/asadmin.rb > > index 940c051..384f6ab 100644 > > --- a/lib/puppet/provider/domain/asadmin.rb > > +++ b/lib/puppet/provider/domain/asadmin.rb > > @@ -2,7 +2,7 @@ > > Puppet::Type.type(:domain).provide(:asadmin, > > :parent => > Puppet::Provider::Asadmin) do > > desc "Glassfish support." > > - commands :asadmin => "asadmin" > > + commands :asadmin => "/usr/local/glassfish-3.1.2/bin/asadmin" > > > > def create > > args = [] > > > > Any ideas how I can make commands use a variable? > > > > Cheers > > Gavin > > > > On Monday, 15 October 2012 11:40:16 UTC+1, Gavin Williams wrote: > >> > >> Just got back from holiday, and need to get this one going... > >> > >> Any ideas on how I can proceed? > >> > >> Cheers > >> Gavin > >> > >> On 29 September 2012 08:21, fatmcgav <fatmcgav@gmail.com> wrote: > >>> > >>> Stefan > >>> > >>> Yes, the code is all in github. > >>> https://github.com/fatmcgav/puppet-glassfish > >>> > >>> Cheers > >>> Gav > >>> > >>> On Sep 29, 2012 1:28 AM, "Stefan Schulte" > >>> <stefan.schulte@taunusstein.net> wrote: > >>>> > >>>> On Fri, Sep 28, 2012 at 10:39:11AM +0100, fatmcgav wrote: > >>>> > Ok, so I thought I''d take another look, and try and get some debug > >>>> > logging > >>>> > out of the provider to make sure it''s constructing things > correctly... > >>>> > > >>>> > I''ve applied the following patch to asadmin.rb, however I''m not > seeing > >>>> > anything on the client trace... > >>>> > > >>>> > diff --git a/lib/puppet/provider/asadmin.rb > >>>> > b/lib/puppet/provider/asadmin.rb > >>>> > > index f95d6ab..c8bd4a7 100644 > >>>> > > --- a/lib/puppet/provider/asadmin.rb > >>>> > > +++ b/lib/puppet/provider/asadmin.rb > >>>> > > @@ -8,6 +8,7 @@ > >>>> > > passed_args.each { |arg| args << arg } > >>>> > > exec_args = args.join " " > >>>> > > command = "#{@resource[:asadminpath]} #{exec_args}" > >>>> > > + Puppet.debug("Command = #{command}") > >>>> > > command = "su - #{@resource[:user]} -c \"#{command}\"" if > >>>> > > @resource[:user] and > >>>> > > not command.match /create-service/ > >>>> > > self.debug command > >>>> > > > >>>> > > >>>> > Any ideas how I can get the provider logging??? > >>>> > > >>>> > Cheers > >>>> > Gavin > >>>> > > >>>> > >>>> do you have the code somewhere? If you dropped the debug call in the > >>>> create method or something it will never be executed if puppet thinks > >>>> the provider is not valid at all. > >>>> > >>>> So having the actual provider code may make is more obvious why it is > >>>> failing for you. > >>>> > >>>> -Stefan > >>>> > >>>> -- > >>>> 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+unsubscribe@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 view this discussion on the web visit > > https://groups.google.com/d/msg/puppet-users/-/hGGzpUwCUxsJ. > > > > To post to this group, send email to puppet-users@googlegroups.com. > > To unsubscribe from this group, send email to > > puppet-users+unsubscribe@googlegroups.com. > > For more options, visit this group at > > http://groups.google.com/group/puppet-users?hl=en. > > Puppet uses its `path` setting to resolve unqualified executables in > commands[1]. You can specify this on a per-agent basis, or you can > provide an environment or I''ve recently filed a ticket to add a > per-resource path metaparameter[2]. If you''re writing your own > provider, you can also specify an environment that puppet will use to > execute the child process. > > Josh > > [1] http://docs.puppetlabs.com/references/latest/configuration.html#path > [2] http://projects.puppetlabs.com/issues/16997 > -- > Josh Cooper > Developer, Puppet Labs > > -- > 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+unsubscribe@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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Gavin Williams
2012-Oct-24 10:38 UTC
[Puppet Users] Re: Glassfish custom provider and ''file does not exist''
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 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Stefan Schulte
2012-Oct-24 17:18 UTC
Re: [Puppet Users] Re: Glassfish custom provider and ''file does not exist''
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 > GavinYour 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+unsubscribe@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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
fatmcgav
2012-Oct-24 20:36 UTC
Re: [Puppet Users] Re: Glassfish custom provider and ''file does not exist''
Stefan Cheers for the feedback. Understood on the exists element. Yes, what I''m trying to achieve is a working provider without asadmin being in the path. That''s what I''ve worked towards by using a full path to the relevant asadmin file, as it''s possible a given node could have one or more versions of glassfish installed. Currently, the asadmin path gets calculated using several parameter values, which allows a user calling the class to override any given parameter. The actual command execution appears to work as expected currently, though will take another look at the execute command. Cheers Gavin On Oct 24, 2012 6:15 PM, "Stefan Schulte" <stefan.schulte@taunusstein.net> wrote:> 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+unsubscribe@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+unsubscribe@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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.