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:
@ -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
|
||||
-
|
||||
|
@ -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
|
||||
|
||||
|
||||
|
2
tests/fixtures/osx-10.14.6/netstat-An.json
vendored
2
tests/fixtures/osx-10.14.6/netstat-An.json
vendored
File diff suppressed because one or more lines are too long
2
tests/fixtures/osx-10.14.6/netstat.json
vendored
2
tests/fixtures/osx-10.14.6/netstat.json
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user