mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-06-19 00:17:51 +02:00
formatting and doc update
This commit is contained in:
@ -25,7 +25,7 @@ Schema:
|
|||||||
"filesystem": string,
|
"filesystem": string,
|
||||||
"mount_point": string,
|
"mount_point": string,
|
||||||
"type": string,
|
"type": string,
|
||||||
"access": [
|
"options": [
|
||||||
string
|
string
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -39,7 +39,7 @@ Example:
|
|||||||
"filesystem": "sysfs",
|
"filesystem": "sysfs",
|
||||||
"mount_point": "/sys",
|
"mount_point": "/sys",
|
||||||
"type": "sysfs",
|
"type": "sysfs",
|
||||||
"access": [
|
"options": [
|
||||||
"rw",
|
"rw",
|
||||||
"nosuid",
|
"nosuid",
|
||||||
"nodev",
|
"nodev",
|
||||||
@ -51,7 +51,7 @@ Example:
|
|||||||
"filesystem": "proc",
|
"filesystem": "proc",
|
||||||
"mount_point": "/proc",
|
"mount_point": "/proc",
|
||||||
"type": "proc",
|
"type": "proc",
|
||||||
"access": [
|
"options": [
|
||||||
"rw",
|
"rw",
|
||||||
"nosuid",
|
"nosuid",
|
||||||
"nodev",
|
"nodev",
|
||||||
@ -63,7 +63,7 @@ Example:
|
|||||||
"filesystem": "udev",
|
"filesystem": "udev",
|
||||||
"mount_point": "/dev",
|
"mount_point": "/dev",
|
||||||
"type": "devtmpfs",
|
"type": "devtmpfs",
|
||||||
"access": [
|
"options": [
|
||||||
"rw",
|
"rw",
|
||||||
"nosuid",
|
"nosuid",
|
||||||
"relatime",
|
"relatime",
|
||||||
@ -96,6 +96,6 @@ Returns:
|
|||||||
List of Dictionaries. Raw or processed structured data.
|
List of Dictionaries. Raw or processed structured data.
|
||||||
|
|
||||||
### Parser Information
|
### Parser Information
|
||||||
Compatibility: linux, darwin, freebsd
|
Compatibility: linux, darwin, freebsd, aix
|
||||||
|
|
||||||
Version 1.7 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 1.8 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
@ -20,7 +20,7 @@ Schema:
|
|||||||
"filesystem": string,
|
"filesystem": string,
|
||||||
"mount_point": string,
|
"mount_point": string,
|
||||||
"type": string,
|
"type": string,
|
||||||
"access": [
|
"options": [
|
||||||
string
|
string
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -34,7 +34,7 @@ Example:
|
|||||||
"filesystem": "sysfs",
|
"filesystem": "sysfs",
|
||||||
"mount_point": "/sys",
|
"mount_point": "/sys",
|
||||||
"type": "sysfs",
|
"type": "sysfs",
|
||||||
"access": [
|
"options": [
|
||||||
"rw",
|
"rw",
|
||||||
"nosuid",
|
"nosuid",
|
||||||
"nodev",
|
"nodev",
|
||||||
@ -46,7 +46,7 @@ Example:
|
|||||||
"filesystem": "proc",
|
"filesystem": "proc",
|
||||||
"mount_point": "/proc",
|
"mount_point": "/proc",
|
||||||
"type": "proc",
|
"type": "proc",
|
||||||
"access": [
|
"options": [
|
||||||
"rw",
|
"rw",
|
||||||
"nosuid",
|
"nosuid",
|
||||||
"nodev",
|
"nodev",
|
||||||
@ -58,7 +58,7 @@ Example:
|
|||||||
"filesystem": "udev",
|
"filesystem": "udev",
|
||||||
"mount_point": "/dev",
|
"mount_point": "/dev",
|
||||||
"type": "devtmpfs",
|
"type": "devtmpfs",
|
||||||
"access": [
|
"options": [
|
||||||
"rw",
|
"rw",
|
||||||
"nosuid",
|
"nosuid",
|
||||||
"relatime",
|
"relatime",
|
||||||
@ -75,7 +75,7 @@ import jc.utils
|
|||||||
|
|
||||||
class info():
|
class info():
|
||||||
"""Provides parser metadata (version, author, etc.)"""
|
"""Provides parser metadata (version, author, etc.)"""
|
||||||
version = '1.7'
|
version = '1.8'
|
||||||
description = '`mount` command parser'
|
description = '`mount` command parser'
|
||||||
author = 'Kelly Brazil'
|
author = 'Kelly Brazil'
|
||||||
author_email = 'kellyjonbrazil@gmail.com'
|
author_email = 'kellyjonbrazil@gmail.com'
|
||||||
@ -138,10 +138,7 @@ def _linux_parse(data):
|
|||||||
output_line['filesystem'] = parsed_line[0]
|
output_line['filesystem'] = parsed_line[0]
|
||||||
output_line['mount_point'] = parsed_line[2]
|
output_line['mount_point'] = parsed_line[2]
|
||||||
output_line['type'] = parsed_line[4]
|
output_line['type'] = parsed_line[4]
|
||||||
|
output_line['options'] = parsed_line[5].lstrip('(').rstrip(')').split(',')
|
||||||
options = parsed_line[5].lstrip('(').rstrip(')').split(',')
|
|
||||||
|
|
||||||
output_line['options'] = options
|
|
||||||
|
|
||||||
output.append(output_line)
|
output.append(output_line)
|
||||||
|
|
||||||
@ -151,12 +148,12 @@ def _aix_parse(data):
|
|||||||
output = []
|
output = []
|
||||||
|
|
||||||
# AIX mount command starts with these headers:
|
# AIX mount command starts with these headers:
|
||||||
# node mounted mounted over vfs date options
|
# node mounted mounted over vfs date options
|
||||||
# -------- --------------- --------------- ------ ------------ ---------------
|
# -------- --------------- --------------- ------ ------------ ---------------
|
||||||
# Remove them
|
# Remove them
|
||||||
data.pop(0)
|
data.pop(0)
|
||||||
data.pop(0)
|
data.pop(0)
|
||||||
|
|
||||||
for entry in data:
|
for entry in data:
|
||||||
output_line = {}
|
output_line = {}
|
||||||
parsed_line = entry.split()
|
parsed_line = entry.split()
|
||||||
@ -168,15 +165,11 @@ def _aix_parse(data):
|
|||||||
# the zeroth element. Then parsed_line has a consistent format.
|
# the zeroth element. Then parsed_line has a consistent format.
|
||||||
if len(parsed_line) == 8:
|
if len(parsed_line) == 8:
|
||||||
parsed_line.pop(0)
|
parsed_line.pop(0)
|
||||||
|
|
||||||
output_line['filesystem'] = parsed_line[0]
|
output_line['filesystem'] = parsed_line[0]
|
||||||
output_line['mount_point'] = parsed_line[1]
|
output_line['mount_point'] = parsed_line[1]
|
||||||
output_line['type'] = parsed_line[2]
|
output_line['type'] = parsed_line[2]
|
||||||
|
output_line['options'] = parsed_line[6].lstrip('(').rstrip(')').split(',')
|
||||||
# options = {}
|
|
||||||
options = parsed_line[6].lstrip('(').rstrip(')').split(',')
|
|
||||||
|
|
||||||
output_line['options'] = options
|
|
||||||
|
|
||||||
output.append(output_line)
|
output.append(output_line)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user