1
1
"""
2
- Manage ZFS filesystems.
2
+ Gather information about ZFS filesystems.
3
3
"""
4
4
5
5
from pyinfra .api import FactBase , ShortFactBase
@@ -15,38 +15,46 @@ def _process_zfs_props_table(output):
15
15
return datasets
16
16
17
17
18
- class Pools (FactBase ):
18
+ class ZfsPools (FactBase ):
19
19
def command (self ):
20
20
return "zpool get -H all"
21
21
22
22
def process (self , output ):
23
23
return _process_zfs_props_table (output )
24
24
25
25
26
- class Datasets (FactBase ):
26
+ class ZfsDatasets (FactBase ):
27
27
def command (self ):
28
28
return "zfs get -H all"
29
29
30
30
def process (self , output ):
31
31
return _process_zfs_props_table (output )
32
32
33
33
34
- class Filesystems (ShortFactBase ):
35
- fact = Datasets
34
+ class ZfsFilesystems (ShortFactBase ):
35
+ fact = ZfsDatasets
36
36
37
37
def process_data (self , data ):
38
38
return {name : props for name , props in data .items () if props .get ("type" ) == "filesystem" }
39
39
40
40
41
- class Snapshots (ShortFactBase ):
42
- fact = Datasets
41
+ class ZfsSnapshots (ShortFactBase ):
42
+ fact = ZfsDatasets
43
43
44
44
def process_data (self , data ):
45
45
return {name : props for name , props in data .items () if props .get ("type" ) == "snapshot" }
46
46
47
47
48
- class Volumes (ShortFactBase ):
49
- fact = Datasets
48
+ class ZfsVolumes (ShortFactBase ):
49
+ fact = ZfsDatasets
50
50
51
51
def process_data (self , data ):
52
52
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