Class: CloudstackSpec::Resource::Account

Inherits:
Base
  • Object
show all
Defined in:
lib/cloudstack_spec/resource/account.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
28
29
30
31
# File 'lib/cloudstack_spec/resource/account.rb', line 17

def created?
  if self.exist?
    puts "  Account already exist"
    return true
  else
     = @connection.(
      accounttype: 0,
      email: '[email protected]',
      firstname: 'cloudstack_spec',
      lastname: 'cloudstack_spec',
      password: 'password',
      domainid: $domainid ,
      username: @name)
  end
end

#destroy?Boolean

Returns:

  • (Boolean)


33
34
35
36
37
38
39
40
41
42
43
# File 'lib/cloudstack_spec/resource/account.rb', line 33

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/account.rb', line 5

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

#registerUserKeysObject



45
46
47
48
49
50
# File 'lib/cloudstack_spec/resource/account.rb', line 45

def registerUserKeys
  keys = user_keys
  puts "      apikey    = #{keys['apikey']}"
  puts "      secretkey = #{keys['secretkey']}"
  return true
end