-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Dear list! While converting my config to modules, I''m applying puppet''s mechanisms to interact with and between modules. Here I''ll try to collect a few patterns to create awareness of fundamental module patterns. After feedback/discussion I will add this to the wiki. The Puppet Semaphor ================== Requirement: A module creates a set of resources and wants to provide a stable method to reference them for outside usage. Solution: 1) Find the last applied resource from the set. 2) Add an alias denoting the whole set. This creates a definite meaning for "before" and "require" Resource[alias]. Using these relations resources can either be added to the set or require the "whole set" including third-party additions. Drawbacks: * Needs a defined "last" resource in the set. * The Semaphor includes the type of the aliased resource, which is semi-randomly selected and irrelevant to the solved problem. * Notify/subscribe don''t work for the whole set. 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) iD8DBQFGf4WW/Pp1N6Uzh0URAgSwAJ0av3ZhSONHGg17PCb7dWJv4tdORgCeNa6I sJCrOG5t69u2cZ7DXxShdQQ=bCGh -----END PGP SIGNATURE-----
On Jun 25, 2007, at 4:06 AM, David Schmitt wrote:> -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Dear list! > > While converting my config to modules, I''m applying puppet''s > mechanisms to > interact with and between modules. Here I''ll try to collect a few > patterns to > create awareness of fundamental module patterns. After feedback/ > discussion I > will add this to the wiki.Is this a feature request or usage pattern? I''m confused...> The Puppet Semaphor > ==================> > Requirement: A module creates a set of resources and wants to > provide a stable > method to reference them for outside usage.Can you give me an idea of the utility of referencing these resources?> Solution: > 1) Find the last applied resource from the set. > 2) Add an alias denoting the whole set. > > This creates a definite meaning for "before" and "require" Resource > [alias]. > Using these relations resources can either be added to the set or > require > the "whole set" including third-party additions. > > Drawbacks: > * Needs a defined "last" resource in the set. > * The Semaphor includes the type of the aliased resource, which is > semi-randomly selected and irrelevant to the solved problem. > * Notify/subscribe don''t work for the whole set.Note that any resources that get restarted generate an event that would restart the next resource, so you could build an event chain so that this did essentially work, assuming that all chained resources could react to events. -- You can''t wait for inspiration. You have to go after it with a club. -- Jack London --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Tuesday 26 June 2007, Luke Kanies wrote:> On Jun 25, 2007, at 4:06 AM, David Schmitt wrote: > > Dear list! > > > > While converting my config to modules, I''m applying puppet''s > > mechanisms to > > interact with and between modules. Here I''ll try to collect a few > > patterns to > > create awareness of fundamental module patterns. After feedback/ > > discussion I > > will add this to the wiki. > > Is this a feature request or usage pattern? I''m confused...A usage pattern.> > The Puppet Semaphor > > ==================> > > > Requirement: A module creates a set of resources and wants to > > provide a stable > > method to reference them for outside usage. > > Can you give me an idea of the utility of referencing these resources?- From the README of my apt class[1]: Provided Resources: File[apt_config]: Use this resource to depend on or add to a completed apt configuration Exec[apt_updated]: After this point, current packages can installed via apt, usually used like this: Package { require => Exec[apt_updated] } With these two you can say: "Add this configuration snippet to apt.conf": file { "/etc/apt/apt.conf.d/something": content => "...\n" } and as shown above: "install any packages after apt was updated": Package { require => Exec[apt_updated] }> > Solution: > > 1) Find the last applied resource from the set. > > 2) Add an alias denoting the whole set. > > > > This creates a definite meaning for "before" and "require" Resource > > [alias]. > > Using these relations resources can either be added to the set or > > require > > the "whole set" including third-party additions. > > > > Drawbacks: > > * Needs a defined "last" resource in the set. > > * The Semaphor includes the type of the aliased resource, which is > > semi-randomly selected and irrelevant to the solved problem. > > * Notify/subscribe don''t work for the whole set. > > Note that any resources that get restarted generate an event that > would restart the next resource, so you could build an event chain so > that this did essentially work, assuming that all chained resources > could react to events.This would be a interesting information to put on the TypeReference page. Or all types should propagate events. Regards, David [1] http://club.black.co.at:82/svn/manifests/trunk/modules/apt/README - -- - - 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) iD8DBQFGgXfG/Pp1N6Uzh0URAqR5AJ9AayCFdKtlno/i2VEUvESs5km4qACZAYvu OopgLP0NmjmX92I4Znp4PUo=518m -----END PGP SIGNATURE-----
On Jun 26, 2007, at 3:32 PM, David Schmitt wrote:> > On Tuesday 26 June 2007, Luke Kanies wrote: >> >> Is this a feature request or usage pattern? I''m confused... > > A usage pattern.Ah, ok.> - From the README of my apt class[1]: > > Provided Resources: > File[apt_config]: Use this resource to depend on or add to a > completed apt > configuration > Exec[apt_updated]: After this point, current packages can > installed via apt, > usually used like this: > Package { require => Exec[apt_updated] } > > With these two you can say: > > "Add this configuration snippet to apt.conf": > > file { "/etc/apt/apt.conf.d/something": content => "...\n" } > > and > > as shown above: "install any packages after apt was updated": > > Package { require => Exec[apt_updated] }I see now. It seems more like a checkpoint, since semaphores are about locking access, I think, but I understand what you mean now. We should create a ''design patterns'' page, pointing to this and other useful patterns.> This would be a interesting information to put on the TypeReference > page. Or > all types should propagate events.I agree; could you open a bug to add that to the type documentation? -- You can''t have everything. Where would you put it? -- Stephen Wright --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Tuesday 26 June 2007, Luke Kanies wrote:> On Jun 26, 2007, at 3:32 PM, David Schmitt wrote: > > On Tuesday 26 June 2007, Luke Kanies wrote: > > - From the README of my apt class[1]: > > > > Provided Resources: > > File[apt_config]: Use this resource to depend on or add to a > > completed apt > > configuration > > Exec[apt_updated]: After this point, current packages can > > installed via apt, > > usually used like this: > > Package { require => Exec[apt_updated] } > > > > With these two you can say: > > > > "Add this configuration snippet to apt.conf": > > > > file { "/etc/apt/apt.conf.d/something": content => "...\n" } > > > > and > > > > as shown above: "install any packages after apt was updated": > > > > Package { require => Exec[apt_updated] } > > I see now. It seems more like a checkpoint, since semaphores are > about locking access, I think, but I understand what you mean now.Sempahores are actually signalling entities. I can understand the confusion though. OTOH, "checkpoint" doesn''t really ring a bell with me either. What about just "defined resources"? It''s a bit of a mouthful though. :-(> We should create a ''design patterns'' page, pointing to this and other > useful patterns.I could just add it to the puppet recipies. Much of those should go to The Repository anyways.> > This would be a interesting information to put on the TypeReference > > page. Or > > all types should propagate events. > > I agree; could you open a bug to add that to the type documentation?Done at http://reductivelabs.com/trac/puppet/ticket/691 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) iD8DBQFGgiT1/Pp1N6Uzh0URAj/QAJ44jGQrbaX2Ui/r+9fmZxRCW79IBACfYLdy wz4p/Y/juanZBFL7rG8tjYk=aaBk -----END PGP SIGNATURE-----
On Jun 27, 2007, at 3:50 AM, David Schmitt wrote:> > Sempahores are actually signalling entities. I can understand the > confusion > though. OTOH, "checkpoint" doesn''t really ring a bell with me > either. What > about just "defined resources"? It''s a bit of a mouthful though. :-(Ah. Semaphore is fine with me, it just confused me initially. Just make sure you add it to the glossary. :)>> We should create a ''design patterns'' page, pointing to this and other >> useful patterns. > > I could just add it to the puppet recipies. Much of those should go > to The > Repository anyways.It''s different than a recipe, though, which should normally be a chunk of code you can directly use. Instead, this is a pattern you can reuse for different applications.> Done at http://reductivelabs.com/trac/puppet/ticket/691Thanks. Now if someone would just add a patch.... :) -- The difference between scientists and engineers is that when engineers screw up, people die. -- Professor Orthlieb --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com