Skip to content

Commit dceb4df

Browse files
committed
WIP: facts: process and process_data are not staticmethods
1 parent f63de04 commit dceb4df

File tree

3 files changed

+9
-18
lines changed

3 files changed

+9
-18
lines changed

pyinfra/facts/mysql.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,7 @@ def command( # type: ignore[override]
214214
mysql_port,
215215
)
216216

217-
@staticmethod
218-
def process(output):
217+
def process(self, output):
219218
database_table_privileges = defaultdict(set)
220219

221220
for line in output:

pyinfra/facts/server.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ class Home(FactBase[Optional[str]]):
3232
Returns the home directory of the given user, or the current user if no user is given.
3333
"""
3434

35-
@staticmethod
36-
def command(user=""):
35+
def command(self, user=""):
3736
return f"echo ~{user}"
3837

3938

@@ -124,8 +123,7 @@ class Command(FactBase[str]):
124123
Returns the raw output lines of a given command.
125124
"""
126125

127-
@staticmethod
128-
def command(command):
126+
def command(self, command):
129127
return command
130128

131129

@@ -134,8 +132,7 @@ class Which(FactBase[Optional[str]]):
134132
Returns the path of a given command according to `command -v`, if available.
135133
"""
136134

137-
@staticmethod
138-
def command(command):
135+
def command(self, command):
139136
return "command -v {0} || true".format(command)
140137

141138

pyinfra/facts/zfs.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,39 +19,34 @@ class Pools(FactBase):
1919
def command(self):
2020
return "zpool get -H all"
2121

22-
@staticmethod
23-
def process(output):
22+
def process(self, output):
2423
return _process_zfs_props_table(output)
2524

2625

2726
class Datasets(FactBase):
2827
def command(self):
2928
return "zfs get -H all"
3029

31-
@staticmethod
32-
def process(output):
30+
def process(self, output):
3331
return _process_zfs_props_table(output)
3432

3533

3634
class Filesystems(ShortFactBase):
3735
fact = Datasets
3836

39-
@staticmethod
40-
def process_data(data):
37+
def process_data(self, data):
4138
return {name: props for name, props in data.items() if props.get("type") == "filesystem"}
4239

4340

4441
class Snapshots(ShortFactBase):
4542
fact = Datasets
4643

47-
@staticmethod
48-
def process_data(data):
44+
def process_data(self, data):
4945
return {name: props for name, props in data.items() if props.get("type") == "snapshot"}
5046

5147

5248
class Volumes(ShortFactBase):
5349
fact = Datasets
5450

55-
@staticmethod
56-
def process_data(data):
51+
def process_data(self, data):
5752
return {name: props for name, props in data.items() if props.get("type") == "volume"}

0 commit comments

Comments
 (0)