mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-06-17 00:07:37 +02:00
df fix for trailining newline char
This commit is contained in:
@ -5,6 +5,7 @@ jc changelog
|
||||
- Add git log command streaming parser
|
||||
- Add top -b command parser tested on linux
|
||||
- Add top -b command streaming parser tested on linux
|
||||
- Fix df command parser for rare instances when a newline is found at the end
|
||||
- Allow jc to pip install on unsupported python version 3.6
|
||||
- Fix asciitable-m parser to skip some rows that contain column separator
|
||||
characters in cell data. A warning message will be printed to STDOUT
|
||||
|
@ -120,4 +120,4 @@ Returns:
|
||||
### Parser Information
|
||||
Compatibility: linux, darwin, freebsd
|
||||
|
||||
Version 1.9 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
Version 1.10 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||
|
@ -99,7 +99,7 @@ import jc.parsers.universal
|
||||
|
||||
class info():
|
||||
"""Provides parser metadata (version, author, etc.)"""
|
||||
version = '1.9'
|
||||
version = '1.10'
|
||||
description = '`df` command parser'
|
||||
author = 'Kelly Brazil'
|
||||
author_email = 'kellyjonbrazil@gmail.com'
|
||||
@ -208,7 +208,9 @@ def parse(data, raw=False, quiet=False):
|
||||
jc.utils.compatibility(__name__, info.compatible, quiet)
|
||||
jc.utils.input_type_check(data)
|
||||
|
||||
cleandata = data.splitlines()
|
||||
# remove blank lines
|
||||
cleandata = list(filter(None, data.splitlines()))
|
||||
|
||||
fix_data = []
|
||||
raw_output = []
|
||||
filesystem_map = {}
|
||||
|
@ -125,6 +125,13 @@ class MyTests(unittest.TestCase):
|
||||
"""
|
||||
self.assertEqual(jc.parsers.df.parse(self.generic_df_long_filesystem, quiet=True), self.generic_df_long_filesystem_json)
|
||||
|
||||
def test_df_centos_7_7_trailing_newline(self):
|
||||
"""
|
||||
Test plain 'df' on Centos 7.7 with a trailing newline
|
||||
"""
|
||||
cmd_output = self.centos_7_7_df + '\n'
|
||||
self.assertEqual(jc.parsers.df.parse(cmd_output, quiet=True), self.centos_7_7_df_json)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
Reference in New Issue
Block a user