Hi Experts, As far as I can see custom functions run on the server, right? Is there way to make them run on the Client? Thanks -Yushu -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Eric Sorenson
2010-Dec-13 18:54 UTC
Re: [Puppet Users] Custom Functions that runs on the Client?
Functions are executed when parsing a manifest, which a client doesn''t do -- a client applies a catalog. So it doesn''t make sense to run a manifest parser on a client. What is the problem you are trying to solve? On Dec 13, 2010, at 10:37 AM, Yushu Yao wrote:> Hi Experts, > > As far as I can see custom functions run on the server, right? > Is there way to make them run on the Client? > > Thanks > > -Yushu > > > -- > You received this message because you are subscribed to the Google Groups "Puppet Users" group. > To post to this group, send email to puppet-users@googlegroups.com. > To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Yushu Yao
2010-Dec-13 18:59 UTC
Re: [Puppet Users] Custom Functions that runs on the Client?
Thanks Eric, I am trying to implement some function tests. E.g. in my catalog for node B there is LDAP client, however, I would like to do a test to see if the LDAP server is already up and running. And decide if I want to apply the LDAP Client or not. (This is a test on remote resource, I might also need to test a resource local to the client, e.g. existence of a file, a service is running, etc). Maybe I can use custom facter for this? Thank a lot -Yushu +-------------------------------------------------+ | Yushu Yao | Ph:1-510-486-4690 | | Lawrence Berkeley National Lab | Mailstop 50B-6222 | 1 Cyclotron Road | Berkeley CA 94720-8147 - USA +-------------------------------------------------+ On Mon, Dec 13, 2010 at 10:54 AM, Eric Sorenson <eric.sorenson@me.com>wrote:> Functions are executed when parsing a manifest, which a client doesn''t do > -- a client applies a catalog. > > So it doesn''t make sense to run a manifest parser on a client. > > What is the problem you are trying to solve? > > On Dec 13, 2010, at 10:37 AM, Yushu Yao wrote: > > > Hi Experts, > > > > As far as I can see custom functions run on the server, right? > > Is there way to make them run on the Client? > > > > Thanks > > > > -Yushu > > > > > > -- > > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > > To post to this group, send email to puppet-users@googlegroups.com. > > To unsubscribe from this group, send email to > puppet-users+unsubscribe@googlegroups.com<puppet-users%2Bunsubscribe@googlegroups.com> > . > > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en. > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To post to this group, send email to puppet-users@googlegroups.com. > To unsubscribe from this group, send email to > puppet-users+unsubscribe@googlegroups.com<puppet-users%2Bunsubscribe@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en. > >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Eric Sorenson
2010-Dec-13 19:08 UTC
Re: [Puppet Users] Custom Functions that runs on the Client?
On Dec 13, 2010, at 10:59 AM, Yushu Yao wrote:> I am trying to implement some function tests. E.g. in my catalog for node B there is LDAP client, however, I would like to do a test to see if the LDAP server is already up and running. And decide if I want to apply the LDAP Client or not. (This is a test on remote resource, I might also need to test a resource local to the client, e.g. existence of a file, a service is running, etc). > > Maybe I can use custom facter for this?You could do that, but a more puppet-y way to think about this is to decide what hosts ought to be servers and use puppet to start the service there. Puppet thinks you should be the boss of your machines. - Eric Sorenson - N37 17.255 W121 55.738 - http://twitter.com/ahpook - -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Yushu Yao
2010-Dec-13 19:12 UTC
Re: [Puppet Users] Custom Functions that runs on the Client?
Thanks, Another question, when are the facts loaded? In the beginning of the puppetd run? -Yushu +-------------------------------------------------+ | Yushu Yao | Ph:1-510-486-4690 | | Lawrence Berkeley National Lab | Mailstop 50B-6222 | 1 Cyclotron Road | Berkeley CA 94720-8147 - USA +-------------------------------------------------+ On Mon, Dec 13, 2010 at 11:08 AM, Eric Sorenson <eric.sorenson@me.com>wrote:> > On Dec 13, 2010, at 10:59 AM, Yushu Yao wrote: > > I am trying to implement some function tests. E.g. in my catalog for node B > there is LDAP client, however, I would like to do a test to see if the LDAP > server is already up and running. And decide if I want to apply the LDAP > Client or not. (This is a test on remote resource, I might also need to test > a resource local to the client, e.g. existence of a file, a service is > running, etc). > > Maybe I can use custom facter for this? > > > You could do that, but a more puppet-y way to think about this is to decide > what hosts ought to be servers and use puppet to start the service there. > Puppet thinks you should be the boss of your machines. > > > - Eric Sorenson - N37 17.255 W121 55.738 - http://twitter.com/ahpook - > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To post to this group, send email to puppet-users@googlegroups.com. > To unsubscribe from this group, send email to > puppet-users+unsubscribe@googlegroups.com<puppet-users%2Bunsubscribe@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en. >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Yushu Yao
2010-Dec-13 20:56 UTC
Re: [Puppet Users] Custom Functions that runs on the Client?
Another though: Can I do something like if $(return value of an Exec resource)==0 { } else {} I.e. I want to run an shell command first, and do something depend on the output of the command? Thanks -Yushu +-------------------------------------------------+ | Yushu Yao | Ph:1-510-486-4690 | | Lawrence Berkeley National Lab | Mailstop 50B-6222 | 1 Cyclotron Road | Berkeley CA 94720-8147 - USA +-------------------------------------------------+ On Mon, Dec 13, 2010 at 11:12 AM, Yushu Yao <yyao@lbl.gov> wrote:> Thanks, > > Another question, when are the facts loaded? In the beginning of the > puppetd run? > > -Yushu > > +-------------------------------------------------+ > | Yushu Yao > | Ph:1-510-486-4690 > | > | Lawrence Berkeley National Lab > | Mailstop 50B-6222 > | 1 Cyclotron Road > | Berkeley CA 94720-8147 - USA > +-------------------------------------------------+ > > > > > On Mon, Dec 13, 2010 at 11:08 AM, Eric Sorenson <eric.sorenson@me.com>wrote: > >> >> On Dec 13, 2010, at 10:59 AM, Yushu Yao wrote: >> >> I am trying to implement some function tests. E.g. in my catalog for node >> B there is LDAP client, however, I would like to do a test to see if the >> LDAP server is already up and running. And decide if I want to apply the >> LDAP Client or not. (This is a test on remote resource, I might also need to >> test a resource local to the client, e.g. existence of a file, a service is >> running, etc). >> >> Maybe I can use custom facter for this? >> >> >> You could do that, but a more puppet-y way to think about this is to >> decide what hosts ought to be servers and use puppet to start the service >> there. Puppet thinks you should be the boss of your machines. >> >> >> - Eric Sorenson - N37 17.255 W121 55.738 - http://twitter.com/ahpook >> - >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Puppet Users" group. >> To post to this group, send email to puppet-users@googlegroups.com. >> To unsubscribe from this group, send email to >> puppet-users+unsubscribe@googlegroups.com<puppet-users%2Bunsubscribe@googlegroups.com> >> . >> For more options, visit this group at >> http://groups.google.com/group/puppet-users?hl=en. >> > >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Nigel Kersten
2010-Dec-14 01:29 UTC
Re: [Puppet Users] Custom Functions that runs on the Client?
On Mon, Dec 13, 2010 at 12:56 PM, Yushu Yao <yyao@lbl.gov> wrote:> Another though: > > Can I do something like > if $(return value of an Exec resource)==0 { > } else {} > > I.e. I want to run an shell command first, and do something depend on the > output of the command. >You probably want to make the shell command a fact, and then case on the fact inside your manifests on the server. Facts are synced at the start of the run and evaluated.> > Thanks > > > -Yushu > > +-------------------------------------------------+ > | Yushu Yao > | Ph:1-510-486-4690 > | > | Lawrence Berkeley National Lab > | Mailstop 50B-6222 > | 1 Cyclotron Road > | Berkeley CA 94720-8147 - USA > +-------------------------------------------------+ > > > > > On Mon, Dec 13, 2010 at 11:12 AM, Yushu Yao <yyao@lbl.gov> wrote: > >> Thanks, >> >> Another question, when are the facts loaded? In the beginning of the >> puppetd run? >> >> -Yushu >> >> +-------------------------------------------------+ >> | Yushu Yao >> | Ph:1-510-486-4690 >> | >> | Lawrence Berkeley National Lab >> | Mailstop 50B-6222 >> | 1 Cyclotron Road >> | Berkeley CA 94720-8147 - USA >> +-------------------------------------------------+ >> >> >> >> >> On Mon, Dec 13, 2010 at 11:08 AM, Eric Sorenson <eric.sorenson@me.com>wrote: >> >>> >>> On Dec 13, 2010, at 10:59 AM, Yushu Yao wrote: >>> >>> I am trying to implement some function tests. E.g. in my catalog for node >>> B there is LDAP client, however, I would like to do a test to see if the >>> LDAP server is already up and running. And decide if I want to apply the >>> LDAP Client or not. (This is a test on remote resource, I might also need to >>> test a resource local to the client, e.g. existence of a file, a service is >>> running, etc). >>> >>> Maybe I can use custom facter for this? >>> >>> >>> You could do that, but a more puppet-y way to think about this is to >>> decide what hosts ought to be servers and use puppet to start the service >>> there. Puppet thinks you should be the boss of your machines. >>> >>> >>> - Eric Sorenson - N37 17.255 W121 55.738 - http://twitter.com/ahpook >>> - >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "Puppet Users" group. >>> To post to this group, send email to puppet-users@googlegroups.com. >>> To unsubscribe from this group, send email to >>> puppet-users+unsubscribe@googlegroups.com<puppet-users%2Bunsubscribe@googlegroups.com> >>> . >>> For more options, visit this group at >>> http://groups.google.com/group/puppet-users?hl=en. >>> >> >> > -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To post to this group, send email to puppet-users@googlegroups.com. > To unsubscribe from this group, send email to > puppet-users+unsubscribe@googlegroups.com<puppet-users%2Bunsubscribe@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en. >-- Nigel Kersten - Puppet Labs - http://www.puppetlabs.com -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Martijn Grendelman
2010-Dec-14 08:41 UTC
Re: [Puppet Users] Custom Functions that runs on the Client?
Hi,> On Mon, Dec 13, 2010 at 12:56 PM, Yushu Yao <yyao@lbl.gov > <mailto:yyao@lbl.gov>> wrote: > > Another though: > > Can I do something like > if $(return value of an Exec resource)==0 { > } else {} > > I.e. I want to run an shell command first, and do something depend on > the output of the command. > > > You probably want to make the shell command a fact, and then case on the > fact inside your manifests on the server.What about ''onlyif'' and ''unless''? But I also have custom facts that -for example- check if a local directory or its contents have changed before I run an Exec or a Concat... Best regards, Martijn. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Felix Frank
2010-Dec-14 13:06 UTC
Re: [Puppet Users] Custom Functions that runs on the Client?
On 12/13/2010 07:59 PM, Yushu Yao wrote:> Thanks Eric, > > I am trying to implement some function tests. E.g. in my catalog for > node B there is LDAP client, however, I would like to do a test to see > if the LDAP server is already up and running. And decide if I want to > apply the LDAP Client or not. (This is a test on remote resource, I > might also need to test a resource local to the client, e.g. existence > of a file, a service is running, etc).This is actually an interesting problem I''ve been wondering about myself recently. Specifically, it passed my mined to exploit stored configs, i.e. I can tell puppet to only generate client catalogues if the corresponding server has been set up by puppet already. (LDAP is not a good example for this, I picture NFS setups etc. instead, with n servers known to puppet and k*n clients.) Any thoughts? Cheers, Felix -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.