Merge "Revert snapshots in each fixture as a workaround"
This commit is contained in:
@@ -12,6 +12,8 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import os
|
||||
|
||||
from devops import error
|
||||
from devops.helpers import helpers
|
||||
from devops import models
|
||||
@@ -177,6 +179,15 @@ class EnvironmentManager(object):
|
||||
raise exceptions.EnvironmentIsNotSet()
|
||||
settings_oslo.save_config(self.__config, name, self._env.name)
|
||||
|
||||
def _get_snapshot_config_name(self, snapshot_name):
|
||||
"""Get config name for the environment"""
|
||||
env_name = self._env.name
|
||||
if env_name is None:
|
||||
env_name = 'config'
|
||||
test_config_path = os.path.join(
|
||||
settings.LOGS_DIR, '{0}_{1}.ini'.format(env_name, snapshot_name))
|
||||
return test_config_path
|
||||
|
||||
def revert_snapshot(self, name):
|
||||
"""Revert snapshot by name
|
||||
|
||||
@@ -196,8 +207,9 @@ class EnvironmentManager(object):
|
||||
raise exceptions.EnvironmentIsNotSet()
|
||||
|
||||
try:
|
||||
settings_oslo.reload_snapshot_config(self.__config, name,
|
||||
self._env.name)
|
||||
test_config_path = self._get_snapshot_config_name(name)
|
||||
settings_oslo.reload_snapshot_config(self.__config,
|
||||
test_config_path)
|
||||
except cfg.ConfigFilesNotFoundError as conf_err:
|
||||
LOG.error("Config file(s) {0} not found!".format(
|
||||
conf_err.config_files))
|
||||
@@ -274,6 +286,10 @@ class EnvironmentManager(object):
|
||||
def has_snapshot(self, name):
|
||||
return self._env.has_snapshot(name)
|
||||
|
||||
def has_snapshot_config(self, name):
|
||||
test_config_path = self._get_snapshot_config_name(name)
|
||||
return os.path.isfile(test_config_path)
|
||||
|
||||
def delete_environment(self):
|
||||
"""Delete environment
|
||||
|
||||
|
||||
@@ -12,8 +12,6 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from oslo_config import cfg
|
||||
|
||||
from fuel_ccp_tests import settings_oslo
|
||||
|
||||
|
||||
@@ -80,11 +78,6 @@ class EnvironmentManagerEmpty(object):
|
||||
raise Exception(
|
||||
"EnvironmentManagerEmpty cannot revert nodes from {} to {}"
|
||||
.format(self.__config.hardware.current_snapshot, name))
|
||||
try:
|
||||
settings_oslo.reload_snapshot_config(self.__config, name)
|
||||
except cfg.ConfigFilesNotFoundError:
|
||||
pass
|
||||
self.__config.hardware.current_snapshot = name
|
||||
|
||||
def start(self):
|
||||
"""Start environment"""
|
||||
@@ -105,6 +98,9 @@ class EnvironmentManagerEmpty(object):
|
||||
def has_snapshot(self, name):
|
||||
return self.__config.hardware.current_snapshot == name
|
||||
|
||||
def has_snapshot_config(self, name):
|
||||
return self.__config.hardware.current_snapshot == name
|
||||
|
||||
def delete_environment(self):
|
||||
"""Delete environment"""
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user