class Fleet::Machine

Attributes

cluster[R]
id[R]
ip[R]
metadata[R]

Public Class Methods

new(cluster: nil, id: nil, ip: nil, metadata: nil) click to toggle source
# File lib/fleet/machine.rb, line 5
def initialize(cluster: nil, id: nil, ip: nil, metadata: nil)
  @cluster = cluster
  @id = id
  @ip = ip
  @metadata = metadata
end

Public Instance Methods

==(other_machine) click to toggle source
# File lib/fleet/machine.rb, line 27
def ==(other_machine)
  id == other_machine.id && ip == other_machine.ip
end
Also aliased as: eql?
controller() click to toggle source
# File lib/fleet/machine.rb, line 12
def controller
  cluster.controller
end
eql?(other_machine)
Alias for: ==
ssh(*command, port: 22) click to toggle source

run the command (string, array of command + args, whatever) and return stdout

# File lib/fleet/machine.rb, line 21
def ssh(*command, port: 22)
  runner = Fleetctl::Runner::SSH.new([*command].flatten.compact.join(' '))
  runner.run(host: ip, ssh_options: { port: port })
  runner.output
end
units() click to toggle source
# File lib/fleet/machine.rb, line 16
def units
  controller.units.select { |unit| unit.machine.id == id }
end