Class: Puppet::Provider::Tempest

Inherits:
Openstack
  • Object
show all
Extended by:
Openstack::Auth
Defined in:
lib/puppet/provider/tempest.rb

Class Method Summary collapse

Class Method Details

.request(service, action, properties = [], file_path) ⇒ Object



16
17
18
19
20
21
22
23
# File 'lib/puppet/provider/tempest.rb', line 16

def self.request(service, action, properties=[], file_path)
  @file_path = file_path
  begin
    super(service, action, properties)
  rescue Puppet::Error::OpenstackAuthInputError => error
    tempest_request(service, action, error, properties)
  end
end

.tempest_credentialsObject



39
40
41
42
43
44
45
46
47
48
# File 'lib/puppet/provider/tempest.rb', line 39

def self.tempest_credentials
  t = {}
  t['admin_user'] = tempest_file['auth']['admin_username']
  t['admin_password'] = tempest_file['auth']['admin_password']
  t['admin_project_name'] = tempest_file['auth']['admin_project_name']
  t['auth_endpoint'] = tempest_file['identity']['uri']
  t['auth_endpoint_v3'] = tempest_file['identity']['uri_v3']
  t['admin_domain_name'] = tempest_file['auth']['admin_domain_name']
  return t
end

.tempest_fileObject



9
10
11
12
13
14
# File 'lib/puppet/provider/tempest.rb', line 9

def self.tempest_file
  return @tempest_file if @tempest_file
  @tempest_file = Puppet::Util::IniConfig::File.new
  @tempest_file.read(@file_path)
  @tempest_file
end

.tempest_request(service, action, error, properties = nil) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/puppet/provider/tempest.rb', line 25

def self.tempest_request(service, action, error, properties=nil)
  @credentials.username = tempest_credentials['admin_user']
  @credentials.password = tempest_credentials['admin_password']
  @credentials.project_name = tempest_credentials['admin_project_name']
  @credentials.auth_url = tempest_credentials['auth_endpoint']
  if @credentials.version == '3'
    @credentials.user_domain_name = tempest_credentials['admin_domain_name']
    @credentials.project_domain_name = tempest_credentials['admin_domain_name']
    @credentials.auth_url = tempest_credentials['auth_endpoint_v3']
  end
  raise error unless @credentials.set?
  Puppet::Provider::Openstack.request(service, action, properties, @credentials)
end