Re: [Puppet Users] yet another class dependency question.

2009-12-30 Thread Dan Bode
Hi,

On Wed, Dec 30, 2009 at 9:52 PM, Sukh Khehra skhe...@proofpoint.com wrote:

 Hi,

 I am running puppet version 0.25.1 on both the server and client and am
 getting the following error on a puppet run:

 err: Could not apply complete catalog: Could not retrieve dependency
 'Class[http]' of Class[puppet::http]

 Class http is defined in the http module like so:


 class http {
package { httpd: ensure = installed }
file {
httpd.conf:
ensure  = present,
 ...


 Class puppet::http is defined in the puppet module like so:

 class puppet::http {
require http
file {
http-puppet.conf:
ensure  = present,
path= /etc/httpd/conf.d/puppet.conf,
 ...


I have a feeling that it maybe a scoping issue with a namespace collision
between puppet::http and http. you are calling require http from the
namespace of puppet::http, which is checking puppet before it checks root
(::)so it actually thinks that you are requiring puppet::http and not http.
I have seen this issue before with includes. To resolve it with include, you
can add the prefix ::http (which means from the root namespace)

Feel free to try this
  # this works for includes
  require ::http

but it unfortunately didnt work for me, so this might actually be a bug.

the easiest fix is not to use puppet::http for the name of the class, try
puppet::apache or something.



 In this test setup both my client and server are the same node in the
 same production environment and here's what my module organization looks
 like.

 # egrep -i '^\[|module|environment' /etc/puppet/puppet.conf
 [main]
 environments = production,staging,development,testing
 environment = production
 [puppetd]
 environment = production
 [puppetmasterd]
 # environments
 [production]
 modulepath = $confdir/modules/production
 [staging]
 modulepath = $confdir/modules/staging:$confdir/modules/production
 [development]
 modulepath = $confdir/modules/development
 [testing]
 modulepath = $confdir/modules/testing:$confdir/modules/production


 # ls -1d /etc/puppet/modules/production/puppet
 /etc/puppet/modules/production/http
 /etc/puppet/modules/production/http
 /etc/puppet/modules/production/puppet


 Why wouldn't it be able to retrieve dependency class http?

 --

 You received this message because you are subscribed to the Google Groups
 Puppet Users group.
 To post to this group, send email to puppet-us...@googlegroups.com.
 To unsubscribe from this group, send email to
 puppet-users+unsubscr...@googlegroups.compuppet-users%2bunsubscr...@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-us...@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.




Re: [Puppet Users] yet another class dependency question.

2009-12-30 Thread Dan Bode
On Wed, Dec 30, 2009 at 10:45 PM, Sukh Khehra skhe...@proofpoint.comwrote:

  Thanks Dan. Unfortunately, this did not work for me.



 err: Could not apply complete catalog: Could not retrieve dependency
 'Class[::http]' of Class[puppet::http]



 Does anyone know of another way to fully qualify the class name when
 requiring it? I was hoping to not have to change the names of these
 pre-existing classes.

I am in the process of filing a bug on this.

The best way to get around this without changing the class names is to
include, and then set the class require inside your resources.

class test2::test{
  include ::test
  file{'/tmp/test2test3':
content = 'blah',
require = Class['::test'],
  }
}

hope this helps,

Dan





  --

 *From:* puppet-users@googlegroups.com [mailto:
 puppet-us...@googlegroups.com] *On Behalf Of *Dan Bode
 *Sent:* Wednesday, December 30, 2009 1:31 PM
 *To:* puppet-users@googlegroups.com
 *Subject:* Re: [Puppet Users] yet another class dependency question.



 Hi,

 On Wed, Dec 30, 2009 at 9:52 PM, Sukh Khehra skhe...@proofpoint.com
 wrote:

 Hi,

 I am running puppet version 0.25.1 on both the server and client and am
 getting the following error on a puppet run:

 err: Could not apply complete catalog: Could not retrieve dependency
 'Class[http]' of Class[puppet::http]

 Class http is defined in the http module like so:


 class http {
package { httpd: ensure = installed }
file {
httpd.conf:
ensure  = present,
 ...


 Class puppet::http is defined in the puppet module like so:

 class puppet::http {
require http
file {
http-puppet.conf:
ensure  = present,
path= /etc/httpd/conf.d/puppet.conf,
 ...


 I have a feeling that it maybe a scoping issue with a namespace collision
 between puppet::http and http. you are calling require http from the
 namespace of puppet::http, which is checking puppet before it checks root
 (::)so it actually thinks that you are requiring puppet::http and not http.
 I have seen this issue before with includes. To resolve it with include, you
 can add the prefix ::http (which means from the root namespace)

 Feel free to try this
   # this works for includes
   require ::http

 but it unfortunately didnt work for me, so this might actually be a bug.

 the easiest fix is not to use puppet::http for the name of the class, try
 puppet::apache or something.



 In this test setup both my client and server are the same node in the
 same production environment and here's what my module organization looks
 like.

 # egrep -i '^\[|module|environment' /etc/puppet/puppet.conf
 [main]
 environments = production,staging,development,testing
 environment = production
 [puppetd]
 environment = production
 [puppetmasterd]
 # environments
 [production]
 modulepath = $confdir/modules/production
 [staging]
 modulepath = $confdir/modules/staging:$confdir/modules/production
 [development]
 modulepath = $confdir/modules/development
 [testing]
 modulepath = $confdir/modules/testing:$confdir/modules/production


 # ls -1d /etc/puppet/modules/production/puppet
 /etc/puppet/modules/production/http
 /etc/puppet/modules/production/http
 /etc/puppet/modules/production/puppet


 Why wouldn't it be able to retrieve dependency class http?

 --

 You received this message because you are subscribed to the Google Groups
 Puppet Users group.
 To post to this group, send email to puppet-us...@googlegroups.com.
 To unsubscribe from this group, send email to
 puppet-users+unsubscr...@googlegroups.compuppet-users%2bunsubscr...@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-us...@googlegroups.com.
 To unsubscribe from this group, send email to
 puppet-users+unsubscr...@googlegroups.compuppet-users%2bunsubscr...@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-us...@googlegroups.com.
 To unsubscribe from this group, send email to
 puppet-users+unsubscr...@googlegroups.compuppet-users%2bunsubscr...@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-us...@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.