Stop using urljoin when adding v3
[functest.git] / functest / opnfv_tests / openstack / barbican / barbican.py
1 #!/usr/bin/env python
2
3 # Copyright (c) 2018 Orange and others.
4 #
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9
10 # pylint: disable=missing-docstring
11
12 import logging
13
14 from six.moves import configparser
15
16 from functest.opnfv_tests.openstack.tempest import tempest
17
18
19 class Barbican(tempest.TempestCommon):
20
21     __logger = logging.getLogger(__name__)
22
23     def configure(self, **kwargs):
24         super(Barbican, self).configure(**kwargs)
25         rconfig = configparser.RawConfigParser()
26         rconfig.read(self.conf_file)
27         if not rconfig.has_section('auth'):
28             rconfig.add_section('auth')
29         rconfig.set('auth', 'tempest_roles', 'creator')
30         if not rconfig.has_section('glance'):
31             rconfig.add_section('glance')
32         rconfig.set('glance', 'verify_glance_signatures', True)
33         if not rconfig.has_section('ephemeral_storage_encryption'):
34             rconfig.add_section('ephemeral_storage_encryption')
35         rconfig.set('ephemeral_storage_encryption', 'enabled', True)
36         if not rconfig.has_section('image-feature-enabled'):
37             rconfig.add_section('image-feature-enabled')
38         rconfig.set('image-feature-enabled', 'api_v1', False)
39         with open(self.conf_file, 'wb') as config_file:
40             rconfig.write(config_file)
41         self.backup_tempest_config(self.conf_file, self.res_dir)