Clean /etc/rally.conf 33/61033/1
authorCédric Ollivier <cedric.ollivier@orange.com>
Fri, 17 Aug 2018 09:22:14 +0000 (11:22 +0200)
committerCédric Ollivier <cedric.ollivier@orange.com>
Fri, 17 Aug 2018 09:22:14 +0000 (11:22 +0200)
Else rally_sanity may print logs in tempest_smoke res dir.

Change-Id: Iae97d533e9b99dcf8da70229b0675228472bfe52
Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
functest/opnfv_tests/openstack/tempest/tempest.py

index 452c82d..1182f23 100644 (file)
@@ -315,6 +315,22 @@ class TempestCommon(singlevm.VmReady1):
         with open(rally_conf, 'wb') as config_file:
             rconfig.write(config_file)
 
+    @staticmethod
+    def clean_rally_conf(rally_conf='/etc/rally/rally.conf'):
+        """Clean Rally config"""
+        rconfig = configparser.RawConfigParser()
+        rconfig.read(rally_conf)
+        if rconfig.has_option('tempest', 'img_name_regex'):
+            rconfig.remove_option('tempest', 'img_name_regex')
+        if rconfig.has_option('tempest', 'swift_operator_role'):
+            rconfig.remove_option('tempest', 'swift_operator_role')
+        if rconfig.has_option('DEFAULT', 'log-file'):
+            rconfig.remove_option('DEFAULT', 'log-file')
+        if rconfig.has_option('DEFAULT', 'log_dir'):
+            rconfig.remove_option('DEFAULT', 'log_dir')
+        with open(rally_conf, 'wb') as config_file:
+            rconfig.write(config_file)
+
     def configure(self, **kwargs):  # pylint: disable=unused-argument
         """
         Create all openstack resources for tempest-based testcases and write
@@ -364,6 +380,7 @@ class TempestCommon(singlevm.VmReady1):
         """
         Cleanup all OpenStack objects. Should be called on completion.
         """
+        self.clean_rally_conf()
         if self.image_alt:
             self.cloud.delete_image(self.image_alt)
         if self.flavor_alt: