From 64676fda2edf4b3e1b8ff283251287987ddef70b Mon Sep 17 00:00:00 2001 From: Kelly Brazil Date: Mon, 20 Feb 2023 11:56:20 -0800 Subject: [PATCH] fix for older linux style output --- CHANGELOG | 1 + jc/parsers/ifconfig.py | 16 ++++++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index d2061e35..ba128697 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -7,6 +7,7 @@ jc changelog - Add `zpool iostat` command parser - Add `zpool status` command parser - Fix `acpi` command parser for "will never fully discharge" battery state +- Fix `ifconfig` command parser for older-style linux output - Fix `xrandr` command parser for proper `is_current` output - Fix `xrandr` command parser for infinite loop with some device configurations - Add `reflection` key to `xrandr` parser schema diff --git a/jc/parsers/ifconfig.py b/jc/parsers/ifconfig.py index f8bc9503..6192d699 100644 --- a/jc/parsers/ifconfig.py +++ b/jc/parsers/ifconfig.py @@ -219,7 +219,7 @@ import jc.utils class info(): """Provides parser metadata (version, author, etc.)""" - version = '2.2' + version = '2.3' description = '`ifconfig` command parser' author = 'Kelly Brazil' author_email = 'kellyjonbrazil@gmail.com' @@ -425,18 +425,18 @@ def parse( # Linux syntax re_linux_interface = re.compile(r''' (?P[a-zA-Z0-9:._-]+)\s+ - Link encap:(?P\S+\s?\S+) + Link\sencap:(?P\S+\s?\S+) (\s+HWaddr\s+\b(?P[0-9A-Fa-f:?]+))? ''', re.IGNORECASE | re.VERBOSE ) re_linux_ipv4 = re.compile(r''' - inet addr:(?P
(?:[0-9]{1,3}\.){3}[0-9]{1,3})(\s+ + inet\saddr:(?P
(?:[0-9]{1,3}\.){3}[0-9]{1,3})(\s+ Bcast:(?P(?:[0-9]{1,3}\.){3}[0-9]{1,3}))?\s+ Mask:(?P(?:[0-9]{1,3}\.){3}[0-9]{1,3}) ''', re.IGNORECASE | re.VERBOSE ) re_linux_ipv6 = re.compile(r''' - inet6 addr:\s+(?P
\S+)/ + inet6\saddr:\s+(?P
\S+)/ (?P[0-9]+)\s+ Scope:(?PLink|Host) ''', re.IGNORECASE | re.VERBOSE @@ -448,7 +448,7 @@ def parse( ''', re.IGNORECASE | re.VERBOSE ) re_linux_rx = re.compile(r''' - RX packets:(?P[0-9]+)\s+ + RX\spackets:(?P[0-9]+)\s+ errors:(?P[0-9]+)\s+ dropped:(?P[0-9]+)\s+ overruns:(?P[0-9]+)\s+ @@ -456,7 +456,7 @@ def parse( ''', re.IGNORECASE | re.VERBOSE ) re_linux_tx = re.compile(r''' - TX packets:(?P[0-9]+)\s+ + TX\spackets:(?P[0-9]+)\s+ errors:(?P[0-9]+)\s+ dropped:(?P[0-9]+)\s+ overruns:(?P[0-9]+)\s+ @@ -464,8 +464,8 @@ def parse( ''', re.IGNORECASE | re.VERBOSE ) re_linux_bytes = re.compile(r''' - \W+RX bytes:(?P\d+)\s+\(.*\)\s+ - TX bytes:(?P\d+)\s+\(.*\) + \W+RX\sbytes:(?P\d+)\s+\(.*\)\s+ + TX\sbytes:(?P\d+)\s+\(.*\) ''', re.IGNORECASE | re.VERBOSE ) re_linux_tx_stats = re.compile(r'''