Class: Phase::CLI::SSH
Direct Known Subclasses
Constant Summary collapse
- DEFAULT_CONNECTION_STRING =
"ssh -A".freeze
Instance Attribute Summary collapse
-
#instance ⇒ Object
writeonly
Sets the attribute instance.
-
#username ⇒ Object
writeonly
Sets the attribute username.
Attributes inherited from Command
Instance Method Summary collapse
Methods inherited from Command
Methods included from Util::Console
Constructor Details
This class inherits a constructor from Phase::CLI::Command
Instance Attribute Details
#instance=(value) ⇒ Object
Sets the attribute instance
23 24 25 |
# File 'lib/phase/cli/ssh.rb', line 23 def instance=(value) @instance = value end |
#username=(value) ⇒ Object
Sets the attribute username
23 24 25 |
# File 'lib/phase/cli/ssh.rb', line 23 def username=(value) @username = value end |
Instance Method Details
#run ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/phase/cli/ssh.rb', line 25 def run parse_connection_string ssh_command = args.last if args.count > 1 if ssh_command # Force pseudo-tty allocation for remote console/tail tasks .conn = "ssh -At" if .conn == DEFAULT_CONNECTION_STRING log "running on instance #{ instance.resource.id }: `#{ ssh_command }'" exec "#{ .conn } #{ username }@#{ instance.resource.dns_name } #{ ssh_command }" else log "connecting to instance #{ instance.resource.id }..." exec "#{ .conn } #{ username }@#{ instance.resource.dns_name }" end end |