Class: Opsmgr::BoshCommandRunner

Inherits:
Object
  • Object
show all
Defined in:
lib/opsmgr/bosh_command_runner.rb

Instance Method Summary collapse

Constructor Details

#initialize(iaas_gateway:, bosh_command:, logger:) ⇒ BoshCommandRunner

Returns a new instance of BoshCommandRunner.



3
4
5
6
7
# File 'lib/opsmgr/bosh_command_runner.rb', line 3

def initialize(iaas_gateway:, bosh_command:, logger:)
  @iaas_gateway = iaas_gateway
  @bosh_command = bosh_command
  @logger = logger
end

Instance Method Details

#run(command) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/opsmgr/bosh_command_runner.rb', line 9

def run(command)
  iaas_gateway.gateway do
    system_or_fail(
      "#{bosh_command_prefix} #{command}",
      "bosh #{command} failed"
    )
  end
end

#run_and_capture_output(command) ⇒ Object



18
19
20
21
22
23
24
25
# File 'lib/opsmgr/bosh_command_runner.rb', line 18

def run_and_capture_output(command)
  iaas_gateway.gateway do
    capture_output_or_fail(
      "#{bosh_command_prefix} #{command}",
      "bosh #{command} failed"
    )
  end
end