Skip to content

Commit

Permalink
Directly import A7 instead of executing the binary
Browse files Browse the repository at this point in the history
This allows us to execute the linter on windows no matter the install path of the agent
  • Loading branch information
hush-hush committed Jan 10, 2019
1 parent 1313160 commit 4b3552c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions config.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@
# 3p
import simplejson as json
import distro
try:
import a7
except ImportError:
pass

# project
from util import check_yaml, config_to_yaml
Expand Down Expand Up @@ -1193,13 +1197,12 @@ def load_check_from_places(check_config, check_name, checks_places, agentConfig)
log.info('Validating {} for Python 3 compatibility'.format(check_path))
a7_compatible = A7_COMPATIBILITY_READY
try:
output, _, _ = get_subprocess_output(['a7_validate', check_path], log)
file_path = os.path.realpath(check_path.decode(sys.getfilesystemencoding()))
warnings = a7.validate.validate_py3(file_path)
except Exception as e:
log.error("error executing a7_validate on custom check: %s", e)
warnings = []
a7_compatible = A7_COMPATIBILITY_UNKNOWN
else:
warnings = json.loads(output)

for w in warnings:
message = w.get('message')
Expand Down

0 comments on commit 4b3552c

Please sign in to comment.