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, location, logger) ⇒ VcloudManager

Returns a new instance of VcloudManager.



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

def initialize(, location, logger)
  @login_info = 
  @location = location
  @logger = logger
  raise 'VDC must be set' unless @location[:vdc]
  raise 'Catalog must be set' unless @location[:catalog]
  raise 'Network must be set' unless @location[:network]
end

Instance Method Details

#deploy(vapp_template_tar_path, vapp_config) ⇒ Object



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

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)

  vapp = deploy_vapp(tmpdir, vapp_config)
  reconfigure_vm(vapp, vapp_config)
  vapp.power_on
ensure
  FileUtils.remove_entry_secure(tmpdir, force: true)
end

#destroy(vapp_name) ⇒ Object



30
31
32
33
# File 'lib/vm_shepherd/vcloud_manager.rb', line 30

def destroy(vapp_name)
  delete_vapp(vapp_name)
  delete_catalog
end