Fix some configuration auto-detection issues.
Austin S. Hemmelgarn committed
May 2, 2018 at 10:35 UTC
e3896008443a112264855f680ea9cbfc4085be0a
1 file changed
+6
-4
python.d/unbound.chart.py
+6
-4
@@ -97,14 +97,13 @@ class Service(SocketService):
97
self.ubconf = self.configuration.get('ubconf', None)
98
self.order = ORDER
99
self.definitions = CHARTS
100
- if self.ext:
101
- self.order = self.order + EXTENDED_ORDER
102
- self.definitions.update(EXTENDED_CHARTS)
100
self.request = 'UBCT1 stats\n'
101
self._parse_config()
105
- self.debug('Unbound config: {0}'.format(self.ubconf))
102
self._auto_config()
103
self.debug('Extended stats: {0}'.format(self.ext))
104
+ if self.ext:
105
+ self.order = self.order + EXTENDED_ORDER
106
+ self.definitions.update(EXTENDED_CHARTS)
107
if self.unix_socket:
108
self.debug('Using unix socket: {0}'.format(self.unix_socket))
109
for key in self.definitions.keys():
@@ -118,6 +117,7 @@ class Service(SocketService):
117
118
def _auto_config(self):
119
if self.ubconf and os.access(self.ubconf, os.R_OK):
120
+ self.debug('Unbound config: {0}'.format(self.ubconf))
121
conf = YamlOrderedLoader.load_config_from_file(self.ubconf)[0]
122
if self.ext is None:
123
if 'extended-statistics' in conf['server'].keys():
@@ -133,6 +133,8 @@ class Service(SocketService):
133
else:
134
if not self.unix_socket:
135
self.unix_socket = conf['remote-control'].get('control-interface')
136
+ else:
137
+ self.debug('Unbound configuration not found.')
138
if not self.key:
139
self.key = '/etc/unbound/unbound_control.key'
140
if not self.cert: