Issue #8433 has been updated by Peter Meier.
You better ask that on the puppet-users list. But in short:
> When was the decision made to eliminate "import"? Was this documented
> anywhere? It may be that we just don't understand how modules are supposed
> to be used, but I don't get the idea behind this at all. It seems to me what
> you are saying here is that if I want to create a module, let's say for
> "foo", and have some classes inside of that, I have to include them all on
> each node that uses anything in module "foo".
With the whole autoloading feature (which is documented quite good) there is
simply no need for import.
> We need to be able to install foo::server on one node, and foo::client on
> another node.
>
> Thus:
>
> node client {
>
> include foo::client
>
> }
>
> node server {
>
> include foo::server
>
> }
>
> The way I read this is that I'll need a separate module for each one, this:
>
> modules/foo_server
> modules/foo_client
>
> So what am I missing?
No need for a separate module:
<pre>
modules/foo/manifests/client.pp:
class foo::client {
#do some client stuff
}
modules/foo/manifests/server.pp
class foo::server {
# do some server stuff
}
# no need for an init.pp at all, as there is no class foo!!!
</pre>
Then the nodes:
<pre>
node client {
include foo::client
}
node server {
include foo::server
}
# no need to import anything!
</pre>
If you follow these simply rules:
* only 1 class/define per file
* filename according the following rules:
** a class foo::bar goes into modules/foo/manifests/bar.pp
** a define foo::blub::bla goes into modules/foo/manifests/blub/bar.pp
** a class foo::blub goes into modules/foo/manifests/blub.pp
** class foo goes into modules/foo/manifests/init.pp
This is documented really well and also a lot of public available modules are
following these guidelines (like the one I help to develop at
http://git.puppet.immerda.ch), also afair it's included in the best practices.
Organizing your code like that also gives you much less headaches while
searching for the correct class etc., as by following the conventions you will
end up at the right place.
import is imho a left over of puppet's dark ages and should in my humble
opinion really _not_ be used, there is simply _no_ reason to use it. It caused
various problems in the past, like the ones we are seeing here now. A year (or
so) ago, there was also a lengthy discussion about that on the puppet-dev list
and if I'm not completely wrong, there was afterwards also a RFC-mail on the
puppet-users list. Both concluded that it makes sense to narrow the puppet
loads code to avoid the various problems and performance issues, as the
autoloading feature is working very well and quite good documented.
This so far from my humble memory. The rest should really better discussed on
one of the lists.
----------------------------------------
Bug #8433: Seemingly random failures after 2.7.1
https://projects.puppetlabs.com/issues/8433
Author: Gustavo Soares
Status: Needs More Information
Priority: High
Assignee: Nigel Kersten
Category: modules
Target version:
Affected Puppet version: 2.7.1
Keywords:
Branch:
I've noticed a weird behaviour after trying puppet (gem) 2.7.1. I am planning
an (huge)
upgrade (from 0.25.x to 2.7.1) in all my puppet's boxes...
I've installed puppet's 2.7.1 gem and got a lot of "Could not find
class" problem... and everything worked just fine with 0.25.x.
So, I decided to uninstall the gem for version 2.7.1 and install
puppet version 2.6.9.
Everything worked just fine... no weird "Could not find class"
problem...
Here are some more info about my environment:
* I do not use parameterized classes and all my classes are "included" (I was
still using 0.25.x...)
* In my $confdir/manifests/classes/roles I have a very generic class for all
puppet hosts declared as follow:
<pre>
class role_puppet_common {
$role = "puppet_common"
include common
include puppet::common
include puppet::user
}
</pre>
in $confdir/manifests/site.pp I have the following line...
<pre>
[...]
import "classes/roles/*"
[...]
</pre>
the weird "Could not find class" problem occurs for class puppet::common
my directory structure is as follow:
<pre>
...
$confdir/modules/puppet/
$confdir/modules/puppet/manifests
$confdir/modules/puppet/manifests/init.pp
$confdir/modules/puppet/manifests/classes/
$confdir/modules/puppet/manifests/classes/common.pp
...
</pre>
in $confdir/modules/puppet/manifests/init.pp I have:
<pre>
import "puppet/classes/*"
</pre>
and in $confdir/modules/puppet/manifests/classes/common.pp
<pre>
class puppet::common {
...
}
</pre>
* my modulepath declared in puppet.conf is as follow:
<pre>
modulepath = /mnt/puppet/conf/modules:/mnt/puppet/othermodules
</pre>
where /mnt/puppet/conf is set to $confdir.
That's it!
As I said before, when I downgraded to version 2.6.9 everything worked fine.
--
You have received this notification because you have either subscribed to it,
or are involved in it.
To change your notification preferences, please click here:
http://projects.puppetlabs.com/my/account
--
You received this message because you are subscribed to the Google Groups
"Puppet Bugs" 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-bugs?hl=en.