Module: Chef::Knife::VcVDCCommon

Included in:
VcOvfUpload, VcVappCreate, VcVdcShow
Defined in:
lib/chef/knife/common/vc_vdc_common.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(includer) ⇒ Object



22
23
24
25
26
27
28
29
# File 'lib/chef/knife/common/vc_vdc_common.rb', line 22

def self.included(includer)
  includer.class_eval do
    option :vcloud_org,
           :long => "--org ORG_NAME",
           :description => "Organization to whom VDC belongs",
           :proc => Proc.new { |key| Chef::Config[:knife][:vcloud_org] = key }
  end
end

Instance Method Details

#get_vdc(vdc_arg) ⇒ Object

Raises:

  • (ArgumentError)


31
32
33
34
35
36
37
38
39
40
# File 'lib/chef/knife/common/vc_vdc_common.rb', line 31

def get_vdc(vdc_arg)
  vdc = nil
  org_name = locate_org_option

  org = connection.get_organization_by_name org_name
  vdc = connection.get_vdc_by_name org, vdc_arg

  raise ArgumentError, "VDC #{vdc_arg} not found" unless vdc
  vdc
end