On 26/03/2012 14:57, jcbollinger wrote:

On Mar 23, 12:11 pm, Tom Barber<[email protected]>
wrote:
Hi guys

I've asked around on the IRC on the channel to no avail, partly cause
of difficulty collating all the information required, so hopefully I
can do a better job here.

At a very high level the crux of my question is thus:

http://analytical-labs.com/cycles.png

When I add the require dependency for Saiku::Tomcat to the
Saiku::Instance resource I get a cyclical dependency.

I have my 2 defines here:

define saiku::instance($ensure , $app_name = 'saiku') {

   package { "${app_name}":
      ensure =>  latest,
      notify  =>  Service["tomcat-${name}"],
      }

   saiku::datasource { "foodmart_dev_${name}":
       ensure =>  absent,
       datasource_name =>  "foodmart",
       tomcat_name =>  "${name}",
       #require =>Package["${app_name}"],
       #notify  =>  Service["tomcat-${name}"],
     }

     saiku::datasource { "foodmart_mysql_dev_${name}" :
       ensure =>  present,
       datasource_name =>  "foodmart_mysql_${name}",
       tomcat_name =>  "${name}",
       #notify  =>  Service["tomcat-${name}"],
       #require =>Package["${app_name}"],
     }

}

define saiku::tomcat($ensure, $tomcat_http, $tomcat_ajp,
$tomcat_server) {

   include tomcat::source

   tomcat::instance {"${name}":
     ensure      =>  present,
     ajp_port    =>  "${tomcat_ajp}",
     server_port    =>  "${tomcat_server}",
     http_port    =>  "${tomcat_http}",
   }

}

You see I would like to notify my Tomcat instance that either a new
app has been installed or if either of the two files have changed.
(The file notifies are currently disabled to try and aid debugging)

I use the camptocamp puppet-tomcat module

https://github.com/camptocamp/puppet-tomcat/blob/master/manifests/ins...

and my control.pp file looks like this:

class cloudbi::saiku::control {

       $saiku_http                   = extlookup('saiku_http','')
       $saiku_ajp                    = extlookup('saiku_ajp','')
       $saiku_server         = extlookup('saiku_server','')
       $saiku_tomcat_name    = extlookup('saiku_tomcat_name','')
       $saiku_url                    = extlookup('saiku_url','')

       include saiku::apt

       saiku::instance{ "${saiku_tomcat_name}":
         ensure =>  present,
         require =>  [Class["saiku::apt"],Saiku::Tomcat["$
{saiku_tomcat_name}"]],
       }

       saiku::tomcat{ "${saiku_tomcat_name}":
             ensure =>  present,
             tomcat_http =>  "${saiku_http}",
         tomcat_ajp =>  "${saiku_ajp}",
         tomcat_server =>  "${saiku_server}",
             }
     }

But no matter what refactoring I do I get a dependency cycle with the
following error:

err: Could not apply complete catalog: Found 1 dependency cycle:
(Tomcat::Instance[saiku] =>  Saiku::Tomcat[saiku] =>
Saiku::Instance[saiku] =>  Package[saiku] =>  Service[tomcat-saiku] =>
Tomcat::Instance[saiku])
Cycle graph written to /var/lib/puppet/state/graphs/cycles.dot.

Can someone please explain in layman's terms why me requiring Tomcat
being installed, prevents me from notifying it when part of my
configuration is changed, considering it needs to be installed to be
notified in the first place.

Layman's terms don't come into this picture because you have a
technical problem of some kind.  Everything in your relationship graph
makes sense to me except this dependency: "Saiku::Instance[saiku] =>
Package[saiku]".  Because definition instance Saiku::Instance[saiku]
declares Package[saiku], that relationship should go the other
direction (compare Service[tomcat-saiku] =>  Tomcat::Instance[saiku]).

Supposing that everything you have presented faithfully reflects your
current manifests, I have come up with only three possibilities:

1) there may be additional declarations somewhere in your manifests
that override the sense of that relationship.  In-scope resource
defaults in might do that, or an explicit resource chain anywhere.
That particular relationship ought not to be overridable, however, so
this would also constitute a Puppet bug.

2) Puppet may be using one or more cached, stale manifests.  Shut down
the master, touch all the relevant manifest files, then restart the
master to ensure that it recompiles the manifests.

3) The code you presented, together with the puppet-tomcat module but
no other code, may trigger a bug in Puppet's relationship grapher.


John

Thanks for that John,

I did restart the server, but to make sure, I'll remove everything from this puppet node apart from the Saiku block and run it from a completely clean state to see if it makes any difference.

Cheers

Tom

--
You received this message because you are subscribed to the Google Groups "Puppet 
Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to