Skip to content
Permalink
Browse files

Merge branch 'drybjed-fix-py3-facts'

  • Loading branch information...
drybjed committed Aug 11, 2019
2 parents df36944 + 2678058 commit 4cc939b1e0836306aa5404d30794420ceb463937
@@ -15,15 +15,20 @@ output = loads('''{{ ({
}) | to_nice_json }}''')

try:
for line in subprocess.check_output(['apache2', '-v']).split('\n'):
apache_v = subprocess.check_output(
['apache2', '-v']).decode('utf-8').split('\n')

for line in apache_v:
_re = re.match(r'Server version: Apache/(?P<version>[^ ]+)', line)
if _re:
output['version'] = _re.group('version')

if output['use_if_version']:
if output['min_version'] == 'current_major_minor':
output['min_version'] = '.'.join(
output['version'].split('.')[:2])

except Exception:
pass

if output['use_if_version']:
if output['min_version'] == 'current_major_minor':
output['min_version'] = '.'.join(output['version'].split('.')[:2])

print(dumps(output, sort_keys=True, indent=2))
@@ -46,7 +46,7 @@ def dpkg_query(packages):
(stdoutdata, _) = proc.communicate()

stdout_clean = stdoutdata.strip()
stdout_last = stdout_clean.rstrip(',')
stdout_last = stdout_clean.decode('utf-8').rstrip(',')
stdout_wrap = '{\n' + stdout_last + '\n}'

proc_output = loads(str(stdout_wrap))
@@ -25,7 +25,7 @@ output['installed'] = cmd_exists('icinga2')
try:
icinga_version_stdout = subprocess.check_output(
["dpkg-query", "-W", "-f=${Version}\n'",
"icinga2"]).split('-')[0]
"icinga2"]).decode('utf-8').split('-')[0]
output['version'] = icinga_version_stdout

except Exception:
@@ -11,13 +11,13 @@ output = {"installed": True}
try:
java_version_output = subprocess.check_output(
['java', '-version'],
stderr=subprocess.STDOUT)
stderr=subprocess.STDOUT).decode('utf-8').split('\n')

except subprocess.CalledProcessError:
pass

if java_version_output:
for line in java_version_output.split('\n'):
for line in java_version_output:
if 'version' in line:
output['version'] = line.split()[2].strip('"').split('_')[0]

0 comments on commit 4cc939b

Please sign in to comment.
You can’t perform that action at this time.