|
|
@ -5,6 +5,7 @@ from django.conf import settings |
|
|
|
from jinja2 import Template |
|
|
|
import re |
|
|
|
import subprocess |
|
|
|
from binder import helpers |
|
|
|
|
|
|
|
NSD_CONF_TEMPLATE = """ |
|
|
|
# nsd.conf for {{hostname}} |
|
|
@ -16,9 +17,7 @@ remote-control: |
|
|
|
|
|
|
|
""" |
|
|
|
|
|
|
|
ZONE_RE = re.compile(""" |
|
|
|
zone\:\s+(?P<zone_name>\S+) |
|
|
|
\s+state: master""") |
|
|
|
ZONE_RE = re.compile("""zone:\s+(?P<zone_name>\S+)\s+state:\s+master""") |
|
|
|
|
|
|
|
class NSDServer(object): |
|
|
|
"""Class to manage NSD backend server data.""" |
|
|
@ -53,13 +52,13 @@ class NSDServer(object): |
|
|
|
zs_out = subprocess.check_output( |
|
|
|
["/usr/sbin/nsd-control", |
|
|
|
"-c", self.get_config_path(), |
|
|
|
"-s", self.hostname, |
|
|
|
"-s", helpers.ip_address(self.hostname), |
|
|
|
"zonestatus"], |
|
|
|
stderr=subprocess.STDOUT, |
|
|
|
).decode('utf-8') |
|
|
|
except subprocess.CalledProcessError: |
|
|
|
raise |
|
|
|
zones = ZONE_RE.findall(zs_out, re.MULTILINE) |
|
|
|
zones = ZONE_RE.findall(zs_out) |
|
|
|
zone_data = {} |
|
|
|
zone_data['stats'] = {} |
|
|
|
zone_data['stats']['zone_stats'] = {} |
|
|
|