From 041d6eaab46a031fb1410bf11844f903927e1b06 Mon Sep 17 00:00:00 2001 From: Ad Schellevis Date: Sun, 10 Mar 2019 15:00:25 +0100 Subject: [PATCH] unbound, fix nested items, closes https://github.com/opnsense/core/issues/3302 ranges like: ``` num.query.tls=0 num.query.tls.resume=0 ``` cause a "TypeError: 'str' object does not support item assignment" --- src/opnsense/scripts/unbound/wrapper.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/opnsense/scripts/unbound/wrapper.py b/src/opnsense/scripts/unbound/wrapper.py index 43aa10026..e94cb727e 100755 --- a/src/opnsense/scripts/unbound/wrapper.py +++ b/src/opnsense/scripts/unbound/wrapper.py @@ -92,11 +92,13 @@ elif args.stats: while len(keys) > 0 : key = keys.pop(0) if len(keys) == 0: - if key not in ptr: - ptr[key] = value.strip() + ptr[key] = value.strip() elif key not in ptr: ptr[key] = dict() + elif type(ptr[key]) != dict: + ptr[key] = {'__value__': ptr[key]} ptr = ptr[key] + elif args.list_local_zones: output = list() for line in unbound_control_reader('list_local_zones'):