Sha256: 60d49c144e036409b801806fd6eecfbff3de3329bb8163b82dde5f3fd6315352

Contents?: true

Size: 1.22 KB

Versions: 3

Compression:

Stored size: 1.22 KB

Contents

# Author::    Nicolas Pouillard  <ertai@lrde.epita.fr>.
# Copyright:: Copyright (c) 2004, 2005 TTK team. All rights reserved.
# License::   LGPL
# $Id: RemoteCmd.rb 567 2005-04-13 08:00:06Z polrop $


require 'ttk/Tools/HostDispatcher'

module TTK

  module Strategies

    # I'm not maintained any more, don't use me.
    class RemoteCmd < Cmd

      def prologue
	if @dispatcher
	  conf = @dispatcher.aConf
	  @login, @port, @hostname = conf.values_at :login, :port, :hostname
	end
	super
      end

      def mk_command
	cmd = 'ssh'
	cmd += " -l '#@login'" if @login
	cmd += " -p '#@port'" if @port
	cmd += " #@hostname #{super}"
      end
      protected :mk_command

      def dispatcher=(doc)
        raise ArgumentError, "require a `hosts' attribute" if doc[:hosts].nil?
	@dispatcher = TTK::Tools::HostDispatcher.instance
	@dispatcher.hosts = doc[:hosts]
      end

      attribute :hostname, 'the machine hostname where launch the command',
                           :mandatory
      attribute :port,     'the port for the remote connection'
      attribute :login,    'the login for the remote connection'
      attribute :dispatcher, 'the host dispatcher', :invisible

    end # class RemoteCmd

  end # module Strategies

end # module TTK

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ttk-0.1.576 lib/ttk/strategies/RemoteCmd.rb
ttk-0.1.579 lib/ttk/strategies/RemoteCmd.rb
ttk-0.1.580 lib/ttk/strategies/RemoteCmd.rb