1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-06-19 00:17:51 +02:00

strip whitespace from string fields

This commit is contained in:
Kelly Brazil
2020-05-29 15:14:44 -07:00
parent 83a738bf4d
commit 58ab0d4ece
4 changed files with 12 additions and 4 deletions

View File

@ -5,6 +5,7 @@ jc changelog
- Update netstat parser to add route_flags_pretty field
- Update netstat parser to change osx_inode field name to unix_inode
- Update netstat parser to change osx_flags field name to unix_flags
- Update netstat parser to strip whitespace from state field
- Update route parser to add flags_pretty field
- Fix freebsd compatibility message for df, fstab, mount, ntpq, stat, and uname parsers
-

View File

@ -334,7 +334,9 @@ def process(proc_data):
"tx_err": integer,
"tx_drp": integer,
"tx_ovr": integer,
"flg": string
"flg": string,
"ibytes": integer,
"obytes": integer
}
]
"""
@ -344,7 +346,7 @@ def process(proc_data):
'osx_flags', 'subcla', 'pcbcount', 'rcvbuf', 'sndbuf', 'rxbytes', 'txbytes',
'route_refs', 'use', 'mtu', 'mss', 'window', 'irtt', 'metric', 'ipkts',
'ierrs', 'opkts', 'oerrs', 'coll', 'rx_ok', 'rx_err', 'rx_drp', 'rx_ovr',
'tx_ok', 'tx_err', 'tx_drp', 'tx_ovr', 'idrop']
'tx_ok', 'tx_err', 'tx_drp', 'tx_ovr', 'idrop', 'ibytes', 'obytes']
for key in int_list:
if key in entry:
try:
@ -365,6 +367,11 @@ def process(proc_data):
except (ValueError):
pass
# strip whitespace from beginning and end of all string values
for item in entry:
if isinstance(entry[item], str):
entry[item] = entry[item].strip()
return proc_data