hello list,
what i want to archive is something like this:
include mailman
manage_mailing_list {"chatml":
password => "asdfasdfasdf",
subscribers => ["darks@fet.org",
"hand@dampf.de",
"i.am.cool@yoo.org"
]
}
which should create the mailinglist and subscribe the given users.
i have attached the corresponding class and defines. this works ok for
one list but unfortunately not for several lists, since puppet barfs on
the object names of the subscribe_to_mailinglist definition, if the same
user belongs to several mailinglist.
i''m banging my head but i don''t find a solution, because of
the missing
iterator object. probably i would be best to introduce a native mailman
type, but unfortunately my ruby knowledge is currently close to none.
any other hints ?
holger
_______________________________________________
Puppet-users mailing list
Puppet-users@madstop.com
https://mail.madstop.com/mailman/listinfo/puppet-users
David Schmitt
2007-Apr-18 19:31 UTC
Re: advice on pseudo iteration needed (mailman recipe)
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Wednesday 18 April 2007 20:31, Holger Brueckner wrote:> hello list, > > what i want to archive is something like this: > > include mailman > > manage_mailing_list {"chatml": > password => "asdfasdfasdf", > subscribers => ["darks@fet.org", > "hand@dampf.de", > "i.am.cool@yoo.org" > ] > } > > which should create the mailinglist and subscribe the given users. > i have attached the corresponding class and defines. this works ok for > one list but unfortunately not for several lists, since puppet barfs on > the object names of the subscribe_to_mailinglist definition, if the same > user belongs to several mailinglist. > > i'm banging my head but i don't find a solution, because of the missing > iterator object. probably i would be best to introduce a native mailman > type, but unfortunately my ruby knowledge is currently close to none. > > any other hints ?You have indeed met a fundamental limitation in puppet's current data model: resources have to have a single-valued "primary key". To work around that you could use a template, which can contain arbitrary ruby code: <% subscribers.each |sub| %> <%=sub%> <% end %> and use that as input for some tool or just maintain the list of subscribers in a external file and copy that over with puppet. Regards, David - -- - - hallo... wie gehts heute? - - *hust* gut *rotz* *keuch* - - gott sei dank kommunizieren wir über ein septisches medium ;) -- Matthias Leeb, Uni f. angewandte Kunst, 2005-02-15 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFGJnIs/Pp1N6Uzh0URAm4LAKCKlRmR/gb+45U73wrskhrwjdzc7QCgkCwV n+K4H8Mte/sT57KhVk11E6s=gykd -----END PGP SIGNATURE----- _______________________________________________ Puppet-users mailing list Puppet-users@madstop.com https://mail.madstop.com/mailman/listinfo/puppet-users
Juri Rischel Jensen
2007-Apr-18 19:57 UTC
Re: advice on pseudo iteration needed (mailman recipe)
What about having the manage_mailing_list definition create the mailinglist without the subscribers, and then copy over a list of subscribers and subscribe them in an exec statement and have that subscribe to the list of subscribers? That way you separate the list of subscribers from your puppet manifests, and get the added benefit of the automatic update of the subscriberlist. Hmm, not very well-written, but I hope you get the point... On Apr 18, 2007, at 21:31, David Schmitt wrote:> -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > On Wednesday 18 April 2007 20:31, Holger Brueckner wrote: >> hello list, >> >> what i want to archive is something like this: >> >> include mailman >> >> manage_mailing_list {"chatml": >> password => "asdfasdfasdf", >> subscribers => ["darks@fet.org", >> "hand@dampf.de", >> "i.am.cool@yoo.org" >> ] >> } >> >> which should create the mailinglist and subscribe the given users. >> i have attached the corresponding class and defines. this works ok >> for >> one list but unfortunately not for several lists, since puppet >> barfs on >> the object names of the subscribe_to_mailinglist definition, if >> the same >> user belongs to several mailinglist. >> >> i''m banging my head but i don''t find a solution, because of the >> missing >> iterator object. probably i would be best to introduce a native >> mailman >> type, but unfortunately my ruby knowledge is currently close to none. >> >> any other hints ? > > You have indeed met a fundamental limitation in puppet''s current > data model: > resources have to have a single-valued "primary key". To work > around that you > could use a template, which can contain arbitrary ruby code: > > <% subscribers.each |sub| %> <%=sub%> <% end %> > > and use that as input for some tool or just maintain the list of > subscribers > in a external file and copy that over with puppet. > > > > Regards, David > - -- > - - hallo... wie gehts heute? > - - *hust* gut *rotz* *keuch* > - - gott sei dank kommunizieren wir über ein septisches medium ;) > -- Matthias Leeb, Uni f. angewandte Kunst, 2005-02-15 > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.6 (GNU/Linux) > > iD8DBQFGJnIs/Pp1N6Uzh0URAm4LAKCKlRmR/gb+45U73wrskhrwjdzc7QCgkCwV > n+K4H8Mte/sT57KhVk11E6s> =gykd > -----END PGP SIGNATURE----- > _______________________________________________ > Puppet-users mailing list > Puppet-users@madstop.com > https://mail.madstop.com/mailman/listinfo/puppet-users-- Med venlig hilsen Juri Rischel Jensen Fab:IT ApS Vesterbrogade 50 DK-1620 København Tlf: 70 202 407 / Fax: 33 313 640 www.fab-it.dk / juri@fab-it.dk
i tried adding this the wiki myself, but i can''t find out, howto do
this
in the correct way. anyway, all files attached, fell free to add to the
wiki if somebody finds this usefull.
this recipe was made for debian etch, so some paths or package names
might vary on other distributions.
usage:
include mailman
manage_mailing_list {"mailman":
password => "6A0hJxGpUn",
}
optional parameters:
owner => string, define list owner
moderators => [string,...], define list moderators
moderated => true/false, define default list policy
subscribers => [string,...], subscribe users to list
listdomain => string, define mailinglist domain
ensure => present/absent, create or remove list
unsubscribe => [string,...], unsubscribe users from list
this could for sure be optimized, but i works for me like that ;-)
holger
_______________________________________________
Puppet-users mailing list
Puppet-users@madstop.com
https://mail.madstop.com/mailman/listinfo/puppet-users