Hi, I've just thrown together a customised version of the execute resource, called execute_with_key, and, while it works, I'd like to know if I'm tackling it the right way, or how else I should be doing it? Basic premise: it's exactly the same as "execute", but it takes an extra argument, called "key", which points to the ssh key the command would like to have available when it runs. It will then run the command inside an ssh-agent, add that key, then run the command. Here's my attempt:
Couple of things: * I ought to be escaping single quotes in the command that's passed in to avoid trouble; I'll get to that shortly. * Have I tackled it in the right way? I'm still a little hazy on the Provider/Resource split, so I'm wondering if I've put things in the wrong place? * Have I managed to change the semantics of command in this subclass? That would be suboptimal because it's meant to behave identically other than the ssh-agent support. :-) Cheers, Graeme. -- Graeme Mathieson Managing Director Rubaidh Ltd: Scottish for Ruby on Rails Follow us on Twitter: <http://twitter.com/rubaidh> and <http://twitter.com/mathie> Blog: <http://woss.name/> Telephone: +44 (0)131 273 5271 Mobile: +44 (0)7949 0777 44 Rubaidh Ltd is a limited company registered in Scotland with registration number SC297029 and VAT number GB 916 0341 53. The registered address is: Stuart House, Eskmills, Musselburgh, East Lothian, EH21 7PB, United Kingdom. |
Archive powered by MHonArc 2.6.16.