Class: CloudstackSpec::Resource::Template

Inherits:
Base
  • Object
show all
Defined in:
lib/cloudstack_spec/resource/template.rb

Instance Attribute Summary

Attributes inherited from Base

#name

Instance Method Summary collapse

Methods inherited from Base

#get_zone, #initialize, #inspect, #job_status?, #to_ary, #to_s

Constructor Details

This class inherits a constructor from CloudstackSpec::Resource::Base

Instance Method Details

#create_from_vm(origin_vm) ⇒ Object



35
36
37
# File 'lib/cloudstack_spec/resource/template.rb', line 35

def create_from_vm(origin_vm)
  origin_vm
end

#exist?Boolean

Returns:

  • (Boolean)


9
10
11
12
13
14
15
16
17
18
19
# File 'lib/cloudstack_spec/resource/template.rb', line 9

def exist?
  begin  
    if tpl['count'].nil?
      return false
    else
      return true
    end
  rescue Exception => e
    return false
  end
end

#ready?Boolean

Returns:

  • (Boolean)


21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/cloudstack_spec/resource/template.rb', line 21

def ready?
  if ! tpl["count"].nil?
    isready = tpl["template"].first["isready"]
    if isready
    	return true
    else
      return tpl["template"].first["status"]
    end
  else
    return "#{name}: not found"
    #return false
  end
end

#tplObject

do nothing



5
6
7
# File 'lib/cloudstack_spec/resource/template.rb', line 5

def tpl
  @connection.list_templates(:templatefilter => "all", :name => name)
end