Matt Wise
2010-Oct-20 15:02 UTC
[Puppet Users] Pulling in a Hash from an external data source?
I have a scenario where I''d like to pull in a hash table from an external file (really, a generate() function.. but for testing purposes, a file will do)... is there any way to do that? —Matt -- 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.
Matt Wise
2010-Oct-22 00:17 UTC
[Puppet Users] Pulling in a Hash from an external data source?
I have a scenario where I''d like to pull in a hash table from an external file (really, a generate() function.. but for testing purposes, a file will do)... is there any way to do that? —Matt -- 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.
Richard Crowley
2010-Oct-22 00:41 UTC
Re: [Puppet Users] Pulling in a Hash from an external data source?
On Thu, Oct 21, 2010 at 5:17 PM, Matt Wise <wise@wiredgeek.net> wrote:> I have a scenario where I''d like to pull in a hash table from an external file (really, a generate() function.. but for testing purposes, a file will do)... is there any way to do that?You probably want the extlookup function: http://docs.puppetlabs.com/references/latest/function.html#extlookup -- 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.
Dennis Hoppe
2010-Oct-22 16:50 UTC
Re: [Puppet Users] Pulling in a Hash from an external data source?
Hello Richard, Am 22.10.2010 02:41, schrieb Richard Crowley:> On Thu, Oct 21, 2010 at 5:17 PM, Matt Wise <wise@wiredgeek.net> wrote: >> I have a scenario where I''d like to pull in a hash table from an external file (really, a generate() function.. but for testing purposes, a file will do)... is there any way to do that? > > You probably want the extlookup function: > > http://docs.puppetlabs.com/references/latest/function.html#extlookupi do not think that "extlookup" is the solution we are looking for, because it is not powerful enough. For some kind of modules you will need the relation between host an ip, or host an service. At the moment, i am using a bunch of if/else cases, but a hash or function which is parsing a *.yaml file would be more powerful. The Debian project has found a nice way to handle this. http://git.debian.org/?p=mirror/dsa-puppet.git;a=blob_plain;f=manifests/site.pp;hb=HEAD http://git.debian.org/?p=mirror/dsa-puppet.git;a=tree;f=files/etc/puppet/lib/puppet/parser/functions;hb=HEAD Regards, Dennis
Matt Wise
2010-Oct-22 21:57 UTC
Re: [Puppet Users] Pulling in a Hash from an external data source?
Agreed... I use extlookup for our external arrays — but I cannot use it for hash''s. Hashes are sometimes the only sane way to go, so I''m hoping to see more advanced hash support soon. Really we have a case where we''re going to be pulling live data from a SQL database during each run, and dumping it out in a hash format of some kind is the best thing for our use-case. —Matt On Oct 22, 2010, at 9:50 AM, Dennis Hoppe wrote:> Hello Richard, > > Am 22.10.2010 02:41, schrieb Richard Crowley: >> On Thu, Oct 21, 2010 at 5:17 PM, Matt Wise <wise@wiredgeek.net> wrote: >>> I have a scenario where I''d like to pull in a hash table from an external file (really, a generate() function.. but for testing purposes, a file will do)... is there any way to do that? >> >> You probably want the extlookup function: >> >> http://docs.puppetlabs.com/references/latest/function.html#extlookup > > i do not think that "extlookup" is the solution we are looking for, > because it is not powerful enough. > > For some kind of modules you will need the relation between host an ip, > or host an service. At the moment, i am using a bunch of if/else cases, > but a hash or function which is parsing a *.yaml file would be more > powerful. > > The Debian project has found a nice way to handle this. > > http://git.debian.org/?p=mirror/dsa-puppet.git;a=blob_plain;f=manifests/site.pp;hb=HEAD > > http://git.debian.org/?p=mirror/dsa-puppet.git;a=tree;f=files/etc/puppet/lib/puppet/parser/functions;hb=HEAD > > Regards, Dennis >-- 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.
R.I.Pienaar
2010-Oct-22 22:07 UTC
Re: [Puppet Users] Pulling in a Hash from an external data source?
----- "Matt Wise" <wise@wiredgeek.net> wrote:> Agreed... I use extlookup for our external arrays — but I cannot use > it for hash''s. Hashes are sometimes the only sane way to go, so I''m > hoping to see more advanced hash support soon. Really we have a case > where we''re going to be pulling live data from a SQL database during > each run, and dumping it out in a hash format of some kind is the best > thing for our use-case.I''ve patched the 2.6.x extlookup to support hashes but people dont seem to keen on the idea, feel free to vote on the ticket http://projects.puppetlabs.com/issues/4433> > —Matt > > On Oct 22, 2010, at 9:50 AM, Dennis Hoppe wrote: > > > Hello Richard, > > > > Am 22.10.2010 02:41, schrieb Richard Crowley: > >> On Thu, Oct 21, 2010 at 5:17 PM, Matt Wise <wise@wiredgeek.net> > wrote: > >>> I have a scenario where I''d like to pull in a hash table from an > external file (really, a generate() function.. but for testing > purposes, a file will do)... is there any way to do that? > >> > >> You probably want the extlookup function: > >> > >> > http://docs.puppetlabs.com/references/latest/function.html#extlookup > > > > i do not think that "extlookup" is the solution we are looking for, > > because it is not powerful enough. > > > > For some kind of modules you will need the relation between host an > ip, > > or host an service. At the moment, i am using a bunch of if/else > cases, > > but a hash or function which is parsing a *.yaml file would be more > > powerful. > > > > The Debian project has found a nice way to handle this. > > > > > http://git.debian.org/?p=mirror/dsa-puppet.git;a=blob_plain;f=manifests/site.pp;hb=HEAD > > > > > http://git.debian.org/?p=mirror/dsa-puppet.git;a=tree;f=files/etc/puppet/lib/puppet/parser/functions;hb=HEAD > > > > Regards, Dennis > > > > -- > 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.-- R.I.Pienaar -- 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.
Matthew Macdonald-Wallace
2010-Oct-24 07:46 UTC
Re: [Puppet Users] Pulling in a Hash from an external data source?
On Fri, 2010-10-22 at 14:57 -0700, Matt Wise wrote:> Agreed... I use extlookup for our external arrays — but I cannot use it for hash''s. Hashes are sometimes the only sane way to go, so I''m hoping to see more advanced hash support soon. Really we have a case where we''re going to be pulling live data from a SQL database during each run, and dumping it out in a hash format of some kind is the best thing for our use-case.I''ve got a script on Github that allows you to turn the ''ksmeta'' field from Cobbler into custom facts, I''m sure it wouldn''t take too much to turn it into a hash-lookup script as this is effectively what it does anyway... The script is at http://github.com/proffalken/cobbler-puppet/blob/master/puppet/lib/facter/system_setup.rb Kind regards, Matt -- 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.