class Bosh::Workspace::Tasks::BoshCommandRunner

Attributes

deployment_file[RW]
password[R]
target[R]
username[R]

Public Class Methods

new(target, username, password) click to toggle source
# File lib/bosh/workspace/tasks/bosh_command_runner.rb, line 6
def initialize(target, username, password)
  @target = target
  @username = username
  @password = password
  @shell = Bosh::Workspace::Shell.new
end

Public Instance Methods

run(command, options = {}) click to toggle source
# File lib/bosh/workspace/tasks/bosh_command_runner.rb, line 13
def run(command, options = {})
  options.merge! default_options
  args = ['-n', '-t', target]
  args.concat ['-d', deployment_file] if deployment_file
  @shell.run "bundle exec bosh #{args.join(' ')} #{command}", options
end

Private Instance Methods

default_options() click to toggle source
# File lib/bosh/workspace/tasks/bosh_command_runner.rb, line 22
def default_options
  {
    output_command: true,
    env: { "BOSH_USER" => username, "BOSH_PASSWORD" => password }
  }
end