class Knife::Clc::Bootstrap::Bootstrapper

Attributes

cloud_adapter[R]
config[R]
errors[R]

Public Class Methods

new(params) click to toggle source
# File lib/knife-clc/bootstrap/bootstrapper.rb, line 16
def initialize(params)
  @cloud_adapter = params.fetch(:cloud_adapter)
  @config = params.fetch(:config)
  @errors = params.fetch(:errors)
end

Public Instance Methods

async_bootstrap(launch_parameters) click to toggle source
# File lib/knife-clc/bootstrap/bootstrapper.rb, line 26
def async_bootstrap(launch_parameters)
  async_bootstrap_method.execute(launch_parameters)
end
prepare() click to toggle source
# File lib/knife-clc/bootstrap/bootstrapper.rb, line 30
def prepare
  validator.validate
end
sync_bootstrap(server) click to toggle source
# File lib/knife-clc/bootstrap/bootstrapper.rb, line 22
def sync_bootstrap(server)
  sync_bootstrap_method.execute(server)
end

Private Instance Methods

async_bootstrap_method() click to toggle source
# File lib/knife-clc/bootstrap/bootstrapper.rb, line 73
def async_bootstrap_method
  case config[:clc_bootstrap_platform]
  when 'linux'
    Methods::AsyncLinuxPackage.new(
      :config => config,
      :subcommand_loader => subcommand_loader
    )
  when 'windows'
    Methods::AsyncWindowsPackage.new(
      :config => config,
      :subcommand_loader => subcommand_loader
    )
  else
    raise 'No suitable bootstrap method found'
  end
end
connectivity_helper() click to toggle source
# File lib/knife-clc/bootstrap/bootstrapper.rb, line 44
def connectivity_helper
  @connectivity_helper ||= ConnectivityHelper.new
end
subcommand_loader() click to toggle source
# File lib/knife-clc/bootstrap/bootstrapper.rb, line 48
def subcommand_loader
  @subcommand_loader ||= SubcommandLoader.new
end
sync_bootstrap_method() click to toggle source
# File lib/knife-clc/bootstrap/bootstrapper.rb, line 52
def sync_bootstrap_method
  case config[:clc_bootstrap_platform]
  when 'linux'
    Methods::SyncLinuxSsh.new(
      :cloud_adapter => cloud_adapter,
      :config => config,
      :connectivity_helper => connectivity_helper,
      :subcommand_loader => subcommand_loader
    )
  when 'windows'
    Methods::SyncWindowsWinrm.new(
      :cloud_adapter => cloud_adapter,
      :config => config,
      :connectivity_helper => connectivity_helper,
      :subcommand_loader => subcommand_loader
    )
  else
    raise 'No suitable bootstrap method found'
  end
end
validator() click to toggle source
# File lib/knife-clc/bootstrap/bootstrapper.rb, line 36
def validator
  @validator ||= Validator.new(
    :connection => cloud_adapter.connection,
    :config => config,
    :errors => errors
  )
end