Add the workflow for cookieshape-mcp-ocata-dvr-vxlan
The workflow 'cookieshape-mcp-ocata-dvr-vxlan' is used to
generate the model with specific options using the
latest cookiecutter templates, and try to deploy the environment
using this model.
Change-Id: Ibf72967e638938680fce9866eec4fd165e012d6e
Reviewed-on: https://review.gerrithub.io/375325
Reviewed-by: Dennis Dmitriev <dis.xcom@gmail.com>
Tested-by: Dennis Dmitriev <dis.xcom@gmail.com>
diff --git a/tcp_tests/managers/execute_commands.py b/tcp_tests/managers/execute_commands.py
index 1b961b2..1965750 100644
--- a/tcp_tests/managers/execute_commands.py
+++ b/tcp_tests/managers/execute_commands.py
@@ -18,30 +18,6 @@
self.__underlay = underlay
super(ExecuteCommandsMixin, self).__init__()
- def ensure_running_service(self, service_name, host, check_cmd,
- state_running='start/running'):
- """Check if the service_name running or try to restart it
-
- :param node_name: node on which the service will be checked
- :param check_cmd: shell command to ensure that the service is running
- :param state_running: string for check the service state
- """
- cmd = "service {0} status | grep -q '{1}'".format(
- service_name, state_running)
- with self.__underlay.remote(host=host) as remote:
- result = remote.execute(cmd)
- if result.exit_code != 0:
- LOG.info("{0} is not in running state on the node {1},"
- " trying to start".format(service_name, host))
- cmd = ("service {0} stop;"
- " sleep 3; killall -9 {0};"
- "service {0} start; sleep 5;"
- .format(service_name))
- remote.execute(cmd)
-
- remote.execute(check_cmd)
- remote.execute(check_cmd)
-
def execute_commands(self, commands, label="Command"):
"""Execute a sequence of commands
@@ -141,19 +117,7 @@
" === RETRY ({0}/{1}) ======================="
.format(x - 1, retry_count))
else:
- if self.__config.salt.salt_master_host != '0.0.0.0':
- # Workarounds for crashed services
- self.ensure_running_service(
- "salt-master",
- self.__config.salt.salt_master_host,
- "salt-call pillar.items",
- 'active (running)') # Hardcoded for now
- self.ensure_running_service(
- "salt-minion",
- self.__config.salt.salt_master_host,
- "salt 'cfg01*' pillar.items",
- "active (running)") # Hardcoded for now
- break
+ break
if x == 1 and skip_fail is False:
# In the last retry iteration, raise an exception
@@ -229,14 +193,22 @@
description = step.get('description', local_path)
skip_fail = step.get('skip_fail', False)
- if not local_path or not local_filename or not remote_path:
+ if not local_path or not remote_path:
raise Exception("Step '{0}' failed: please specify 'local_path', "
"'local_filename' and 'remote_path' correctly"
.format(description))
+ if not local_filename:
+ # If local_path is not specified then uploading a directory
+ with self.__underlay.remote(node_name=node_name) as remote:
+ LOG.info("Uploading directory {0} to {1}:{2}"
+ .format(local_path, node_name, remote_path))
+ remote.upload(source=local_path.rstrip(), target=remote_path.rstrip())
+ return
+
result = {}
with self.__underlay.local() as local:
- result = local.execute('find {0} -type f -name {1}'
+ result = local.execute('cd {0} && find . -type f -name "{1}"'
.format(local_path, local_filename))
LOG.info("Found files to upload:\n{0}".format(result))
@@ -247,9 +219,11 @@
with self.__underlay.remote(node_name=node_name) as remote:
file_names = result['stdout']
for file_name in file_names:
- LOG.info("Uploading {0} to {1}:{2}"
- .format(local_path, node_name, file_name))
- remote.upload(source=local_path, target=file_name.rstrip())
+ source_path = local_path + file_name.rstrip()
+ destination_path = remote_path.rstrip() + file_name.rstrip()
+ LOG.info("Uploading file {0} to {1}:{2}"
+ .format(source_path, node_name, remote_path))
+ remote.upload(source=source_path, target=destination_path)
def action_download(self, step):
"""Download from environment node to local host