Class: CloudstackSpec::Resource::Project

Inherits:
Base
  • Object
show all
Defined in:
lib/cloudstack_spec/resource/project.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

#created?Boolean

Returns:

  • (Boolean)


17
18
19
20
21
22
23
24
25
26
27
# File 'lib/cloudstack_spec/resource/project.rb', line 17

def created?
  if self.exist?
    puts "  Project already exist"
    return true
  else
    project = @connection.create_project(
      displaytext: @name,
      name: @name)
    job_status?(project['jobid'])
  end
end

#destroy?Boolean

Returns:

  • (Boolean)


29
30
31
32
33
34
35
36
37
38
39
# File 'lib/cloudstack_spec/resource/project.rb', line 29

def destroy?
  sleep(5)
  if self.exist?
    job = @connection.(id: )
    return job_status?(job['jobid'])
  else
    puts "  Account does not exist"
    return false
  end

end

#exist?Boolean

handle domain objects.

Returns:

  • (Boolean)


5
6
7
8
9
10
11
12
13
14
15
# File 'lib/cloudstack_spec/resource/project.rb', line 5

def exist?
  begin
    if project.empty?
      return false
    else
      return true
    end
  rescue Exception => e
    return false
  end
end