On Sun, Oct 24, 2010 at 9:44 AM, Nigel Kersten <ni...@explanatorygap.net>wrote:
> On Sun, Oct 24, 2010 at 5:23 AM, Daniel Pittman <dan...@rimspace.net> > wrote: > > Matthew Macdonald-Wallace <li...@truthisfreedom.org.uk> writes: > >> On Sun, 2010-10-24 at 00:44 -0700, Yushu Yao wrote: > >> > >>> Any reason you can't use facter the command line? > >>> E.g. call in python commands.getstatusoutput("facter") > >> > >> Because it's a dirty hack? ;) > > > > Internally facter does a lot of the same, FWIW. ;) > > Honestly, the vast majority of Facter facts are just shelling out > underneath as Daniel said. > > I can imagine a magical land where we have native Ruby bindings for > everything we currently shell out for, but it's not here yet... > > I do like the idea of community maintained wrappers around Facter to > at least make coding against Facter in other languages easier, as it > really won't be that much work. > http://projects.puppetlabs.com/issues/5093 filed, please watch if you're interested, and feel free to start sending patches around. I see this as something the community should be able to contribute and we ship as part of the source tarball. I'm happy to work with anyone on Python support. > > > I think what you probably want is 'facter --yaml', which emits the data > in a > > format easily consumed by other applications. Wrap, or cache, or process > that > > from your Python library and you have a nice, language independent way to > get > > that data. > > > > Which is essentially what you want, right? > > I think so. You'll want to work out how to simulate the '-p/--puppet' > option, but otherwise it's all just going to be yaml parsing. > > I see Matthew's concerns about security, but I'd argue you simply > wouldn't take input that gets used in actual commands. Facter doesn't > do this, and a wrapper script wouldn't either. > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To post to this group, send email to puppet-us...@googlegroups.com. > To unsubscribe from this group, send email to > puppet-users+unsubscr...@googlegroups.com<puppet-users%2bunsubscr...@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-us...@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.