Morning Gareth,

Ah - I re-read that, and that makes more sense, especially since renaming
the class fixed it. I'll give it a go to neaten up the module; am sure it
will work.

Thanks both!

:)

A

On Monday, 20 July 2015, Gareth Rushgrove <[email protected]> wrote:

> Hi Andrew
>
> On 20 July 2015 at 00:38, Andrew Langhorn
> <[email protected] <javascript:;>> wrote:
> > I don't know why, but when I renamed the class, things started to work.
> > Very odd. Maybe I should just upgrade to the latest stable 3.x release
> > (3.8.0, I think), or even 4.
>
> See Peter's email above.
>
> The issue appears to be that you had two classes called tomcat, and
> 'include tomcat' will load the first one it finds which in this case
> was the one from app/manifests/tomcat.pp rather than the one you
> expected from the third party module. So it never loads
> tomcat::instance_basedir etc.
>
> Instead of include tomcat you can use the following formulation:
>
> include ::tomcat
>
> This forces the lookup to be from the top level, so should correctly
> import the tomcat module you are expecting. I'd probably do that as
> well.
>
> Gareth
>
>
>
> >
> > Thanks though - especially helpful on this list, as usual :)
> >
> > On 19 July 2015 at 19:54, Peter Huene <[email protected]
> <javascript:;>> wrote:
> >>
> >> On Sun, Jul 19, 2015 at 7:07 AM, Andrew Langhorn
> >> <[email protected] <javascript:;>> wrote:
> >>>
> >>> Hi Felix,
> >>>
> >>> Thanks for the reply.
> >>>
> >>> Yep - that snippet is representative. I've copied the full thing for
> you
> >>> below. Granted, it needs some tidying up, but I think it should just
> work as
> >>> it stands:
> >>>
> >>> class app::reservations {
> >>>
> >>> include tomcat
> >>>
> >>>
> >>> Exec {
> >>>   path =>
> "/usr/bin:/usr/sbin:/bin:/sbin:/usr/local/bin:/usr/local/sbin",
> >>> }
> >>>
> >>>
> >>> tomcat::instance { 'reservations':
> >>>   ensure    => present,
> >>>   http_port => 8080,
> >>>   require   => Class['tomcat'],
> >>> }
> >>>
> >>>
> >>> file { '/srv/tomcat/reservations/webapps/reservations.war':
> >>>   ensure => present,
> >>>   source => 'puppet:///modules/app/reservations.war',
> >>>   owner  => 'tomcat',
> >>>   group  => 'adm',
> >>>   mode   => '0755',
> >>>   notify => Exec['restart-reservations-tomcat'],
> >>>   }
> >>>
> >>>
> >>> exec { 'restart-reservations-tomcat':
> >>>   command => '/etc/init.d/tomcat-reservations restart',
> >>> }
> >>>
> >>>
> >>> }
> >>>
> >>>
> >>> Under normal circumstances, I agree that explicitly including the
> Tomcat
> >>> class up above the instantiation of the tomcat::instance class should
> work
> >>> fine. I don't know why it's not working quite as expected. Here's the
> output
> >>> from Puppet with the --debug flag:
> >>>
> >>> ==> app: Debug: importing
> >>> '/opt/puppet/modules/app/manifests/reservations.pp' in environment
> >>> development
> >>> ==> app: Debug: Automatically imported app:reservations from
> >>> app/reservations in to development
> >>> ==> app: Debug: importing '/opt/puppet/modules/app/manifests/tomcat.pp'
> >>> in environment development
> >>
> >>
> >> It looks like the loader found app/manifests/tomcat.pp instead of
> >> tomcat/manifests/init.pp.  Perhaps qualify the include as `include
> >> ::tomcat`?  Not sure if that would work with Puppet 3.6 though.
> >>
> >>>
> >>> ==> app: Debug: Automatically imported app::tomcat from app/tomcat into
> >>> development
> >>>
> >>> ==> app: Debug: importing
> >>> '/opt/puppet/vendor/modules/tomcat/manifests/instance.pp' in
> environment
> >>> development
> >>> ==> app: Debug: Automatically imported tomcat::instance from
> >>> tomcat/instance into development
> >>> ==> app: Warning: Scope(Tomcat::Instance[reservations]): Could not look
> >>> up qualified variable 'tomcat::instance_basedir'; class tomcat has not
> been
> >>> evaluated
> >>> ==> app: Warning: Scope(Tomcat::Instance[reservations]): Could not look
> >>> up qualified variable 'tomcat::version'; class tomcat has not been
> evaluated
> >>>
> >>> Values for both tomcat::version and tomcat::instance_basedir are
> >>> retrieved from a case statement which, ultimately, resides at
> >>>
> https://github.com/camptocamp/puppet-tomcat/blob/master/manifests/params.pp
> ,
> >>> which either works out a value or just passes in a value, respectively.
> >>>
> >>> So, it looks like the Tomcat module is - at least partially - being
> >>> imported.
> >>>
> >>> I'm a bit stumped now!
> >>>
> >>> Andrew
> >>>
> >>> On Sunday, 19 July 2015 01:06:26 UTC+1, Felix.Frank wrote:
> >>>>
> >>>> On 07/19/2015 01:19 AM, Andrew Langhorn wrote:
> >>>>
> >>>> class apps::reservations {
> >>>>
> >>>>
> >>>> include tomcat
> >>>>
> >>>>
> >>>> tomcat::instance { ‘reservations’:
> >>>>
> >>>> ensure => present,
> >>>>
> >>>> http_port => 8080,
> >>>>
> >>>> }
> >>>>
> >>>>
> >>>> }
> >>>>
> >>>>
> >>>> However, when I run Puppet against a Vagrant VM, it tells me that the
> >>>> tomcat class hasn’t been evaluated, so it can’t use tomcat::instance
> >>>> (because of underlying failures when using the Tomcat module):
> >>>>
> >>>>
> >>>> ==> app: Warning: Scope(Tomcat::Instance[reservations]): Could not
> look
> >>>> up qualified variable 'tomcat::instance_basedir'; class tomcat has
> not been
> >>>> evaluated
> >>>>
> >>>>
> >>>> Hmm, if the resource declaration is lexically preceded by an 'include
> >>>> tomcat' then this should not happen.
> >>>>
> >>>> In this case, the order in your manifest is really important. Is your
> >>>> snippet truly representative of your actual code?
> >>>>
> >>>> Regards,
> >>>> Felix
> >>>
> >>> --
> >>> 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 [email protected] <javascript:;>.
> >>> To view this discussion on the web visit
> >>>
> https://groups.google.com/d/msgid/puppet-users/2d506a73-c86a-4ddd-bfd4-09579565bd04%40googlegroups.com
> .
> >>>
> >>> For more options, visit https://groups.google.com/d/optout.
> >>
> >>
> >>
> >>
> >> --
> >> Join us at PuppetConf 2015, October 5-9 in Portland, OR -
> >> www.2015.puppetconf.com
> >> Register early to save 40%!
> >>
> >> --
> >> You received this message because you are subscribed to a topic in the
> >> Google Groups "Puppet Users" group.
> >> To unsubscribe from this topic, visit
> >> https://groups.google.com/d/topic/puppet-users/w9mVNiq8kAk/unsubscribe.
> >> To unsubscribe from this group and all its topics, send an email to
> >> [email protected] <javascript:;>.
> >> To view this discussion on the web visit
> >>
> https://groups.google.com/d/msgid/puppet-users/CACZQQfO4BWWK3_aZ2xBWSRaKGnGp00uaA66DVFxkL-7jdOadbA%40mail.gmail.com
> .
> >>
> >> For more options, visit https://groups.google.com/d/optout.
> >
> >
> >
> >
> > --
> > Andrew Langhorn
> > Web Operations
> > Government Digital Service
> >
> > e: [email protected] <javascript:;>
> > t: +44 (0)7810 737375
> > a: 6th Floor, Aviation House, 125 Kingsway, London, WC2B 6NH
> >
> > --
> > 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 [email protected] <javascript:;>.
> > To view this discussion on the web visit
> >
> https://groups.google.com/d/msgid/puppet-users/CANCa_Wb%3DS72jJ45fbYU4eag5CedYYUxoBCc6eY8L3uXxyWZ8-A%40mail.gmail.com
> .
> >
> > For more options, visit https://groups.google.com/d/optout.
>
>
>
> --
> Gareth Rushgrove
> @garethr
>
> devopsweekly.com
> morethanseven.net
> garethrushgrove.com
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Puppet Users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/puppet-users/w9mVNiq8kAk/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected] <javascript:;>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/puppet-users/CAFi_6yJ6rosUveAyYA42FRcdrNU2ruhB8ZA%3D0-EtQWQD%2BWYy1g%40mail.gmail.com
> .
> For more options, visit https://groups.google.com/d/optout.
>


--

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CANCa_WYSFjAhWk1SqVMxiT4OetWQm28Vj_B58-wgYi%2Bj_%2Bi55g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to