[Puppet Users] Re: Accessing Facter in other languages than Ruby?

2010-10-25 Thread macwall


On Oct 25, 2:36 am, Daniel Pittman dan...@rimspace.net wrote:

  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.

That's a good point and has started me thinking about how I could
implement this... :)

 For my site I would probably deploy this as /etc/cron.d/get-facts:
 */15 * * * *  root  /usr/bin/facter --puppet --yaml  /var/tmp/facts.yaml

 Then you could parse that YAML file as whatever user at whatever time, without
 having to worry about root access to collect them or whatever.

Hmmm, I'm currently thinking along the lines of:

=-=-=-=-=-=-=-=-=-=
import os
import yaml

cmd = facter --puppet --yaml

facts_dict  = yaml.load(cmd)

# Do x with facts
=-=-=-=-=-=-=-=-=-=

 (...or just use mcollective :)

LOL, we're already using MCollective, this is for a project I'm
working on that will (eventually) enable us to interface MCollective
with other languages from a client-basis, not just an agent.

Cheers,

M.

-- 
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.



Re: [Puppet Users] Re: Accessing Facter in other languages than Ruby?

2010-10-25 Thread R.I.Pienaar

- macwall mattmacw...@gmail.com wrote:

 LOL, we're already using MCollective, this is for a project I'm
 working on that will (eventually) enable us to interface MCollective
 with other languages from a client-basis, not just an agent.

would you mind elaborating on this?  Other language support is on my list
of things to do, would be good to get peoples wishes captured for when I 
start down that route

-- 
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-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.



MCollective Client Languages (WAS Re: [Puppet Users] Re: Accessing Facter in other languages than Ruby?)

2010-10-25 Thread lists

Quoting R.I.Pienaar r...@devco.net:



- macwall mattmacw...@gmail.com wrote:


LOL, we're already using MCollective, this is for a project I'm
working on that will (eventually) enable us to interface MCollective
with other languages from a client-basis, not just an agent.


would you mind elaborating on this?  Other language support is on my list
of things to do, would be good to get peoples wishes captured for when I
start down that route

Sure.

We have a team of system administrators within our organisation who love the
look and power of MCollective but are currently unable to utilise it fully
as they don't know ruby (for some reason Python is the language of choice
here!).

I'm writing a new web interface for our change management system that will b=
e
written in DJango, it would be really nice to be able to trigger mcollective
actions as part of a change request, but without Python bindings we need to
run the SIMPLERPC sinatra client (and we need to make adjustments to it!) so
we can use a web interface to send a request to a second API that is running
on the same server as the original web interface (more on this at a later da=
te
as I'm also planning on releasing it under a BSD-style license).

As I'm currently the only SysAd that has even a vague idea about Ruby within
my organisation (and my idea of Ruby is very vague as those of you who have
seen my code will know!) I'm also the only person who can extend MCollective
and write new agents.  I'm also therefore the only one who can write new
clients for our support teams to use, where as if I could write clients in
another language, I could hand out the work across the team - infact, some o=
f
our support guys could even write their own tools!


Let me know if you would like any more on the above, I'm only to happy to he=
lp
- Mcollective and puppet are amazing tools and it really is about time I
started giving back to the community! ;)

Cheers,

M.

--
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.



Re: MCollective Client Languages (WAS Re: [Puppet Users] Re: Accessing Facter in other languages than Ruby?)

2010-10-25 Thread R.I.Pienaar

- li...@truthisfreedom.org.uk wrote:

 We have a team of system administrators within our organisation who love the
 look and power of MCollective but are currently unable to utilise it fully
 as they don't know ruby (for some reason Python is the language of
 choice here!).
 
 I'm writing a new web interface for our change management system that will be
 written in DJango, it would be really nice to be able to trigger mcollective
 actions as part of a change request, but without Python bindings we need to
 run the SIMPLERPC sinatra client (and we need to make adjustments to it!) so
 we can use a web interface to send a request to a second API that is running
 on the same server as the original web interface (more on this at a later date
 as I'm also planning on releasing it under a BSD-style license).

OK, yeah the REST thing is nice and all but its more a demo of what you can do 
in 
a specific use case, writing a truely generic REST bridge might have value I am 
not
sure but it will be a PITA.

Ideally we'll get other languages to be clients directly obviously thats the 
biggest win.

Are you using the SSL security plugin? It uses YAML and there's some sample Perl
code that speaks to mcollective - at least mc-ping - in ext, it should be easy
to make any language that has a syck YAML library to work with mcollective.

Eventually I hope to have some nice libraries in the usual suspects like Perl,
Python and PHP but really I dont know or dont care enough for those languages
to bother doing it.  I'd gladly help someone who is keen to write such a 
library though.

We should probably also consider making JSON based serialization an option for
this kind of thing though I quite like that the Marshal and YAML based plugins
preserve data types 100% but that also risk making the thing ruby specific so
it's probably high time to make it so that we only support the primitives that
JSON supports.

 As I'm currently the only SysAd that has even a vague idea about Ruby
 within my organisation (and my idea of Ruby is very vague as those of you who
 have seen my code will know!) I'm also the only person who can extend
 MCollective and write new agents.  I'm also therefore the only one who can 
 write
 new clients for our support teams to use, where as if I could write
 clients in another language, I could hand out the work across the team - 
 infact,
 some of our support guys could even write their own tools!

The roadmap [1] covers some of what I have in mind for different languages,
essentially you'll be able to write a small ruby wrapper that defines the 
interface
of an agent but you can then provide the actions of an agent in any language 
and even
use different languages to build up one agent.

The ruby wrapper could be made using a generator so you might not even need to 
know
much of ruby.

Some way off still but thats the plan, 

[1] http://marionette-collective.org/roadmap/actions_in_other_languages.html

-- 
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.