summaryrefslogtreecommitdiffstats
path: root/utils/infra_setup/heat/common.py
diff options
context:
space:
mode:
authoryuyang <Gabriel.yuyang@huawei.com>2016-10-01 02:21:36 +0800
committeryuyang <Gabriel.yuyang@huawei.com>2016-10-01 02:23:53 +0800
commit6204bfbe6228d5167bdb67c42cac4c884cdcf664 (patch)
treeb67981719c8aa0542e040d70951bdb7aff044aad /utils/infra_setup/heat/common.py
parent3ac496ac711f40f2a4c4fb0837758b4fbade43e4 (diff)
autopep8 fix for flake8
JIRA: BOTTLENECK-101 Using autopep8 to fix the python style scanned by flake8 Change-Id: I74bf28ed4d999dac3dd36e9101f099c9853a49b6 Signed-off-by: yuyang <Gabriel.yuyang@huawei.com>
Diffstat (limited to 'utils/infra_setup/heat/common.py')
-rwxr-xr-xutils/infra_setup/heat/common.py38
1 files changed, 27 insertions, 11 deletions
diff --git a/utils/infra_setup/heat/common.py b/utils/infra_setup/heat/common.py
index 24de893f..c4a78249 100755
--- a/utils/infra_setup/heat/common.py
+++ b/utils/infra_setup/heat/common.py
@@ -34,6 +34,7 @@ TEMPLATE_EXTENSION = None
# Initialization and Input 'heat_templates/'validation
# ------------------------------------------------------
+
def init(api=False):
global BASE_DIR
# BASE_DIR = os.getcwd()
@@ -46,6 +47,7 @@ def init(api=False):
log_init()
general_vars_init(api)
+
def conf_file_init(api=False):
global CONF_FILE
if api:
@@ -66,24 +68,24 @@ def general_vars_init(api=False):
# Check Section in Configuration File
InputValidation.validate_configuration_file_section(
- files.GENERAL,
- "Section " + files.GENERAL +
- "is not present in configuration file")
+ files.GENERAL,
+ "Section " + files.GENERAL +
+ "is not present in configuration file")
InputValidation.validate_configuration_file_section(
- files.OPENSTACK,
- "Section " + files.OPENSTACK +
- "is not present in configuration file")
+ files.OPENSTACK,
+ "Section " + files.OPENSTACK +
+ "is not present in configuration file")
TEMPLATE_DIR = '/tmp/heat_templates/'
if not api:
# Validate template name
InputValidation.validate_configuration_file_parameter(
- files.GENERAL,
- files.TEMPLATE_NAME,
- "Parameter " + files.TEMPLATE_NAME +
- "is not present in configuration file")
+ files.GENERAL,
+ files.TEMPLATE_NAME,
+ "Parameter " + files.TEMPLATE_NAME +
+ "is not present in configuration file")
TEMPLATE_NAME = CONF_FILE.get_variable(files.GENERAL,
files.TEMPLATE_NAME)
InputValidation.validate_file_exist(
@@ -112,6 +114,7 @@ def log_init():
# Configuration file access
# ------------------------------------------------------
+
class ConfigurationFile:
"""
Used to extract data from the configuration file
@@ -188,6 +191,7 @@ class ConfigurationFile:
# Manage files
# ------------------------------------------------------
+
def get_heat_template_params():
"""
Returns the list of deployment parameters from the configuration file
@@ -203,6 +207,7 @@ def get_heat_template_params():
files.DEPLOYMENT_PARAMETERS, param)
return testcase_parameters
+
def get_testcase_params():
"""
Returns the list of testcase parameters from the configuration file
@@ -216,6 +221,7 @@ def get_testcase_params():
files.TESTCASE_PARAMETERS, param)
return testcase_parameters
+
def get_file_first_line(file_name):
"""
Returns the first line of a file
@@ -254,6 +260,8 @@ def replace_in_file(file, text_to_search, text_to_replace):
# ------------------------------------------------------
# Shell interaction
# ------------------------------------------------------
+
+
def run_command(command):
LOG.info("Running command: {}".format(command))
return os.system(command)
@@ -262,15 +270,19 @@ def run_command(command):
# Expose variables to other modules
# ------------------------------------------------------
+
def get_base_dir():
return BASE_DIR
+
def get_template_dir():
return TEMPLATE_DIR
# ------------------------------------------------------
# Configuration Variables from Config File
# ------------------------------------------------------
+
+
def get_deployment_configuration_variables_from_conf_file():
variables = dict()
types = dict()
@@ -289,13 +301,17 @@ def get_deployment_configuration_variables_from_conf_file():
# ------------------------------------------------------
# benchmarks from Config File
# ------------------------------------------------------
+
+
def get_benchmarks_from_conf_file():
requested_benchmarks = list()
- benchmarks = CONF_FILE.get_variable(files.GENERAL, files.BENCHMARKS).split(', ')
+ benchmarks = CONF_FILE.get_variable(
+ files.GENERAL, files.BENCHMARKS).split(', ')
for benchmark in benchmarks:
requested_benchmarks.append(benchmark)
return requested_benchmarks
+
class InputValidation(object):
@staticmethod