Class: VmShepherd::VcloudManager

Inherits:
Object
  • Object
show all
Defined in:
lib/vm_shepherd/vcloud_manager.rb

Instance Method Summary collapse

Constructor Details

#initialize(login_info, vdc_name, logger) ⇒ VcloudManager

Returns a new instance of VcloudManager.



7
8
9
10
11
# File 'lib/vm_shepherd/vcloud_manager.rb', line 7

def initialize(, vdc_name, logger)
  @login_info = 
  @vdc_name   = vdc_name
  @logger     = logger
end

Instance Method Details

#clean_environment(vapp_names, catalog) ⇒ Object



41
42
43
44
# File 'lib/vm_shepherd/vcloud_manager.rb', line 41

def clean_environment(vapp_names, catalog)
  VmShepherd::Vcloud::Destroyer.new(client: client, vdc_name: @vdc_name).
    clean_catalog_and_vapps(catalog: catalog, vapp_names: vapp_names, logger: @logger)
end

#deploy(vapp_template_tar_path, vapp_config) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/vm_shepherd/vcloud_manager.rb', line 13

def deploy(vapp_template_tar_path, vapp_config)
  tmpdir = Dir.mktmpdir

  check_vapp_status(vapp_config)

  untar_vapp_template_tar(File.expand_path(vapp_template_tar_path), tmpdir)

  VmShepherd::Vcloud::Deployer.deploy_and_power_on_vapp(
    client:      client,
    ovf_dir:     tmpdir,
    vapp_config: vapp_config,
    vdc_name:    @vdc_name,
  )
rescue => e
  @logger.error(e.http_body) if e.respond_to?(:http_body)
  raise e
ensure
  FileUtils.remove_entry_secure(tmpdir, force: true)
end

#destroy(vapp_names, catalog) ⇒ Object



36
37
38
39
# File 'lib/vm_shepherd/vcloud_manager.rb', line 36

def destroy(vapp_names, catalog)
  VmShepherd::Vcloud::Destroyer.new(client: client, vdc_name: @vdc_name).
    clean_catalog_and_vapps(catalog: catalog, vapp_names: vapp_names, logger: @logger)
end

#prepare_environmentObject



33
34
# File 'lib/vm_shepherd/vcloud_manager.rb', line 33

def prepare_environment
end