Code Review
/
functest.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Create a private shared network for Rally
[functest.git]
/
ci
/
prepare_env.py
diff --git
a/ci/prepare_env.py
b/ci/prepare_env.py
index
b462f96
..
1a3d495
100644
(file)
--- a/
ci/prepare_env.py
+++ b/
ci/prepare_env.py
@@
-1,4
+1,4
@@
-#!/
bin/bash
+#!/
usr/bin/env python
#
# Author: Jose Lausuch (jose.lausuch@ericsson.com)
#
#
# Author: Jose Lausuch (jose.lausuch@ericsson.com)
#
@@
-47,7
+47,7
@@
CI_DEBUG = False
REPOS_DIR = os.getenv('repos_dir')
FUNCTEST_REPO = REPOS_DIR + '/functest/'
REPOS_DIR = os.getenv('repos_dir')
FUNCTEST_REPO = REPOS_DIR + '/functest/'
-with open(
"/home/opnfv/repos/functest/testcases/config_functest.yaml"
) as f:
+with open(
os.environ["CONFIG_FUNCTEST_YAML"]
) as f:
functest_yaml = yaml.safe_load(f)
FUNCTEST_CONF_DIR = functest_yaml.get("general").get(
functest_yaml = yaml.safe_load(f)
FUNCTEST_CONF_DIR = functest_yaml.get("general").get(
@@
-171,7
+171,7
@@
def source_rc_file():
logger.debug("Executing command: %s" % cmd)
p = subprocess.Popen(cmd.split(), stdout=subprocess.PIPE)
output = p.communicate()[0]
logger.debug("Executing command: %s" % cmd)
p = subprocess.Popen(cmd.split(), stdout=subprocess.PIPE)
output = p.communicate()[0]
- logger.debug(output)
+ logger.debug(
"\n%s" %
output)
if p.returncode != 0:
logger.error("Failed to fetch credentials from installer.")
sys.exit(1)
if p.returncode != 0:
logger.error("Failed to fetch credentials from installer.")
sys.exit(1)
@@
-203,7
+203,7
@@
def verify_deployment():
if "ERROR" in line:
logger.error(line)
sys.exit("Problem while running 'check_os.sh'.")
if "ERROR" in line:
logger.error(line)
sys.exit("Problem while running 'check_os.sh'.")
- logger.
debug
(line)
+ logger.
info
(line)
def install_rally():
def install_rally():
@@
-211,34
+211,34
@@
def install_rally():
logger.info("Creating Rally environment...")
cmd = "rally deployment destroy opnfv-rally"
logger.info("Creating Rally environment...")
cmd = "rally deployment destroy opnfv-rally"
- ft_utils.execute_command(cmd, logger=None, exit_on_error=False)
+ ft_utils.execute_command(cmd, logger=logger, exit_on_error=False,
+ error_msg=("Deployment %s does not exist."
+ % DEPLOYMENT_MAME), verbose=False)
cmd = "rally deployment create --fromenv --name=" + DEPLOYMENT_MAME
cmd = "rally deployment create --fromenv --name=" + DEPLOYMENT_MAME
- if not ft_utils.execute_command(cmd, logger):
- logger.error("Problem while creating Rally deployment.")
- sys.exit(cmd)
+ ft_utils.execute_command(cmd, logger,
+ error_msg="Problem creating Rally deployment")
logger.info("Installing tempest from existing repo...")
cmd = ("rally verify install --source " + TEMPEST_REPO_DIR +
" --system-wide")
logger.info("Installing tempest from existing repo...")
cmd = ("rally verify install --source " + TEMPEST_REPO_DIR +
" --system-wide")
- if not ft_utils.execute_command(cmd, logger):
- logger.error("Problem while installing Tempest.")
- sys.exit(cmd)
+ ft_utils.execute_command(cmd, logger,
+ error_msg="Problem installing Tempest.")
cmd = "rally deployment check"
cmd = "rally deployment check"
- if not ft_utils.execute_command(cmd, logger):
- logger.error("OpenStack not responding or faulty Rally deployment.")
-
sys.exit(cmd
)
+ ft_utils.execute_command(cmd, logger,
+ error_msg=("OpenStack not responding or "
+
"faulty Rally deployment.")
)
cmd = "rally show images"
cmd = "rally show images"
- if not ft_utils.execute_command(cmd, logger):
- logger.error("Problem while listing OpenStack images.")
-
sys.exit(cmd
)
+ ft_utils.execute_command(cmd, logger,
+ error_msg=("Problem while listing "
+
"OpenStack images.")
)
cmd = "rally show flavors"
cmd = "rally show flavors"
- if not ft_utils.execute_command(cmd, logger):
- logger.error("Problem while showing OpenStack flavors.")
-
sys.exit(cmd
)
+ ft_utils.execute_command(cmd, logger,
+ error_msg=("Problem while showing "
+
"OpenStack flavors.")
)
def generate_os_defaults():
def generate_os_defaults():
@@
-268,7
+268,7
@@
def main():
sys.exit()
if args.action == "start":
sys.exit()
if args.action == "start":
-
print
("\n######### Preparing Functest environment #########\n")
+
logger.info
("\n######### Preparing Functest environment #########\n")
check_env_variables()
create_directories()
source_rc_file()
check_env_variables()
create_directories()
source_rc_file()