Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debugging refactor #320

Merged
merged 7 commits into from
Jul 13, 2020
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
## Unreleased
* TBD

## 1.2.9 (2020-07-10)
* Improved the code quality of live debugging. Used `world.config.user_data` instead of global variables. ([#320](https://github.com/eerkunt/terraform-compliance/pull/320))

## 1.2.8 (2020-07-10)
* Improved (centralized) matching and seeking functions. ([#304](https://github.com/eerkunt/terraform-compliance/pull/304))
* Improved case-sensitivity tag. Generalized case-sensitivity to work on all steps, using matching changes implemented on this patch. ([#304](https://github.com/eerkunt/terraform-compliance/pull/304))
Expand Down
7 changes: 4 additions & 3 deletions terraform_compliance/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@
class ArgHandling(object):
pass

cli_arguments = ArgHandling() # make this global?

def cli(arghandling=cli_arguments, argparser=ArgumentParser(prog=__app_name__,
def cli(arghandling=ArgHandling(), argparser=ArgumentParser(prog=__app_name__,
description='BDD Test Framework for Hashicorp terraform')):
args = arghandling
parser = argparser
Expand Down Expand Up @@ -103,7 +102,9 @@ def cli(arghandling=cli_arguments, argparser=ArgumentParser(prog=__app_name__,
'--user-data=exit_on_failure={}'.format(args.exit_on_failure),
'--user-data=terraform_executable={}'.format(args.terraform_file),
'--user-data=no_failure={}'.format(args.no_failure),
'--user-data=silence_mode_enabled={}'.format(args.silence)]
'--user-data=silence_mode_enabled={}'.format(args.silence),
'--user-data=debugging_mode_enabled={}'.format(args.debug),
]
commands.extend(radish_arguments)

console_write('{} {} {}{}'.format(Defaults().icon,
Expand Down
6 changes: 1 addition & 5 deletions terraform_compliance/steps/terrain.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import curses
import json
from IPython import embed
from radish import before, after, world
from terraform_compliance.extensions.terraform import TerraformParser
from terraform_compliance.main import cli_arguments

@before.each_feature
def load_terraform_data(feature):
Expand All @@ -12,9 +10,7 @@ def load_terraform_data(feature):

@after.each_step
def wait_for_user_input(step):
global cli_arguments

if not cli_arguments.debug:
if world.config.user_data['debugging_mode_enabled'] == 'False':
return

cmd = 'cmd'
Expand Down