I have run into a brick wall with puppet autoloading, using the standalone 
puppet set up via the puppet command. Basically, when I add a new defined 
type to an existing module, trying to use it elsewhere fails with the old:

Puppet::Parser::AST::Resource failed with error ArgumentError: Invalid 
resource type...

But when I add a new defined type in a new module, it works. By "new" I 
mean, I have been happily running puppet for a while, and so my existing 
modules like "apache" have been applied to my test server previously. If 
I add a defined type like "apache::vhost", much like as described here: 

http://docs.puppetlabs.com/learning/definedtypes.html

then using it fails with the error mentioned above. So I assume I have made 
a stupid typo and lose a few hours trying to track it down. Removing all 
the variables from the problem, I reduced the defined type down to:

*# modules/apache/manifests/vhost.pp*
define apache::vhost() {
  notice("Creating $title")
}

*# foo.pp*
apache::vhost { 'somesite': }

and run it with:  puppet apply -v foo.pp
and get another:
Puppet::Parser::AST::Resource failed with error ArgumentError: Invalid 
resource type apache::vhost at ...

After trying many other combinations, all leading to the same failure I 
then in desperation tried copying the define into a brand new module that 
had never been applied to the test vm... *and it works.*
*
*
*# modules/foo/manifests/vhost.pp*
define foo::vhost() {
  notice("Foo $title")
}

*# foo.pp*
foo::vhost { 'somesite': }

*$ puppet apply -v foo.pp *
notice: Scope(Foo::Vhost[somesite]): Foo somesite
info: Applying configuration version '1327629678'

So then I suspect that my apache module must be in be broken in someway, so 
I try adding the the define to another, much simpler existing module 
'basics'

*# modules/basics/manifests/init.pp*
class basics {
  package { ["zip", "unzip", "less", "lsof"]:
    ensure => installed,
  }
}

*# modules/basics/manifests/vhost.pp*
define basics::vhost() {
  notice("basics $title")
}

# foo.pp
basics::vhost { 'somesite': }

*$ puppet apply -v foo.pp *
Puppet::Parser::AST::Resource failed with error ArgumentError: Invalid 
resource type basics::vhost at ...

So, now I'm thinking I might be messing with forces large than my puny 
module code. Can anyone shed some light on what is going on, as I've gone 
about 10 rounds with this one and I'm feeling faint from the blood loss. 
Along the way I've discovered that parameterised types behave the same way. 
All I can conclude from the empirical evidence gained is that there is an 
autoloading issue somehow triggered by using puppet in standalone mode, 
where previously compiled modules are concerned.

Cheers,

O!




-- 
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/-/inPr7_DSuCAJ.
To post to this group, send email to puppet-users@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.

Reply via email to