3 # Copyright (c) 2018 Orange and others.
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
10 # pylint: disable=missing-docstring
12 from six.moves import configparser
14 from functest.opnfv_tests.openstack.tempest import tempest
17 class Patrole(tempest.TempestCommon):
19 def configure(self, **kwargs):
20 super().configure(**kwargs)
21 rconfig = configparser.RawConfigParser()
22 rconfig.read(self.conf_file)
23 if not rconfig.has_section('rbac'):
24 rconfig.add_section('rbac')
25 rconfig.set('rbac', 'rbac_test_roles', kwargs.get('roles', 'admin'))
26 with open(self.conf_file, 'w') as config_file:
27 rconfig.write(config_file)
28 self.backup_tempest_config(self.conf_file, self.res_dir)