From d1ef363d806a2d67ab0ed0c99ee20e8028c11f75 Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Wed, 18 Nov 2020 14:28:32 -0600 Subject: ncserver: Style improvements --- ncserver/module/interfaces.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'ncserver/module/interfaces.py') diff --git a/ncserver/module/interfaces.py b/ncserver/module/interfaces.py index 959436c..b8f9ad1 100644 --- a/ncserver/module/interfaces.py +++ b/ncserver/module/interfaces.py @@ -93,11 +93,12 @@ def _add_running_contents(ifaces): type_file.close() type_num = type_num.strip() if type_num in types.keys(): + iana_xmlns = "urn:ietf:params:xml:ns:yang:iana-if-type" iface.append(util.leaf_elm('if:type', 'ianaift:'+types[type_num], - nsmap={'ianaift': "urn:ietf:params:xml:ns:yang:iana-if-type"})) + nsmap={'ianaift': iana_xmlns})) else: LOGGER.warning(_('unknown Linux hwtype for %s: %s'), - ifname.name, type_num) + ifname.name, type_num) def running(node): @@ -119,14 +120,15 @@ def _add_stats_to(iface, name: str): stats = util.subelm(iface, 'if:statistics') # XXX BAD vvv - stats.append(util.leaf_elm('if:discontinuity-time', '2020-01-01T01:01:01.011Z')) + stats.append(util.leaf_elm('if:discontinuity-time', + '2020-01-01T01:01:01.011Z')) # XXX BAD ^^^ result = subprocess.run(['/sbin/ifupdown', 'ifctrstat', name], stdout=subprocess.PIPE, check=False) if result.returncode != 0: LOGGER.error(_('ifctrstat failed for %s: %s'), - name, result.returncode) + name, result.returncode) return counters = result.stdout.decode('utf-8').split('\n') @@ -134,7 +136,7 @@ def _add_stats_to(iface, name: str): for counter, value in [data.split(': ') for data in counters]: if counter not in counter_tags.keys(): LOGGER.warning(_('unhandled ifctrstat counter for %s: %s'), - name, counter) + name, counter) continue stats.append(util.leaf_elm(counter_tags[counter], value)) -- cgit v1.2.3-70-g09d2