I want to create 3-5 custom functions, in different modules, that will be retrieve different information from ldap. But i don''t wan''t to copy-pastenot-so-simple ldap login code between different functions. How can i prepare connection to ldap server before compiling recipes, use this connection from all of my functions and close it when puppet run finished? -- 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.
Michael DeHaan
2010-Apr-30 13:23 UTC
Re: [Puppet Users] how to keep persistent ldap connection
On Fri, Apr 30, 2010 at 7:06 AM, walexey <walexey@gmail.com> wrote:> I want to create 3-5 custom functions, in different modules, that will > be retrieve different information from ldap. > But i don''t wan''t to copy-pastenot-so-simple ldap login code between > different functions. How can i prepare connection to ldap server > before compiling recipes, use this connection from all of my functions > and close it when puppet run finished?Presently I''d say this is not possible without modifications to the core Puppet code itself, so it could hold on to the handle and assign it to a variable the other functions could access. That may not actually be that complicated, and that is something I''d like to be able to see -- so perhaps someone can correct me if I''m wrong or suggest a route to do this. I''d certaintly write your plugin code to know to reconnect if the connection wasn''t open, such as using a Singleton LDAP connection object. (This makes a lot of sense with database connections too, should a plugin want to query a database) --Michael -- 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.