Jakov Sosic
2013-Jul-25 00:13 UTC
[Puppet Users] Puppet loading class that is not included?
Hi, I have noticed a very strance problem with my current puppet setup on one of the nodes. This is very peculiar problem indeed. I have class php which looks like this: # Class: php$major # # This module manages php$major installation for CentOS 5 # class php ( $major = $php::params::major, $package_ensure = $php::params::package_ensure, $timezone = $::timezone, ) inherits php::params { # packages from CentOS base package { ''php'': ensure => $package_ensure, name => "php${major}", } package { ''php-cli'': ensure => $package_ensure, name => "php${major}-cli", } package { ''php-common'': ensure => $package_ensure, name => "php${major}-common", } file { ''/etc/php.d/timezone.ini'': ensure => file, owner => root, group => root, mode => ''0644'', content => template(''php/timezone.ini.erb''), require => Package[''php-common''], } } Now, I have many subclases for php modules, like this one: # Class: php::mod::bcmath class php::mod::bcmath ( $major = $php::major, $package_ensure = $php::package_ensure, ) inherits php { package { ''php-bcmath'': ensure => $package_ensure, name => "php${major}-bcmath", } } It''s obvious that this class inherits class php. Now, I have a following classes that include the php: class system::templates::php { include ::php include ::php::mod::bcmath } But I also have a class system::php ,which only brings /etc/php.d/system.ini : class system::php { file { ''/etc/php.d/system.ini'': } } Now, strange thing is, if system::php is present, puppet does automatic include on every node that has some of the php::mod::* included... But if I rm -f system/manifests/php.pp, not a single node reports an error... So, it''s obvious that system::php is being pulled in catalog somehow, I presume by the ''inherits php'' code from php submodules. I have alot of other code around, so I didn''t (yet) try to code up the minimal possible code that causes this behaviour... But sure as hell this is unintended in my case... I was pretty cautious in specifying top scope in numeros occasions when including or requiring classes, but this time I thing that ''inherits'' bit me... Has anyone had similar problems? Should I change my classes code in some way to avoid this kind of issues in the future? -- Jakov Sosic www.srce.unizg.hr -- 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 puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users. For more options, visit https://groups.google.com/groups/opt_out.
Jakov Sosic
2013-Jul-25 00:43 UTC
Re: [Puppet Users] Puppet loading class that is not included?
On 07/25/2013 02:13 AM, Jakov Sosic wrote:> I was pretty cautious in specifying top scope in numeros occasions when > including or requiring classes, but this time I thing that ''inherits'' > bit me...Nah, I''ve found it... It seems that I missed one require in another class, system::foobar, which stated ''require php'', and thus included system::php if it existed! I''ve changed it to ''require ::php'' and now it''s ok, system::php is not included any more. So it''s not the inherit after all :D -- Jakov Sosic www.srce.unizg.hr -- 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 puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users. For more options, visit https://groups.google.com/groups/opt_out.
Jakov Sosic
2013-Jul-25 00:44 UTC
Re: [Puppet Users] Puppet loading class that is not included?
On 07/25/2013 02:13 AM, Jakov Sosic wrote:> Hi,Also, just in case some else stumbles upon something like this... generating grahps, and opening .dot file in text editor and searching for incriminating classes and it''s relationships really solved it for me. So that''s my advice to future readers. -- Jakov Sosic www.srce.unizg.hr -- 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 puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users. For more options, visit https://groups.google.com/groups/opt_out.