11"""
2- Manage ZFS filesystems.
2+ Gather information about ZFS filesystems.
33"""
44
55from pyinfra .api import FactBase , ShortFactBase
@@ -15,38 +15,46 @@ def _process_zfs_props_table(output):
1515 return datasets
1616
1717
18- class Pools (FactBase ):
18+ class ZfsPools (FactBase ):
1919 def command (self ):
2020 return "zpool get -H all"
2121
2222 def process (self , output ):
2323 return _process_zfs_props_table (output )
2424
2525
26- class Datasets (FactBase ):
26+ class ZfsDatasets (FactBase ):
2727 def command (self ):
2828 return "zfs get -H all"
2929
3030 def process (self , output ):
3131 return _process_zfs_props_table (output )
3232
3333
34- class Filesystems (ShortFactBase ):
35- fact = Datasets
34+ class ZfsFilesystems (ShortFactBase ):
35+ fact = ZfsDatasets
3636
3737 def process_data (self , data ):
3838 return {name : props for name , props in data .items () if props .get ("type" ) == "filesystem" }
3939
4040
41- class Snapshots (ShortFactBase ):
42- fact = Datasets
41+ class ZfsSnapshots (ShortFactBase ):
42+ fact = ZfsDatasets
4343
4444 def process_data (self , data ):
4545 return {name : props for name , props in data .items () if props .get ("type" ) == "snapshot" }
4646
4747
48- class Volumes (ShortFactBase ):
49- fact = Datasets
48+ class ZfsVolumes (ShortFactBase ):
49+ fact = ZfsDatasets
5050
5151 def process_data (self , data ):
5252 return {name : props for name , props in data .items () if props .get ("type" ) == "volume" }
53+
54+
55+ # TODO: remove these in v4! Or flip the convention and remove all the other fact prefixes!
56+ Pools = ZfsPools
57+ Datasets = ZfsDatasets
58+ Filesystems = ZfsFilesystems
59+ Snapshots = ZfsSnapshots
60+ Volumes = ZfsVolumes
0 commit comments