- From: Adam Jacob <
>
- To:
- Subject: [chef] Re: Re: A command within the context of an ssh-agent session
- Date: Tue, 4 Aug 2009 10:32:09 -0700
On Wed, Jul 29, 2009 at 7:13 AM, Graeme
Mathieson<
>
wrote:
>
OK, the observant among you will have noticed that this couldn't possibly
>
work because I haven't even registered the provider, never mind told it
>
which provider to use by default (through @resource_name). ;-) Here's
>
another attempt and this one really does appear to be working. Feedback
>
would be much appreciated!
>
>
class Chef
>
class Provider
>
class ExecuteWithKey < Execute
>
def action_run
>
if @new_resource.key
>
>
>
"ssh-agent bash -c \'ssh-add
>
;
>
>
'"
>
end
>
super
>
end
>
end
>
end
>
class Resource
>
class ExecuteWithKey < Execute
>
def initialize(name, collection = nil, node = nil)
>
super
>
>
>
= :execute_with_key
>
>
>
= nil
>
end
>
def key(arg = nil)
>
set_or_return(:key, arg, :kind_of => [ String ])
>
end
>
end
>
end
>
end
>
Chef::Platform.set(
>
:resource => :execute_with_key,
>
:provider => Chef::Provider::ExecuteWithKey
>
)
Sorry it took so long for me to follow this up - yeah, this looks
reasonable. Another way to accomplish this would be with definitions
- you could basically just pass all the arguments to execute directly,
and if you have the 'key' param, munge the command in advance.
Adam
--
Opscode, Inc.
Adam Jacob, CTO
T: (206) 508-7449 E:
- [chef] Re: Re: A command within the context of an ssh-agent session, Adam Jacob, 08/04/2009
Archive powered by MHonArc 2.6.16.