Autoloading issue when adding type to existing module

413 views
Skip to first unread message

olizilla

unread,
Feb 26, 2012, 2:09:20 PM2/26/12
to puppet...@googlegroups.com
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: 


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!




olizilla

unread,
Feb 26, 2012, 2:12:54 PM2/26/12
to puppet...@googlegroups.com
And of course the vital statistics of the opponent are:

operatingsystem        => Debian
operatingsystemrelease => 6.0.3
puppetversion          => 2.6.2
rubyversion            => 1.8.7

olizilla

unread,
Mar 6, 2012, 7:09:48 AM3/6/12
to puppet...@googlegroups.com
Ok, I know standalone isn't the coolest way to run puppet, but I don't feel like I have a node I can sensibly assign as the master. Regardless, this seems like a significant issue. 

Is it something stupid I'm doing, has anyone else had this problem? Do nodes cache catalogs? What's going on? ...meh. I'm gonna set myself as admin on some rails sites. Then they'll notice me ;-)
Reply all
Reply to author
Forward
0 new messages