1
0
mirror of https://github.com/librenms/librenms-agent.git synced 2024-05-09 09:54:52 +00:00

Cleanup some code (#355)

* Format with isort

* Format with Black

* Fix CRLF

* Format with shellcheck

* Fix some warning

* Fix PHP style

* Dont modifiy check_mk files

* Fixes
This commit is contained in:
Jellyfrog
2021-03-18 12:24:30 +01:00
committed by GitHub
parent 5aa62834cb
commit 61064dc9fe
58 changed files with 1665 additions and 1335 deletions

View File

@@ -3,24 +3,26 @@
import json
import subprocess
pdnscontrol = '/usr/bin/pdns_control'
pdnscontrol = "/usr/bin/pdns_control"
process = subprocess.Popen([pdnscontrol, 'show', '*'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
process = subprocess.Popen(
[pdnscontrol, "show", "*"], stdout=subprocess.PIPE, stderr=subprocess.PIPE
)
input = process.communicate()
stdout = input[0].decode()
stderr = input[1].decode()
data = {}
for var in stdout.split(','):
if '=' in var:
key, value = var.split('=')
for var in stdout.split(","):
if "=" in var:
key, value = var.split("=")
data[key] = value
output = {
'version': 1,
'error': process.returncode,
'errorString': stderr,
'data': data
"version": 1,
"error": process.returncode,
"errorString": stderr,
"data": data,
}
print(json.dumps(output))