python3-cyberfusion-queue-support 1.7.0__py3-none-any.whl → 2.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cyberfusion/QueueSupport/__init__.py +112 -34
- cyberfusion/QueueSupport/database.py +112 -0
- cyberfusion/QueueSupport/interfaces.py +1 -1
- cyberfusion/QueueSupport/items/__init__.py +13 -1
- cyberfusion/QueueSupport/items/chmod.py +6 -2
- cyberfusion/QueueSupport/items/chown.py +8 -2
- cyberfusion/QueueSupport/items/command.py +6 -2
- cyberfusion/QueueSupport/items/copy.py +6 -2
- cyberfusion/QueueSupport/items/database_create.py +65 -0
- cyberfusion/QueueSupport/items/database_drop.py +65 -0
- cyberfusion/QueueSupport/items/database_user_drop.py +81 -0
- cyberfusion/QueueSupport/items/database_user_ensure_state.py +100 -0
- cyberfusion/QueueSupport/items/database_user_grant_grant.py +104 -0
- cyberfusion/QueueSupport/items/database_user_grant_revoke.py +104 -0
- cyberfusion/QueueSupport/items/mkdir.py +6 -2
- cyberfusion/QueueSupport/items/move.py +6 -2
- cyberfusion/QueueSupport/items/rmtree.py +6 -2
- cyberfusion/QueueSupport/items/systemd_daemon_reload.py +6 -2
- cyberfusion/QueueSupport/items/systemd_tmp_files_create.py +6 -2
- cyberfusion/QueueSupport/items/systemd_unit_disable.py +6 -2
- cyberfusion/QueueSupport/items/systemd_unit_enable.py +6 -2
- cyberfusion/QueueSupport/items/systemd_unit_reload.py +6 -2
- cyberfusion/QueueSupport/items/systemd_unit_restart.py +6 -2
- cyberfusion/QueueSupport/items/systemd_unit_start.py +6 -2
- cyberfusion/QueueSupport/items/systemd_unit_stop.py +6 -2
- cyberfusion/QueueSupport/items/unlink.py +6 -2
- cyberfusion/QueueSupport/outcomes.py +201 -4
- cyberfusion/QueueSupport/settings.py +14 -0
- {python3_cyberfusion_queue_support-1.7.0.dist-info → python3_cyberfusion_queue_support-2.2.dist-info}/METADATA +9 -1
- python3_cyberfusion_queue_support-2.2.dist-info/RECORD +35 -0
- {python3_cyberfusion_queue_support-1.7.0.dist-info → python3_cyberfusion_queue_support-2.2.dist-info}/WHEEL +1 -1
- python3_cyberfusion_queue_support-2.2.dist-info/entry_points.txt +2 -0
- python3_cyberfusion_queue_support-1.7.0.dist-info/RECORD +0 -26
- {python3_cyberfusion_queue_support-1.7.0.dist-info → python3_cyberfusion_queue_support-2.2.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"""Item."""
|
|
2
|
+
|
|
3
|
+
import logging
|
|
4
|
+
from typing import List, Optional
|
|
5
|
+
|
|
6
|
+
from cyberfusion.DatabaseSupport.database_users import DatabaseUser
|
|
7
|
+
from cyberfusion.DatabaseSupport.servers import Server
|
|
8
|
+
|
|
9
|
+
from cyberfusion.QueueSupport.items import _Item
|
|
10
|
+
from cyberfusion.QueueSupport.outcomes import (
|
|
11
|
+
DatabaseUserEnsureStateItemCreateOutcome,
|
|
12
|
+
DatabaseUserEnsureStateItemEditPasswordOutcome,
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
from cyberfusion.DatabaseSupport import DatabaseSupport
|
|
16
|
+
|
|
17
|
+
logger = logging.getLogger(__name__)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class DatabaseUserEnsureStateItem(_Item):
|
|
21
|
+
"""Represents item."""
|
|
22
|
+
|
|
23
|
+
def __init__(
|
|
24
|
+
self,
|
|
25
|
+
*,
|
|
26
|
+
server_software_name: str,
|
|
27
|
+
name: str,
|
|
28
|
+
password: str,
|
|
29
|
+
host: Optional[str] = None,
|
|
30
|
+
reference: Optional[str] = None,
|
|
31
|
+
hide_outcomes: bool = False,
|
|
32
|
+
) -> None:
|
|
33
|
+
"""Set attributes."""
|
|
34
|
+
self.server_software_name = server_software_name
|
|
35
|
+
self.name = name
|
|
36
|
+
self.password = password
|
|
37
|
+
self._host = host
|
|
38
|
+
self._reference = reference
|
|
39
|
+
self._hide_outcomes = hide_outcomes
|
|
40
|
+
|
|
41
|
+
self.database_user = DatabaseUser(
|
|
42
|
+
server=Server(
|
|
43
|
+
support=DatabaseSupport(
|
|
44
|
+
server_software_names=[self.server_software_name]
|
|
45
|
+
)
|
|
46
|
+
),
|
|
47
|
+
name=self.name,
|
|
48
|
+
server_software_name=self.server_software_name,
|
|
49
|
+
password=self.password,
|
|
50
|
+
host=self._host,
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
@property
|
|
54
|
+
def outcomes(
|
|
55
|
+
self,
|
|
56
|
+
) -> List[
|
|
57
|
+
DatabaseUserEnsureStateItemCreateOutcome
|
|
58
|
+
| DatabaseUserEnsureStateItemEditPasswordOutcome
|
|
59
|
+
]:
|
|
60
|
+
"""Get outcomes of item."""
|
|
61
|
+
outcomes = []
|
|
62
|
+
|
|
63
|
+
if not self.database_user.exists:
|
|
64
|
+
outcomes.append(
|
|
65
|
+
DatabaseUserEnsureStateItemCreateOutcome(
|
|
66
|
+
database_user=self.database_user
|
|
67
|
+
)
|
|
68
|
+
)
|
|
69
|
+
elif self.database_user._get_password() != self.password:
|
|
70
|
+
outcomes.append(
|
|
71
|
+
DatabaseUserEnsureStateItemEditPasswordOutcome(
|
|
72
|
+
database_user=self.database_user
|
|
73
|
+
)
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
return outcomes
|
|
77
|
+
|
|
78
|
+
def fulfill(self) -> List[DatabaseUserEnsureStateItemCreateOutcome]:
|
|
79
|
+
"""Fulfill outcomes."""
|
|
80
|
+
outcomes = self.outcomes
|
|
81
|
+
|
|
82
|
+
for outcome in outcomes:
|
|
83
|
+
if isinstance(outcome, DatabaseUserEnsureStateItemCreateOutcome):
|
|
84
|
+
outcome.database_user.create()
|
|
85
|
+
else:
|
|
86
|
+
outcome.database_user.edit()
|
|
87
|
+
|
|
88
|
+
return outcomes
|
|
89
|
+
|
|
90
|
+
def __eq__(self, other: object) -> bool:
|
|
91
|
+
"""Get equality based on attributes."""
|
|
92
|
+
if not isinstance(other, DatabaseUserEnsureStateItem):
|
|
93
|
+
return False
|
|
94
|
+
|
|
95
|
+
return (
|
|
96
|
+
other.server_software_name == self.server_software_name
|
|
97
|
+
and other.name == self.name
|
|
98
|
+
and other._host == self._host
|
|
99
|
+
and other.password == self.password
|
|
100
|
+
)
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"""Item."""
|
|
2
|
+
|
|
3
|
+
import logging
|
|
4
|
+
from typing import List, Optional
|
|
5
|
+
|
|
6
|
+
from cyberfusion.DatabaseSupport.database_user_grants import DatabaseUserGrant
|
|
7
|
+
from cyberfusion.DatabaseSupport.database_users import DatabaseUser
|
|
8
|
+
from cyberfusion.DatabaseSupport.servers import Server
|
|
9
|
+
from cyberfusion.DatabaseSupport.tables import Table
|
|
10
|
+
|
|
11
|
+
from cyberfusion.QueueSupport.items import _Item
|
|
12
|
+
from cyberfusion.QueueSupport.outcomes import DatabaseUserGrantGrantItemGrantOutcome
|
|
13
|
+
|
|
14
|
+
from cyberfusion.DatabaseSupport.databases import Database
|
|
15
|
+
from cyberfusion.DatabaseSupport import DatabaseSupport
|
|
16
|
+
|
|
17
|
+
logger = logging.getLogger(__name__)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class DatabaseUserGrantGrantItem(_Item):
|
|
21
|
+
"""Represents item."""
|
|
22
|
+
|
|
23
|
+
def __init__(
|
|
24
|
+
self,
|
|
25
|
+
*,
|
|
26
|
+
server_software_name: str,
|
|
27
|
+
database_name: str,
|
|
28
|
+
database_user_name: str,
|
|
29
|
+
database_user_host: Optional[str] = None,
|
|
30
|
+
privilege_names: List[str],
|
|
31
|
+
table: Optional[Table],
|
|
32
|
+
reference: Optional[str] = None,
|
|
33
|
+
hide_outcomes: bool = False,
|
|
34
|
+
) -> None:
|
|
35
|
+
"""Set attributes."""
|
|
36
|
+
self.server_software_name = server_software_name
|
|
37
|
+
self.database_name = database_name
|
|
38
|
+
self.database_user_name = database_user_name
|
|
39
|
+
self.database_user_host = database_user_host
|
|
40
|
+
self.privilege_names = privilege_names
|
|
41
|
+
self.table = table
|
|
42
|
+
self._reference = reference
|
|
43
|
+
self._hide_outcomes = hide_outcomes
|
|
44
|
+
|
|
45
|
+
self._database = Database(
|
|
46
|
+
support=DatabaseSupport(server_software_names=[self.server_software_name]),
|
|
47
|
+
name=self.database_name,
|
|
48
|
+
server_software_name=self.server_software_name,
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
self._database_user = DatabaseUser(
|
|
52
|
+
server=Server(
|
|
53
|
+
support=DatabaseSupport(
|
|
54
|
+
server_software_names=[self.server_software_name]
|
|
55
|
+
)
|
|
56
|
+
),
|
|
57
|
+
name=self.database_user_name,
|
|
58
|
+
server_software_name=self.server_software_name,
|
|
59
|
+
host=self.database_user_host,
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
self.database_user_grant = DatabaseUserGrant(
|
|
63
|
+
database=self._database,
|
|
64
|
+
database_user=self._database_user,
|
|
65
|
+
privilege_names=self.privilege_names,
|
|
66
|
+
table=self.table,
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
@property
|
|
70
|
+
def outcomes(self) -> List[DatabaseUserGrantGrantItemGrantOutcome]:
|
|
71
|
+
"""Get outcomes of item."""
|
|
72
|
+
outcomes = []
|
|
73
|
+
|
|
74
|
+
if not self.database_user_grant.exists:
|
|
75
|
+
outcomes.append(
|
|
76
|
+
DatabaseUserGrantGrantItemGrantOutcome(
|
|
77
|
+
database_user_grant=self.database_user_grant
|
|
78
|
+
)
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
return outcomes
|
|
82
|
+
|
|
83
|
+
def fulfill(self) -> List[DatabaseUserGrantGrantItemGrantOutcome]:
|
|
84
|
+
"""Fulfill outcomes."""
|
|
85
|
+
outcomes = self.outcomes
|
|
86
|
+
|
|
87
|
+
for outcome in outcomes:
|
|
88
|
+
outcome.database_user_grant.grant()
|
|
89
|
+
|
|
90
|
+
return outcomes
|
|
91
|
+
|
|
92
|
+
def __eq__(self, other: object) -> bool:
|
|
93
|
+
"""Get equality based on attributes."""
|
|
94
|
+
if not isinstance(other, DatabaseUserGrantGrantItem):
|
|
95
|
+
return False
|
|
96
|
+
|
|
97
|
+
return (
|
|
98
|
+
other.server_software_name == self.server_software_name
|
|
99
|
+
and other.database_user_name == self.database_user_name
|
|
100
|
+
and other.database_user_host == self.database_user_host
|
|
101
|
+
and other.database_name == self.database_name
|
|
102
|
+
and other.privilege_names == self.privilege_names
|
|
103
|
+
and getattr(other.table, "name", None) == getattr(self.table, "name", None)
|
|
104
|
+
)
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"""Item."""
|
|
2
|
+
|
|
3
|
+
import logging
|
|
4
|
+
from typing import List, Optional
|
|
5
|
+
|
|
6
|
+
from cyberfusion.DatabaseSupport.database_user_grants import DatabaseUserGrant
|
|
7
|
+
from cyberfusion.DatabaseSupport.database_users import DatabaseUser
|
|
8
|
+
from cyberfusion.DatabaseSupport.servers import Server
|
|
9
|
+
from cyberfusion.DatabaseSupport.tables import Table
|
|
10
|
+
|
|
11
|
+
from cyberfusion.QueueSupport.items import _Item
|
|
12
|
+
from cyberfusion.QueueSupport.outcomes import DatabaseUserGrantRevokeItemRevokeOutcome
|
|
13
|
+
|
|
14
|
+
from cyberfusion.DatabaseSupport.databases import Database
|
|
15
|
+
from cyberfusion.DatabaseSupport import DatabaseSupport
|
|
16
|
+
|
|
17
|
+
logger = logging.getLogger(__name__)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class DatabaseUserGrantRevokeItem(_Item):
|
|
21
|
+
"""Represents item."""
|
|
22
|
+
|
|
23
|
+
def __init__(
|
|
24
|
+
self,
|
|
25
|
+
*,
|
|
26
|
+
server_software_name: str,
|
|
27
|
+
database_name: str,
|
|
28
|
+
database_user_name: str,
|
|
29
|
+
database_user_host: Optional[str] = None,
|
|
30
|
+
privilege_names: List[str],
|
|
31
|
+
table: Optional[Table],
|
|
32
|
+
reference: Optional[str] = None,
|
|
33
|
+
hide_outcomes: bool = False,
|
|
34
|
+
) -> None:
|
|
35
|
+
"""Set attributes."""
|
|
36
|
+
self.server_software_name = server_software_name
|
|
37
|
+
self.database_name = database_name
|
|
38
|
+
self.database_user_name = database_user_name
|
|
39
|
+
self.database_user_host = database_user_host
|
|
40
|
+
self.privilege_names = privilege_names
|
|
41
|
+
self.table = table
|
|
42
|
+
self._reference = reference
|
|
43
|
+
self._hide_outcomes = hide_outcomes
|
|
44
|
+
|
|
45
|
+
self._database = Database(
|
|
46
|
+
support=DatabaseSupport(server_software_names=[self.server_software_name]),
|
|
47
|
+
name=self.database_name,
|
|
48
|
+
server_software_name=self.server_software_name,
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
self._database_user = DatabaseUser(
|
|
52
|
+
server=Server(
|
|
53
|
+
support=DatabaseSupport(
|
|
54
|
+
server_software_names=[self.server_software_name]
|
|
55
|
+
)
|
|
56
|
+
),
|
|
57
|
+
name=self.database_user_name,
|
|
58
|
+
server_software_name=self.server_software_name,
|
|
59
|
+
host=self.database_user_host,
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
self.database_user_grant = DatabaseUserGrant(
|
|
63
|
+
database=self._database,
|
|
64
|
+
database_user=self._database_user,
|
|
65
|
+
privilege_names=self.privilege_names,
|
|
66
|
+
table=self.table,
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
@property
|
|
70
|
+
def outcomes(self) -> List[DatabaseUserGrantRevokeItemRevokeOutcome]:
|
|
71
|
+
"""Get outcomes of item."""
|
|
72
|
+
outcomes = []
|
|
73
|
+
|
|
74
|
+
if self.database_user_grant.exists:
|
|
75
|
+
outcomes.append(
|
|
76
|
+
DatabaseUserGrantRevokeItemRevokeOutcome(
|
|
77
|
+
database_user_grant=self.database_user_grant
|
|
78
|
+
)
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
return outcomes
|
|
82
|
+
|
|
83
|
+
def fulfill(self) -> List[DatabaseUserGrantRevokeItemRevokeOutcome]:
|
|
84
|
+
"""Fulfill outcomes."""
|
|
85
|
+
outcomes = self.outcomes
|
|
86
|
+
|
|
87
|
+
for outcome in outcomes:
|
|
88
|
+
outcome.database_user_grant.revoke()
|
|
89
|
+
|
|
90
|
+
return outcomes
|
|
91
|
+
|
|
92
|
+
def __eq__(self, other: object) -> bool:
|
|
93
|
+
"""Get equality based on attributes."""
|
|
94
|
+
if not isinstance(other, DatabaseUserGrantRevokeItem):
|
|
95
|
+
return False
|
|
96
|
+
|
|
97
|
+
return (
|
|
98
|
+
other.server_software_name == self.server_software_name
|
|
99
|
+
and other.database_user_name == self.database_user_name
|
|
100
|
+
and other.database_user_host == self.database_user_host
|
|
101
|
+
and other.database_name == self.database_name
|
|
102
|
+
and other.privilege_names == self.privilege_names
|
|
103
|
+
and getattr(other.table, "name", None) == getattr(self.table, "name", None)
|
|
104
|
+
)
|
|
@@ -43,11 +43,15 @@ class MkdirItem(_Item):
|
|
|
43
43
|
|
|
44
44
|
return outcomes
|
|
45
45
|
|
|
46
|
-
def fulfill(self) ->
|
|
46
|
+
def fulfill(self) -> List[MkdirItemCreateOutcome]:
|
|
47
47
|
"""Fulfill outcomes."""
|
|
48
|
-
|
|
48
|
+
outcomes = self.outcomes
|
|
49
|
+
|
|
50
|
+
for outcome in outcomes:
|
|
49
51
|
os.mkdir(outcome.path)
|
|
50
52
|
|
|
53
|
+
return outcomes
|
|
54
|
+
|
|
51
55
|
def __eq__(self, other: object) -> bool:
|
|
52
56
|
"""Get equality based on attributes."""
|
|
53
57
|
if not isinstance(other, MkdirItem):
|
|
@@ -46,11 +46,15 @@ class MoveItem(_Item):
|
|
|
46
46
|
|
|
47
47
|
return outcomes
|
|
48
48
|
|
|
49
|
-
def fulfill(self) ->
|
|
49
|
+
def fulfill(self) -> List[MoveItemMoveOutcome]:
|
|
50
50
|
"""Fulfill outcomes."""
|
|
51
|
-
|
|
51
|
+
outcomes = self.outcomes
|
|
52
|
+
|
|
53
|
+
for outcome in outcomes:
|
|
52
54
|
shutil.move(outcome.source, outcome.destination)
|
|
53
55
|
|
|
56
|
+
return outcomes
|
|
57
|
+
|
|
54
58
|
def __eq__(self, other: object) -> bool:
|
|
55
59
|
"""Get equality based on attributes."""
|
|
56
60
|
if not isinstance(other, MoveItem):
|
|
@@ -44,11 +44,15 @@ class RmTreeItem(_Item):
|
|
|
44
44
|
|
|
45
45
|
return outcomes
|
|
46
46
|
|
|
47
|
-
def fulfill(self) ->
|
|
47
|
+
def fulfill(self) -> List[RmTreeItemRemoveOutcome]:
|
|
48
48
|
"""Fulfill outcomes."""
|
|
49
|
-
|
|
49
|
+
outcomes = self.outcomes
|
|
50
|
+
|
|
51
|
+
for outcome in outcomes:
|
|
50
52
|
shutil.rmtree(outcome.path)
|
|
51
53
|
|
|
54
|
+
return outcomes
|
|
55
|
+
|
|
52
56
|
def __eq__(self, other: object) -> bool:
|
|
53
57
|
"""Get equality based on attributes."""
|
|
54
58
|
if not isinstance(other, RmTreeItem):
|
|
@@ -35,11 +35,15 @@ class SystemdDaemonReloadItem(_Item):
|
|
|
35
35
|
|
|
36
36
|
return outcomes
|
|
37
37
|
|
|
38
|
-
def fulfill(self) ->
|
|
38
|
+
def fulfill(self) -> List[SystemdDaemonReloadItemReloadOutcome]:
|
|
39
39
|
"""Fulfill outcomes."""
|
|
40
|
-
|
|
40
|
+
outcomes = self.outcomes
|
|
41
|
+
|
|
42
|
+
for _ in outcomes:
|
|
41
43
|
SystemdManager.daemon_reload()
|
|
42
44
|
|
|
45
|
+
return outcomes
|
|
46
|
+
|
|
43
47
|
def __eq__(self, other: object) -> bool:
|
|
44
48
|
"""Get equality based on attributes."""
|
|
45
49
|
if not isinstance(other, SystemdDaemonReloadItem):
|
|
@@ -36,11 +36,15 @@ class SystemdTmpFilesCreateItem(_Item):
|
|
|
36
36
|
|
|
37
37
|
return outcomes
|
|
38
38
|
|
|
39
|
-
def fulfill(self) ->
|
|
39
|
+
def fulfill(self) -> List[SystemdTmpFilesCreateItemCreateOutcome]:
|
|
40
40
|
"""Fulfill outcomes."""
|
|
41
|
-
|
|
41
|
+
outcomes = self.outcomes
|
|
42
|
+
|
|
43
|
+
for outcome in outcomes:
|
|
42
44
|
TmpFileConfigurationFile(outcome.path).create()
|
|
43
45
|
|
|
46
|
+
return outcomes
|
|
47
|
+
|
|
44
48
|
def __eq__(self, other: object) -> bool:
|
|
45
49
|
"""Get equality based on attributes."""
|
|
46
50
|
if not isinstance(other, SystemdTmpFilesCreateItem):
|
|
@@ -39,11 +39,15 @@ class SystemdUnitDisableItem(_Item):
|
|
|
39
39
|
|
|
40
40
|
return outcomes
|
|
41
41
|
|
|
42
|
-
def fulfill(self) ->
|
|
42
|
+
def fulfill(self) -> List[SystemdUnitDisableItemDisableOutcome]:
|
|
43
43
|
"""Fulfill outcomes."""
|
|
44
|
-
|
|
44
|
+
outcomes = self.outcomes
|
|
45
|
+
|
|
46
|
+
for outcome in outcomes:
|
|
45
47
|
outcome.unit.disable()
|
|
46
48
|
|
|
49
|
+
return outcomes
|
|
50
|
+
|
|
47
51
|
def __eq__(self, other: object) -> bool:
|
|
48
52
|
"""Get equality based on attributes."""
|
|
49
53
|
if not isinstance(other, SystemdUnitDisableItem):
|
|
@@ -39,11 +39,15 @@ class SystemdUnitEnableItem(_Item):
|
|
|
39
39
|
|
|
40
40
|
return outcomes
|
|
41
41
|
|
|
42
|
-
def fulfill(self) ->
|
|
42
|
+
def fulfill(self) -> List[SystemdUnitEnableItemEnableOutcome]:
|
|
43
43
|
"""Fulfill outcomes."""
|
|
44
|
-
|
|
44
|
+
outcomes = self.outcomes
|
|
45
|
+
|
|
46
|
+
for outcome in outcomes:
|
|
45
47
|
outcome.unit.enable()
|
|
46
48
|
|
|
49
|
+
return outcomes
|
|
50
|
+
|
|
47
51
|
def __eq__(self, other: object) -> bool:
|
|
48
52
|
"""Get equality based on attributes."""
|
|
49
53
|
if not isinstance(other, SystemdUnitEnableItem):
|
|
@@ -38,11 +38,15 @@ class SystemdUnitReloadItem(_Item):
|
|
|
38
38
|
|
|
39
39
|
return outcomes
|
|
40
40
|
|
|
41
|
-
def fulfill(self) ->
|
|
41
|
+
def fulfill(self) -> List[SystemdUnitReloadItemReloadOutcome]:
|
|
42
42
|
"""Fulfill outcomes."""
|
|
43
|
-
|
|
43
|
+
outcomes = self.outcomes
|
|
44
|
+
|
|
45
|
+
for outcome in outcomes:
|
|
44
46
|
outcome.unit.reload()
|
|
45
47
|
|
|
48
|
+
return outcomes
|
|
49
|
+
|
|
46
50
|
def __eq__(self, other: object) -> bool:
|
|
47
51
|
"""Get equality based on attributes."""
|
|
48
52
|
if not isinstance(other, SystemdUnitReloadItem):
|
|
@@ -38,11 +38,15 @@ class SystemdUnitRestartItem(_Item):
|
|
|
38
38
|
|
|
39
39
|
return outcomes
|
|
40
40
|
|
|
41
|
-
def fulfill(self) ->
|
|
41
|
+
def fulfill(self) -> List[SystemdUnitRestartItemRestartOutcome]:
|
|
42
42
|
"""Fulfill outcomes."""
|
|
43
|
-
|
|
43
|
+
outcomes = self.outcomes
|
|
44
|
+
|
|
45
|
+
for outcome in outcomes:
|
|
44
46
|
outcome.unit.restart()
|
|
45
47
|
|
|
48
|
+
return outcomes
|
|
49
|
+
|
|
46
50
|
def __eq__(self, other: object) -> bool:
|
|
47
51
|
"""Get equality based on attributes."""
|
|
48
52
|
if not isinstance(other, SystemdUnitRestartItem):
|
|
@@ -39,11 +39,15 @@ class SystemdUnitStartItem(_Item):
|
|
|
39
39
|
|
|
40
40
|
return outcomes
|
|
41
41
|
|
|
42
|
-
def fulfill(self) ->
|
|
42
|
+
def fulfill(self) -> List[SystemdUnitStartItemStartOutcome]:
|
|
43
43
|
"""Fulfill outcomes."""
|
|
44
|
-
|
|
44
|
+
outcomes = self.outcomes
|
|
45
|
+
|
|
46
|
+
for outcome in outcomes:
|
|
45
47
|
outcome.unit.start()
|
|
46
48
|
|
|
49
|
+
return outcomes
|
|
50
|
+
|
|
47
51
|
def __eq__(self, other: object) -> bool:
|
|
48
52
|
"""Get equality based on attributes."""
|
|
49
53
|
if not isinstance(other, SystemdUnitStartItem):
|
|
@@ -37,11 +37,15 @@ class SystemdUnitStopItem(_Item):
|
|
|
37
37
|
|
|
38
38
|
return outcomes
|
|
39
39
|
|
|
40
|
-
def fulfill(self) ->
|
|
40
|
+
def fulfill(self) -> List[SystemdUnitStopItemStopOutcome]:
|
|
41
41
|
"""Fulfill outcomes."""
|
|
42
|
-
|
|
42
|
+
outcomes = self.outcomes
|
|
43
|
+
|
|
44
|
+
for outcome in outcomes:
|
|
43
45
|
outcome.unit.stop()
|
|
44
46
|
|
|
47
|
+
return outcomes
|
|
48
|
+
|
|
45
49
|
def __eq__(self, other: object) -> bool:
|
|
46
50
|
"""Get equality based on attributes."""
|
|
47
51
|
if not isinstance(other, SystemdUnitStopItem):
|
|
@@ -43,11 +43,15 @@ class UnlinkItem(_Item):
|
|
|
43
43
|
|
|
44
44
|
return outcomes
|
|
45
45
|
|
|
46
|
-
def fulfill(self) ->
|
|
46
|
+
def fulfill(self) -> List[UnlinkItemUnlinkOutcome]:
|
|
47
47
|
"""Fulfill outcomes."""
|
|
48
|
-
|
|
48
|
+
outcomes = self.outcomes
|
|
49
|
+
|
|
50
|
+
for outcome in outcomes:
|
|
49
51
|
os.unlink(outcome.path)
|
|
50
52
|
|
|
53
|
+
return outcomes
|
|
54
|
+
|
|
51
55
|
def __eq__(self, other: object) -> bool:
|
|
52
56
|
"""Get equality based on attributes."""
|
|
53
57
|
if not isinstance(other, UnlinkItem):
|