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:
@@ -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))
|
||||
|
Reference in New Issue
Block a user