[Puppet Users] Re: Could not find class

luke.bigum
2010-12-16T10:39:42Z

Dmytro,

I''m a git noob :) I''ve had a look at the module now. I
wouldn''t say
it''s designed that well and I think a few people on this list would
agree.

To fix your problem I think you''ll have to "include rsync"
first,
which will then import "classes/*.pp", which will then allow Puppet to
find the rsyncd class. This is a bad design as rsyncd should really be
it''s own module or a subclass rather than relying on including a class
that actually does nothing but import other .pp files.

When thinking about the rsync software itself, the module could be
designed better. You can''t have just an rsync client with this module
(ie: just Package[rsync]), you only get an rsync server. That means if
you wanted to Puppetify an rsync client you''d need another module/
class, which would then leave to multiple declaration problems if a
node is a client AND a server as both would try declare
Package[rsync]. A better idea would be something like this:

class rsync
  installs rsync software
class rsync::rsyncd
  include rsync (for the software)
  turns on rsyncd, contains a define to setup rsyncd exports

And the actual module structure would look like this, which requires
zero "import" statements:

modules/rsync/init.pp <- contains "class rsync"
modules/rsync/rsyncd.pp <- contains "class rsync::rsyncd"

Lastly, I personally don''t like the name of the define
"rsyncd::export" as the double colon kind of denotes they are parent
and child classes, but that''s just me.

Anyway, if you really want to use this module you could try "include
rsync" before "include rsyncd". You will have to remove your own
declaration of Package[rsync] as this is already done in the rsyncd
module and will cause a multiple declaration error.

My recommendation is to write a better module yourself, you''ll learn
more that way :)

Hope this helps,

-Luke

On Dec 16, 9:58 am, "luke.bigum" <luke.bi...@fasthosts.co.uk>
wrote:
> That github link doesn''t work for me so don''t know the
internals of
> this module, but if the module is called "rsync", as indicated by
this
> module path: /etc/puppet/modules/rsync/, then any sub classes of that
> should be in the rsync namespace... Are you sure it''s not supposed
to
> be rsync::rsyncd?
>
> A base class called ''rsyncd'' would mean there''d
be a module etc/puppet/
> modules/rsync/rsyncd/, not a "rsyncd.pp" under the rsync
module...
> What you''ve shown of this module''s structure looks quite
strange to
> me.
>
> On Dec 16, 1:48 am, Dmytro Bablinyuk <bablin...@gmail.com> wrote:
>
> > Hi Everybody,
>
> > I am sure that I am missing something very obvious,
>
> > I have installed rsync package
>
> > git clonehttps://github.com/camptocamp/puppet-rsyncd.gitrsync
>
> > The path
>
> > root@puppet-master:/etc/puppet/modules/rsync/manifests/classes# ls -l
> > total 4
> > -rw-r--r-- 1 root root 1078 2010-12-16 09:54 rsyncd.pp
>
> > The manifest file
>
> > package { ["rsync", "xinetd"]: ensure =>
present }
> > service { "xinetd": ensure => running }
>
> > include rsyncd
>
> > rsyncd::export { "etc":
> >     path => "/etc",
> >     chroot => true,
> >     gid => "staff",
> >     allow => ["172.16.50.4", "172.16.41.10"],
>
> > }
>
> > I have error on the client
>
> > root@puppet-client-ubuntu:~# puppetd --test
> > info: Retrieving plugin
> > err: Could not retrieve catalog from remote server: Error 400 on
> > SERVER: Could not find class rsyncd at /etc/puppet/manifests/site.pp:
> > 33 on node puppet-client-ubuntu.harbour
> > warning: Not using cache on failed catalog
> > err: Could not retrieve catalog; skipping run
>
> > How do I specify path to the rsyncd class?
>
> > Thank you
> > Dmytro