Skip to content

Commit 6a6aad6

Browse files
committed
[qa] Fix qa errors of openwrt ddns
Signed-off-by: Konrad Kreitmair <kkreitmair@tdt.de>
1 parent 03e97b8 commit 6a6aad6

File tree

4 files changed

+34
-41
lines changed

4 files changed

+34
-41
lines changed

netjsonconfig/backends/openwrt/converters/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from .ddns import Ddns
12
from .default import Default
23
from .general import General
34
from .interfaces import Interfaces
@@ -9,7 +10,6 @@
910
from .rules import Rules
1011
from .switch import Switch
1112
from .wireless import Wireless
12-
from .ddns import Ddns
1313

1414
__all__ = [
1515
'Default',

netjsonconfig/backends/openwrt/converters/ddns.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,7 @@ class Ddns(OpenWrtConverter):
1313
def to_intermediate_loop(self, block, result, index=None):
1414
if block:
1515
provider_list = self.__intermediate_providers(block.pop('providers', {}))
16-
block.update({
17-
'.type': 'ddns',
18-
'.name': block.pop('id', 'global'),
19-
})
16+
block.update({'.type': 'ddns', '.name': block.pop('id', 'global')})
2017
result.setdefault('ddns', [])
2118
result['ddns'] = [self.sorted_dict(block)] + provider_list
2219
return result
@@ -29,8 +26,7 @@ def __intermediate_providers(self, providers):
2926
result = []
3027
for provider in providers:
3128
uci_name = self._get_uci_name(provider['lookup_host'])
32-
resultdict = OrderedDict((('.name', uci_name),
33-
('.type', 'service')))
29+
resultdict = OrderedDict((('.name', uci_name), ('.type', 'service')))
3430
resultdict.update(provider)
3531
result.append(resultdict)
3632
return result

netjsonconfig/backends/openwrt/schema.py

Lines changed: 30 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -444,8 +444,8 @@
444444
"type": "boolean",
445445
"title": "upd_privateip",
446446
"description": "disallow/allow sending of private/special IP's to the DDNS provider; "
447-
"blocked IPv4: 0/8, 10/8, 100.64/10, 127/8, 169.254/16, 172.16/12, "
448-
"192.168/16; blocked IPv6: ::/32, f000::/4",
447+
"blocked IPv4: 0/8, 10/8, 100.64/10, 127/8, 169.254/16, 172.16/12, "
448+
"192.168/16; blocked IPv6: ::/32, f000::/4",
449449
"default": False,
450450
"format": "checkbox",
451451
"propertyOrder": 1,
@@ -482,7 +482,7 @@
482482
"type": "boolean",
483483
"title": "use_curl",
484484
"description": "if both wget and curl are installed, wget is used for communication "
485-
"by default",
485+
"by default",
486486
"default": False,
487487
"format": "checkbox",
488488
"propertyOrder": 6,
@@ -518,21 +518,16 @@
518518
"type": "string",
519519
"title": "interface",
520520
"description": "network from /etc/config/network to monitor for up/down "
521-
"events to start the ddns update script via hotplug",
521+
"events to start the ddns update script via hotplug",
522522
"propertyOrder": 2,
523523
},
524524
"ip_source": {
525525
"type": "string",
526526
"title": "ip_source",
527-
"description": "specifies the source to detect the local IP: 'network' uses "
528-
"'ip_network', 'web' uses 'ip_url', 'interface' uses "
529-
"'ip_interface', 'script' uses 'ip_script'",
530-
"enum": [
531-
"network",
532-
"web",
533-
"interface",
534-
"script"
535-
],
527+
"description": "specifies the source to detect the local IP: "
528+
"'network' uses 'ip_network', 'web' uses 'ip_url', 'interface' uses "
529+
"'ip_interface', 'script' uses 'ip_script'",
530+
"enum": ["network", "web", "interface", "script"],
536531
"default": "network",
537532
"propertyOrder": 3,
538533
},
@@ -545,9 +540,10 @@
545540
"domain": {
546541
"type": "string",
547542
"title": "domain",
548-
"description": "the DNS name to update; this property can also be used for "
549-
"special multihost update configurations supported by"
550-
" some providers",
543+
"description": "the DNS name to update;"
544+
" this property can also be used for "
545+
"special multihost update configurations supported by"
546+
" some providers",
551547
"propertyOrder": 5,
552548
},
553549
"username": {
@@ -571,7 +567,8 @@
571567
"update_url": {
572568
"type": "string",
573569
"title": "update_url",
574-
"description": "url to the DDNS service to use if 'service_name' is not set",
570+
"description": "url to the DDNS service to use"
571+
" if 'service_name' is not set",
575572
"propertyOrder": 9,
576573
},
577574
"update_script": {
@@ -583,30 +580,30 @@
583580
"ip_network": {
584581
"type": "string",
585582
"title": "ip_network",
586-
"description": "network from /etc/config/network to use for detecting the IP "
587-
"if 'ip_source' is set to 'network'",
583+
"description": "network from /etc/config/network to use"
584+
" for detecting the IP if 'ip_source' is set to 'network'",
588585
"default": "wan",
589586
"propertyOrder": 11,
590587
},
591588
"ip_url": {
592589
"type": "string",
593590
"title": "ip_url",
594591
"description": "url to use for detecting the IP if 'ip_source' is set to "
595-
"'web'",
592+
"'web'",
596593
"propertyOrder": 12,
597594
},
598595
"ip_interface": {
599596
"type": "string",
600597
"title": "ip_interface",
601-
"description": "local interface to use for detecting the IP if 'ip_source' is"
602-
" set to 'interface'",
598+
"description": "local interface to use"
599+
" for detecting the IP if 'ip_source' is set to 'interface'",
603600
"propertyOrder": 13,
604601
},
605602
"ip_script": {
606603
"type": "string",
607604
"title": "ip_script",
608-
"description": "script to use for detecting the IP if 'ip_source' is set to "
609-
"'script'",
605+
"description": "script to use for detecting the IP"
606+
" if 'ip_source' is set to 'script'",
610607
"propertyOrder": 14,
611608
},
612609
"use_syslog": {
@@ -620,7 +617,7 @@
620617
"1 - info, notice, warning, errors",
621618
"2 - notice, warning, errors",
622619
"3 - warning, errors",
623-
"4 - errors"
620+
"4 - errors",
624621
]
625622
},
626623
"default": 0,
@@ -632,14 +629,14 @@
632629
"description": "disable/enable logging to logfile",
633630
"default": True,
634631
"propertyOrder": 16,
635-
}
636-
}
637-
}
638-
}
639-
}
640-
}
641-
}
642-
}
632+
},
633+
},
634+
},
635+
},
636+
},
637+
},
638+
},
639+
},
643640
)
644641

645642

tests/openwrt/test_ddns.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class TestDdns(unittest.TestCase, _TabsMixin):
1313
"ddns_loglines": 250,
1414
"ddns_rundir": "/var/run/ddns",
1515
"upd_privateip": False,
16-
"use_curl": False
16+
"use_curl": False,
1717
}
1818
}
1919
_ddns_uci_global = """package ddns

0 commit comments

Comments
 (0)