Skip to content

Commit 2047da3

Browse files
author
Vadim Rutkovsky
committed
behave: make runner py 2.6 compatible
1 parent d3c78d0 commit 2047da3

File tree

1 file changed

+28
-8
lines changed

1 file changed

+28
-8
lines changed

ctf_cli/behave.py

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -323,17 +323,37 @@ def run(self):
323323
Run Behave and pass some runtime arguments
324324
:return:
325325
"""
326+
behave_data = None
327+
try:
328+
behave_data = self._cli_conf_obj.get(CTFCliConfig.GLOBAL_SECTION_NAME, CTFCliConfig.CONFIG_BEHAVE_DATA)
329+
except Exception:
330+
pass
331+
332+
behave_tags = None
333+
try:
334+
behave_tags = self._cli_conf_obj.get(CTFCliConfig.GLOBAL_SECTION_NAME, CTFCliConfig.CONFIG_BEHAVE_TAGS)
335+
except Exception:
336+
pass
337+
338+
junit = None
339+
try:
340+
junit = self._cli_conf_obj.get(CTFCliConfig.GLOBAL_SECTION_NAME, CTFCliConfig.CONFIG_JUNIT)
341+
except Exception:
342+
pass
326343

327-
behave_data = self._cli_conf_obj.get(CTFCliConfig.GLOBAL_SECTION_NAME, CTFCliConfig.CONFIG_BEHAVE_DATA)
328-
behave_tags = self._cli_conf_obj.get(CTFCliConfig.GLOBAL_SECTION_NAME, CTFCliConfig.CONFIG_BEHAVE_TAGS)
329-
junit = self._cli_conf_obj.get(CTFCliConfig.GLOBAL_SECTION_NAME, CTFCliConfig.CONFIG_JUNIT)
330-
verbose = self._cli_conf_obj.get(CTFCliConfig.GLOBAL_SECTION_NAME, CTFCliConfig.CONFIG_VERBOSE)
344+
verbose = None
345+
try:
346+
verbose = self._cli_conf_obj.get(CTFCliConfig.GLOBAL_SECTION_NAME, CTFCliConfig.CONFIG_VERBOSE)
347+
except Exception:
348+
pass
331349

332350
# configuration file for ansible
333-
if self._cli_conf_obj.get(CTFCliConfig.GLOBAL_SECTION_NAME, CTFCliConfig.CONFIG_EXEC_TYPE) == 'ansible':
334-
ansible_conf = self._working_dir_obj.exec_type_conf_path()
335-
else:
336-
ansible_conf = None
351+
ansible_conf = None
352+
try:
353+
if self._cli_conf_obj.get(CTFCliConfig.GLOBAL_SECTION_NAME, CTFCliConfig.CONFIG_EXEC_TYPE) == 'ansible':
354+
ansible_conf = self._working_dir_obj.exec_type_conf_path()
355+
except Exception:
356+
pass
337357

338358
command = [
339359
'behave'

0 commit comments

Comments
 (0)