2019-11-15 10:01:29 -08:00
|
|
|
# jc.parsers.fstab
|
|
|
|
jc - JSON CLI output utility fstab Parser
|
|
|
|
|
|
|
|
Usage:
|
2019-12-12 09:47:14 -08:00
|
|
|
|
2019-11-15 10:01:29 -08:00
|
|
|
specify --fstab as the first argument if the piped input is coming from a fstab file
|
|
|
|
|
2019-12-12 09:21:20 -08:00
|
|
|
Compatibility:
|
2019-12-12 09:47:14 -08:00
|
|
|
|
2019-12-12 09:21:20 -08:00
|
|
|
'linux'
|
|
|
|
|
2019-11-15 10:01:29 -08:00
|
|
|
Examples:
|
|
|
|
|
|
|
|
$ cat /etc/fstab | jc --fstab -p
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"fs_spec": "/dev/mapper/centos-root",
|
|
|
|
"fs_file": "/",
|
|
|
|
"fs_vfstype": "xfs",
|
|
|
|
"fs_mntops": "defaults",
|
|
|
|
"fs_freq": 0,
|
|
|
|
"fs_passno": 0
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"fs_spec": "UUID=05d927bb-5875-49e3-ada1-7f46cb31c932",
|
|
|
|
"fs_file": "/boot",
|
|
|
|
"fs_vfstype": "xfs",
|
|
|
|
"fs_mntops": "defaults",
|
|
|
|
"fs_freq": 0,
|
|
|
|
"fs_passno": 0
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"fs_spec": "/dev/mapper/centos-swap",
|
|
|
|
"fs_file": "swap",
|
|
|
|
"fs_vfstype": "swap",
|
|
|
|
"fs_mntops": "defaults",
|
|
|
|
"fs_freq": 0,
|
|
|
|
"fs_passno": 0
|
|
|
|
}
|
|
|
|
]
|
|
|
|
|
|
|
|
$ cat /etc/fstab | jc --fstab -p -r
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"fs_spec": "/dev/mapper/centos-root",
|
|
|
|
"fs_file": "/",
|
|
|
|
"fs_vfstype": "xfs",
|
|
|
|
"fs_mntops": "defaults",
|
|
|
|
"fs_freq": "0",
|
|
|
|
"fs_passno": "0"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"fs_spec": "UUID=05d927bb-5875-49e3-ada1-7f46cb31c932",
|
|
|
|
"fs_file": "/boot",
|
|
|
|
"fs_vfstype": "xfs",
|
|
|
|
"fs_mntops": "defaults",
|
|
|
|
"fs_freq": "0",
|
|
|
|
"fs_passno": "0"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"fs_spec": "/dev/mapper/centos-swap",
|
|
|
|
"fs_file": "swap",
|
|
|
|
"fs_vfstype": "swap",
|
|
|
|
"fs_mntops": "defaults",
|
|
|
|
"fs_freq": "0",
|
|
|
|
"fs_passno": "0"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
|
2019-12-14 23:35:42 -08:00
|
|
|
## info
|
|
|
|
```python
|
|
|
|
info(self, /, *args, **kwargs)
|
|
|
|
```
|
|
|
|
|
2019-11-15 10:01:29 -08:00
|
|
|
## process
|
|
|
|
```python
|
|
|
|
process(proc_data)
|
|
|
|
```
|
|
|
|
|
|
|
|
Final processing to conform to the schema.
|
|
|
|
|
|
|
|
Parameters:
|
|
|
|
|
|
|
|
proc_data: (dictionary) raw structured data to process
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
|
|
|
dictionary structured data with the following schema:
|
|
|
|
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"fs_spec": string,
|
|
|
|
"fs_file": string,
|
|
|
|
"fs_vfstype": string,
|
|
|
|
"fs_mntops": string,
|
|
|
|
"fs_freq": integer,
|
|
|
|
"fs_passno": integer
|
|
|
|
}
|
|
|
|
]
|
|
|
|
|
|
|
|
## parse
|
|
|
|
```python
|
|
|
|
parse(data, raw=False, quiet=False)
|
|
|
|
```
|
|
|
|
|
|
|
|
Main text parsing function
|
|
|
|
|
|
|
|
Parameters:
|
|
|
|
|
|
|
|
data: (string) text data to parse
|
|
|
|
raw: (boolean) output preprocessed JSON if True
|
|
|
|
quiet: (boolean) suppress warning messages if True
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
|
|
|
dictionary raw or processed structured data
|
|
|
|
|