python3-cyberfusion-queue-support 1.1.3__tar.gz → 1.1.4__tar.gz

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.
Files changed (28) hide show
  1. {python3_cyberfusion_queue_support-1.1.3 → python3_cyberfusion_queue_support-1.1.4}/PKG-INFO +1 -1
  2. {python3_cyberfusion_queue_support-1.1.3 → python3_cyberfusion_queue_support-1.1.4}/pyproject.toml +1 -1
  3. {python3_cyberfusion_queue_support-1.1.3 → python3_cyberfusion_queue_support-1.1.4}/src/cyberfusion/QueueSupport/interfaces.py +1 -1
  4. {python3_cyberfusion_queue_support-1.1.3 → python3_cyberfusion_queue_support-1.1.4}/src/cyberfusion/QueueSupport/items/chmod.py +4 -9
  5. {python3_cyberfusion_queue_support-1.1.3 → python3_cyberfusion_queue_support-1.1.4}/src/cyberfusion/QueueSupport/items/chown.py +17 -23
  6. {python3_cyberfusion_queue_support-1.1.3 → python3_cyberfusion_queue_support-1.1.4}/src/cyberfusion/QueueSupport/items/command.py +17 -23
  7. {python3_cyberfusion_queue_support-1.1.3 → python3_cyberfusion_queue_support-1.1.4}/src/cyberfusion/QueueSupport/items/copy.py +4 -6
  8. {python3_cyberfusion_queue_support-1.1.3 → python3_cyberfusion_queue_support-1.1.4}/src/cyberfusion/QueueSupport/items/mkdir.py +4 -9
  9. {python3_cyberfusion_queue_support-1.1.3 → python3_cyberfusion_queue_support-1.1.4}/src/cyberfusion/QueueSupport/items/move.py +4 -6
  10. {python3_cyberfusion_queue_support-1.1.3 → python3_cyberfusion_queue_support-1.1.4}/src/cyberfusion/QueueSupport/items/systemd_tmp_files_create.py +4 -10
  11. {python3_cyberfusion_queue_support-1.1.3 → python3_cyberfusion_queue_support-1.1.4}/src/cyberfusion/QueueSupport/items/systemd_unit_disable.py +4 -11
  12. {python3_cyberfusion_queue_support-1.1.3 → python3_cyberfusion_queue_support-1.1.4}/src/cyberfusion/QueueSupport/items/systemd_unit_enable.py +4 -11
  13. {python3_cyberfusion_queue_support-1.1.3 → python3_cyberfusion_queue_support-1.1.4}/src/cyberfusion/QueueSupport/items/systemd_unit_reload.py +4 -10
  14. {python3_cyberfusion_queue_support-1.1.3 → python3_cyberfusion_queue_support-1.1.4}/src/cyberfusion/QueueSupport/items/systemd_unit_restart.py +4 -10
  15. {python3_cyberfusion_queue_support-1.1.3 → python3_cyberfusion_queue_support-1.1.4}/src/cyberfusion/QueueSupport/items/systemd_unit_stop.py +4 -9
  16. {python3_cyberfusion_queue_support-1.1.3 → python3_cyberfusion_queue_support-1.1.4}/src/cyberfusion/QueueSupport/items/unlink.py +4 -9
  17. {python3_cyberfusion_queue_support-1.1.3 → python3_cyberfusion_queue_support-1.1.4}/src/python3_cyberfusion_queue_support.egg-info/PKG-INFO +1 -1
  18. {python3_cyberfusion_queue_support-1.1.3 → python3_cyberfusion_queue_support-1.1.4}/README.md +0 -0
  19. {python3_cyberfusion_queue_support-1.1.3 → python3_cyberfusion_queue_support-1.1.4}/setup.cfg +0 -0
  20. {python3_cyberfusion_queue_support-1.1.3 → python3_cyberfusion_queue_support-1.1.4}/src/cyberfusion/QueueSupport/__init__.py +0 -0
  21. {python3_cyberfusion_queue_support-1.1.3 → python3_cyberfusion_queue_support-1.1.4}/src/cyberfusion/QueueSupport/exceptions/__init__.py +0 -0
  22. {python3_cyberfusion_queue_support-1.1.3 → python3_cyberfusion_queue_support-1.1.4}/src/cyberfusion/QueueSupport/items/__init__.py +0 -0
  23. {python3_cyberfusion_queue_support-1.1.3 → python3_cyberfusion_queue_support-1.1.4}/src/cyberfusion/QueueSupport/outcomes.py +0 -0
  24. {python3_cyberfusion_queue_support-1.1.3 → python3_cyberfusion_queue_support-1.1.4}/src/cyberfusion/QueueSupport/utilities.py +0 -0
  25. {python3_cyberfusion_queue_support-1.1.3 → python3_cyberfusion_queue_support-1.1.4}/src/python3_cyberfusion_queue_support.egg-info/SOURCES.txt +0 -0
  26. {python3_cyberfusion_queue_support-1.1.3 → python3_cyberfusion_queue_support-1.1.4}/src/python3_cyberfusion_queue_support.egg-info/dependency_links.txt +0 -0
  27. {python3_cyberfusion_queue_support-1.1.3 → python3_cyberfusion_queue_support-1.1.4}/src/python3_cyberfusion_queue_support.egg-info/requires.txt +0 -0
  28. {python3_cyberfusion_queue_support-1.1.3 → python3_cyberfusion_queue_support-1.1.4}/src/python3_cyberfusion_queue_support.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python3-cyberfusion-queue-support
3
- Version: 1.1.3
3
+ Version: 1.1.4
4
4
  Summary: Library to queue actions.
5
5
  Author-email: Cyberfusion <support@cyberfusion.io>
6
6
  Project-URL: Source, https://github.com/CyberfusionIO/python3-cyberfusion-queue-support
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "python3-cyberfusion-queue-support"
7
- version = "1.1.3"
7
+ version = "1.1.4"
8
8
  description = "Library to queue actions."
9
9
  readme = "README.md"
10
10
  authors = [
@@ -24,7 +24,7 @@ class ItemInterface(metaclass=ABCMeta):
24
24
  @property
25
25
  @abstractmethod
26
26
  def outcomes(self) -> List[OutcomeInterface]: # pragma: no cover
27
- """Get outcomes of calling self.fulfill."""
27
+ """Get outcomes of item."""
28
28
  pass
29
29
 
30
30
  @abstractmethod
@@ -5,7 +5,6 @@ import os
5
5
  from typing import List, Optional
6
6
 
7
7
  from cyberfusion.QueueSupport.exceptions import PathIsSymlinkError
8
- from cyberfusion.QueueSupport.interfaces import OutcomeInterface
9
8
  from cyberfusion.QueueSupport.items import _Item
10
9
  from cyberfusion.QueueSupport.outcomes import ChmodItemModeChangeOutcome
11
10
  from cyberfusion.QueueSupport.utilities import get_decimal_permissions
@@ -34,8 +33,8 @@ class ChmodItem(_Item):
34
33
  raise PathIsSymlinkError(self.path)
35
34
 
36
35
  @property
37
- def outcomes(self) -> List[OutcomeInterface]:
38
- """Get outcomes of calling self.fulfill."""
36
+ def outcomes(self) -> List[ChmodItemModeChangeOutcome]:
37
+ """Get outcomes of item."""
39
38
  outcomes = []
40
39
 
41
40
  if not os.path.exists(self.path):
@@ -59,12 +58,8 @@ class ChmodItem(_Item):
59
58
 
60
59
  def fulfill(self) -> None:
61
60
  """Fulfill outcomes."""
62
- mode_change_outcomes = [
63
- x for x in self.outcomes if isinstance(x, ChmodItemModeChangeOutcome)
64
- ]
65
-
66
- if mode_change_outcomes:
67
- os.chmod(mode_change_outcomes[0].path, mode_change_outcomes[0].new_mode)
61
+ for outcome in self.outcomes:
62
+ os.chmod(outcome.path, outcome.new_mode)
68
63
 
69
64
  def __eq__(self, other: object) -> bool:
70
65
  """Get equality based on attributes."""
@@ -9,7 +9,6 @@ from pwd import getpwuid
9
9
  from typing import List, Optional
10
10
 
11
11
  from cyberfusion.QueueSupport.exceptions import PathIsSymlinkError
12
- from cyberfusion.QueueSupport.interfaces import OutcomeInterface
13
12
  from cyberfusion.QueueSupport.items import _Item
14
13
  from cyberfusion.QueueSupport.outcomes import (
15
14
  ChownItemGroupChangeOutcome,
@@ -52,8 +51,10 @@ class ChownItem(_Item):
52
51
  raise PathIsSymlinkError(self.path)
53
52
 
54
53
  @property
55
- def outcomes(self) -> List[OutcomeInterface]:
56
- """Get outcomes of calling self.fulfill."""
54
+ def outcomes(
55
+ self,
56
+ ) -> List[ChownItemOwnerChangeOutcome | ChownItemGroupChangeOutcome]:
57
+ """Get outcomes of item."""
57
58
  outcomes = []
58
59
 
59
60
  if not os.path.exists(self.path):
@@ -107,26 +108,19 @@ class ChownItem(_Item):
107
108
 
108
109
  def fulfill(self) -> None:
109
110
  """Fulfill outcomes."""
110
- owner_name_change_outcomes = [
111
- x for x in self.outcomes if isinstance(x, ChownItemOwnerChangeOutcome)
112
- ]
113
- group_name_change_outcomes = [
114
- x for x in self.outcomes if isinstance(x, ChownItemGroupChangeOutcome)
115
- ]
116
-
117
- if owner_name_change_outcomes:
118
- os.chown(
119
- owner_name_change_outcomes[0].path,
120
- uid=get_uid(owner_name_change_outcomes[0].new_owner_name),
121
- gid=-1,
122
- )
123
-
124
- if group_name_change_outcomes:
125
- os.chown(
126
- group_name_change_outcomes[0].path,
127
- uid=-1,
128
- gid=get_gid(group_name_change_outcomes[0].new_group_name),
129
- )
111
+ for outcome in self.outcomes:
112
+ if isinstance(outcome, ChownItemOwnerChangeOutcome):
113
+ os.chown(
114
+ outcome.path,
115
+ uid=get_uid(outcome.new_owner_name),
116
+ gid=-1,
117
+ )
118
+ else:
119
+ os.chown(
120
+ outcome.path,
121
+ uid=-1,
122
+ gid=get_gid(outcome.new_group_name),
123
+ )
130
124
 
131
125
  def __eq__(self, other: object) -> bool:
132
126
  """Get equality based on attributes."""
@@ -5,7 +5,6 @@ import subprocess
5
5
  from typing import List, Optional
6
6
 
7
7
  from cyberfusion.QueueSupport.exceptions import CommandQueueFulfillFailed
8
- from cyberfusion.QueueSupport.interfaces import OutcomeInterface
9
8
  from cyberfusion.QueueSupport.items import _Item
10
9
  from cyberfusion.QueueSupport.outcomes import CommandItemRunOutcome
11
10
 
@@ -28,8 +27,8 @@ class CommandItem(_Item):
28
27
  self._hide_outcomes = hide_outcomes
29
28
 
30
29
  @property
31
- def outcomes(self) -> List[OutcomeInterface]:
32
- """Get outcomes of calling self.fulfill."""
30
+ def outcomes(self) -> List[CommandItemRunOutcome]:
31
+ """Get outcomes of item."""
33
32
  outcomes = []
34
33
 
35
34
  outcomes.append(CommandItemRunOutcome(command=self.command))
@@ -38,26 +37,21 @@ class CommandItem(_Item):
38
37
 
39
38
  def fulfill(self) -> None:
40
39
  """Fulfill outcomes."""
41
- run_outcomes = [
42
- x for x in self.outcomes if isinstance(x, CommandItemRunOutcome)
43
- ]
44
-
45
- command = run_outcomes[0].command
46
-
47
- try:
48
- output = subprocess.run(
49
- command,
50
- check=True,
51
- text=True,
52
- capture_output=True,
53
- )
54
-
55
- logger.info("Command stdout: %s", output.stdout)
56
- logger.info("Command stderr: %s", output.stderr)
57
- except subprocess.CalledProcessError as e:
58
- raise CommandQueueFulfillFailed(
59
- self, command=command, stdout=e.stdout, stderr=e.stderr
60
- ) from e
40
+ for outcome in self.outcomes:
41
+ try:
42
+ output = subprocess.run(
43
+ outcome.command,
44
+ check=True,
45
+ text=True,
46
+ capture_output=True,
47
+ )
48
+
49
+ logger.info("Command stdout: %s", output.stdout)
50
+ logger.info("Command stderr: %s", output.stderr)
51
+ except subprocess.CalledProcessError as e:
52
+ raise CommandQueueFulfillFailed(
53
+ self, command=outcome.command, stdout=e.stdout, stderr=e.stderr
54
+ ) from e
61
55
 
62
56
  def __eq__(self, other: object) -> bool:
63
57
  """Get equality based on attributes."""
@@ -6,7 +6,6 @@ import shutil
6
6
  from typing import List, Optional
7
7
 
8
8
  from cyberfusion.QueueSupport.exceptions import PathIsSymlinkError
9
- from cyberfusion.QueueSupport.interfaces import OutcomeInterface
10
9
  from cyberfusion.QueueSupport.items import _Item
11
10
  from cyberfusion.QueueSupport.outcomes import CopyItemCopyOutcome
12
11
 
@@ -37,8 +36,8 @@ class CopyItem(_Item):
37
36
  raise PathIsSymlinkError(self.destination)
38
37
 
39
38
  @property
40
- def outcomes(self) -> List[OutcomeInterface]:
41
- """Get outcomes of calling self.fulfill."""
39
+ def outcomes(self) -> List[CopyItemCopyOutcome]:
40
+ """Get outcomes of item."""
42
41
  outcomes = []
43
42
 
44
43
  outcomes.append(
@@ -49,9 +48,8 @@ class CopyItem(_Item):
49
48
 
50
49
  def fulfill(self) -> None:
51
50
  """Fulfill outcomes."""
52
- copy_outcomes = [x for x in self.outcomes if isinstance(x, CopyItemCopyOutcome)]
53
-
54
- shutil.copyfile(copy_outcomes[0].source, copy_outcomes[0].destination)
51
+ for outcome in self.outcomes:
52
+ shutil.copyfile(outcome.source, outcome.destination)
55
53
 
56
54
  def __eq__(self, other: object) -> bool:
57
55
  """Get equality based on attributes."""
@@ -5,7 +5,6 @@ import os
5
5
  from typing import List, Optional
6
6
 
7
7
  from cyberfusion.QueueSupport.exceptions import PathIsSymlinkError
8
- from cyberfusion.QueueSupport.interfaces import OutcomeInterface
9
8
  from cyberfusion.QueueSupport.items import _Item
10
9
  from cyberfusion.QueueSupport.outcomes import MkdirItemCreateOutcome
11
10
 
@@ -31,8 +30,8 @@ class MkdirItem(_Item):
31
30
  raise PathIsSymlinkError(self.path)
32
31
 
33
32
  @property
34
- def outcomes(self) -> List[OutcomeInterface]:
35
- """Get outcomes of calling self.fulfill."""
33
+ def outcomes(self) -> List[MkdirItemCreateOutcome]:
34
+ """Get outcomes of item."""
36
35
  outcomes = []
37
36
 
38
37
  if not os.path.isdir(self.path):
@@ -46,12 +45,8 @@ class MkdirItem(_Item):
46
45
 
47
46
  def fulfill(self) -> None:
48
47
  """Fulfill outcomes."""
49
- create_outcomes = [
50
- x for x in self.outcomes if isinstance(x, MkdirItemCreateOutcome)
51
- ]
52
-
53
- if create_outcomes:
54
- os.mkdir(create_outcomes[0].path)
48
+ for outcome in self.outcomes:
49
+ os.mkdir(outcome.path)
55
50
 
56
51
  def __eq__(self, other: object) -> bool:
57
52
  """Get equality based on attributes."""
@@ -6,7 +6,6 @@ import shutil
6
6
  from typing import List, Optional
7
7
 
8
8
  from cyberfusion.QueueSupport.exceptions import PathIsSymlinkError
9
- from cyberfusion.QueueSupport.interfaces import OutcomeInterface
10
9
  from cyberfusion.QueueSupport.items import _Item
11
10
  from cyberfusion.QueueSupport.outcomes import MoveItemMoveOutcome
12
11
 
@@ -37,8 +36,8 @@ class MoveItem(_Item):
37
36
  raise PathIsSymlinkError(self.destination)
38
37
 
39
38
  @property
40
- def outcomes(self) -> List[OutcomeInterface]:
41
- """Get outcomes of calling self.fulfill."""
39
+ def outcomes(self) -> List[MoveItemMoveOutcome]:
40
+ """Get outcomes of item."""
42
41
  outcomes = []
43
42
 
44
43
  outcomes.append(
@@ -49,9 +48,8 @@ class MoveItem(_Item):
49
48
 
50
49
  def fulfill(self) -> None:
51
50
  """Fulfill outcomes."""
52
- move_outcomes = [x for x in self.outcomes if isinstance(x, MoveItemMoveOutcome)]
53
-
54
- shutil.move(move_outcomes[0].source, move_outcomes[0].destination)
51
+ for outcome in self.outcomes:
52
+ shutil.move(outcome.source, outcome.destination)
55
53
 
56
54
  def __eq__(self, other: object) -> bool:
57
55
  """Get equality based on attributes."""
@@ -3,7 +3,6 @@
3
3
  import logging
4
4
  from typing import List, Optional
5
5
 
6
- from cyberfusion.QueueSupport.interfaces import OutcomeInterface
7
6
  from cyberfusion.QueueSupport.items import _Item
8
7
  from cyberfusion.QueueSupport.outcomes import (
9
8
  SystemdTmpFilesCreateItemCreateOutcome,
@@ -29,8 +28,8 @@ class SystemdTmpFilesCreateItem(_Item):
29
28
  self._hide_outcomes = hide_outcomes
30
29
 
31
30
  @property
32
- def outcomes(self) -> List[OutcomeInterface]:
33
- """Get outcomes of calling self.fulfill."""
31
+ def outcomes(self) -> List[SystemdTmpFilesCreateItemCreateOutcome]:
32
+ """Get outcomes of item."""
34
33
  outcomes = []
35
34
 
36
35
  outcomes.append(SystemdTmpFilesCreateItemCreateOutcome(path=self.path))
@@ -39,13 +38,8 @@ class SystemdTmpFilesCreateItem(_Item):
39
38
 
40
39
  def fulfill(self) -> None:
41
40
  """Fulfill outcomes."""
42
- systemd_tmp_files_create_outcomes = [
43
- x
44
- for x in self.outcomes
45
- if isinstance(x, SystemdTmpFilesCreateItemCreateOutcome)
46
- ]
47
-
48
- TmpFileConfigurationFile(systemd_tmp_files_create_outcomes[0].path).create()
41
+ for outcome in self.outcomes:
42
+ TmpFileConfigurationFile(outcome.path).create()
49
43
 
50
44
  def __eq__(self, other: object) -> bool:
51
45
  """Get equality based on attributes."""
@@ -3,7 +3,6 @@
3
3
  import logging
4
4
  from typing import List, Optional
5
5
 
6
- from cyberfusion.QueueSupport.interfaces import OutcomeInterface
7
6
  from cyberfusion.QueueSupport.items import _Item
8
7
  from cyberfusion.QueueSupport.outcomes import (
9
8
  SystemdUnitDisableItemDisableOutcome,
@@ -31,8 +30,8 @@ class SystemdUnitDisableItem(_Item):
31
30
  self.unit = Unit(self.name)
32
31
 
33
32
  @property
34
- def outcomes(self) -> List[OutcomeInterface]:
35
- """Get outcomes of calling self.fulfill."""
33
+ def outcomes(self) -> List[SystemdUnitDisableItemDisableOutcome]:
34
+ """Get outcomes of item."""
36
35
  outcomes = []
37
36
 
38
37
  if self.unit.is_enabled:
@@ -42,14 +41,8 @@ class SystemdUnitDisableItem(_Item):
42
41
 
43
42
  def fulfill(self) -> None:
44
43
  """Fulfill outcomes."""
45
- systemd_unit_disable_outcomes = [
46
- x
47
- for x in self.outcomes
48
- if isinstance(x, SystemdUnitDisableItemDisableOutcome)
49
- ]
50
-
51
- if systemd_unit_disable_outcomes:
52
- systemd_unit_disable_outcomes[0].unit.disable()
44
+ for outcome in self.outcomes:
45
+ outcome.unit.disable()
53
46
 
54
47
  def __eq__(self, other: object) -> bool:
55
48
  """Get equality based on attributes."""
@@ -3,7 +3,6 @@
3
3
  import logging
4
4
  from typing import List, Optional
5
5
 
6
- from cyberfusion.QueueSupport.interfaces import OutcomeInterface
7
6
  from cyberfusion.QueueSupport.items import _Item
8
7
  from cyberfusion.QueueSupport.outcomes import (
9
8
  SystemdUnitEnableItemEnableOutcome,
@@ -31,8 +30,8 @@ class SystemdUnitEnableItem(_Item):
31
30
  self.unit = Unit(self.name)
32
31
 
33
32
  @property
34
- def outcomes(self) -> List[OutcomeInterface]:
35
- """Get outcomes of calling self.fulfill."""
33
+ def outcomes(self) -> List[SystemdUnitEnableItemEnableOutcome]:
34
+ """Get outcomes of item."""
36
35
  outcomes = []
37
36
 
38
37
  if not self.unit.is_enabled:
@@ -42,14 +41,8 @@ class SystemdUnitEnableItem(_Item):
42
41
 
43
42
  def fulfill(self) -> None:
44
43
  """Fulfill outcomes."""
45
- systemd_unit_enable_outcomes = [
46
- x
47
- for x in self.outcomes
48
- if isinstance(x, SystemdUnitEnableItemEnableOutcome)
49
- ]
50
-
51
- if systemd_unit_enable_outcomes:
52
- systemd_unit_enable_outcomes[0].unit.enable()
44
+ for outcome in self.outcomes:
45
+ outcome.unit.enable()
53
46
 
54
47
  def __eq__(self, other: object) -> bool:
55
48
  """Get equality based on attributes."""
@@ -3,7 +3,6 @@
3
3
  import logging
4
4
  from typing import List, Optional
5
5
 
6
- from cyberfusion.QueueSupport.interfaces import OutcomeInterface
7
6
  from cyberfusion.QueueSupport.items import _Item
8
7
  from cyberfusion.QueueSupport.outcomes import (
9
8
  SystemdUnitReloadItemReloadOutcome,
@@ -31,8 +30,8 @@ class SystemdUnitReloadItem(_Item):
31
30
  self.unit = Unit(self.name)
32
31
 
33
32
  @property
34
- def outcomes(self) -> List[OutcomeInterface]:
35
- """Get outcomes of calling self.fulfill."""
33
+ def outcomes(self) -> List[SystemdUnitReloadItemReloadOutcome]:
34
+ """Get outcomes of item."""
36
35
  outcomes = []
37
36
 
38
37
  outcomes.append(SystemdUnitReloadItemReloadOutcome(unit=self.unit))
@@ -41,13 +40,8 @@ class SystemdUnitReloadItem(_Item):
41
40
 
42
41
  def fulfill(self) -> None:
43
42
  """Fulfill outcomes."""
44
- systemd_unit_reload_outcomes = [
45
- x
46
- for x in self.outcomes
47
- if isinstance(x, SystemdUnitReloadItemReloadOutcome)
48
- ]
49
-
50
- systemd_unit_reload_outcomes[0].unit.reload()
43
+ for outcome in self.outcomes:
44
+ outcome.unit.reload()
51
45
 
52
46
  def __eq__(self, other: object) -> bool:
53
47
  """Get equality based on attributes."""
@@ -3,7 +3,6 @@
3
3
  import logging
4
4
  from typing import List, Optional
5
5
 
6
- from cyberfusion.QueueSupport.interfaces import OutcomeInterface
7
6
  from cyberfusion.QueueSupport.items import _Item
8
7
  from cyberfusion.QueueSupport.outcomes import (
9
8
  SystemdUnitRestartItemRestartOutcome,
@@ -31,8 +30,8 @@ class SystemdUnitRestartItem(_Item):
31
30
  self.unit = Unit(self.name)
32
31
 
33
32
  @property
34
- def outcomes(self) -> List[OutcomeInterface]:
35
- """Get outcomes of calling self.fulfill."""
33
+ def outcomes(self) -> List[SystemdUnitRestartItemRestartOutcome]:
34
+ """Get outcomes of item."""
36
35
  outcomes = []
37
36
 
38
37
  outcomes.append(SystemdUnitRestartItemRestartOutcome(unit=self.unit))
@@ -41,13 +40,8 @@ class SystemdUnitRestartItem(_Item):
41
40
 
42
41
  def fulfill(self) -> None:
43
42
  """Fulfill outcomes."""
44
- systemd_unit_restart_outcomes = [
45
- x
46
- for x in self.outcomes
47
- if isinstance(x, SystemdUnitRestartItemRestartOutcome)
48
- ]
49
-
50
- systemd_unit_restart_outcomes[0].unit.restart()
43
+ for outcome in self.outcomes:
44
+ outcome.unit.restart()
51
45
 
52
46
  def __eq__(self, other: object) -> bool:
53
47
  """Get equality based on attributes."""
@@ -3,7 +3,6 @@
3
3
  import logging
4
4
  from typing import List, Optional
5
5
 
6
- from cyberfusion.QueueSupport.interfaces import OutcomeInterface
7
6
  from cyberfusion.QueueSupport.items import _Item
8
7
  from cyberfusion.QueueSupport.outcomes import SystemdUnitStopItemStopOutcome
9
8
  from cyberfusion.SystemdSupport.units import Unit
@@ -29,8 +28,8 @@ class SystemdUnitStopItem(_Item):
29
28
  self.unit = Unit(self.name)
30
29
 
31
30
  @property
32
- def outcomes(self) -> List[OutcomeInterface]:
33
- """Get outcomes of calling self.fulfill."""
31
+ def outcomes(self) -> List[SystemdUnitStopItemStopOutcome]:
32
+ """Get outcomes of item."""
34
33
  outcomes = []
35
34
 
36
35
  if self.unit.is_active:
@@ -40,12 +39,8 @@ class SystemdUnitStopItem(_Item):
40
39
 
41
40
  def fulfill(self) -> None:
42
41
  """Fulfill outcomes."""
43
- systemd_unit_stop_outcomes = [
44
- x for x in self.outcomes if isinstance(x, SystemdUnitStopItemStopOutcome)
45
- ]
46
-
47
- if systemd_unit_stop_outcomes:
48
- systemd_unit_stop_outcomes[0].unit.stop()
42
+ for outcome in self.outcomes:
43
+ outcome.unit.stop()
49
44
 
50
45
  def __eq__(self, other: object) -> bool:
51
46
  """Get equality based on attributes."""
@@ -5,7 +5,6 @@ import os
5
5
  from typing import List, Optional
6
6
 
7
7
  from cyberfusion.QueueSupport.exceptions import PathIsSymlinkError
8
- from cyberfusion.QueueSupport.interfaces import OutcomeInterface
9
8
  from cyberfusion.QueueSupport.items import _Item
10
9
  from cyberfusion.QueueSupport.outcomes import UnlinkItemUnlinkOutcome
11
10
 
@@ -31,8 +30,8 @@ class UnlinkItem(_Item):
31
30
  raise PathIsSymlinkError(self.path)
32
31
 
33
32
  @property
34
- def outcomes(self) -> List[OutcomeInterface]:
35
- """Get outcomes of calling self.fulfill."""
33
+ def outcomes(self) -> List[UnlinkItemUnlinkOutcome]:
34
+ """Get outcomes of item."""
36
35
  outcomes = []
37
36
 
38
37
  if os.path.exists(self.path):
@@ -46,12 +45,8 @@ class UnlinkItem(_Item):
46
45
 
47
46
  def fulfill(self) -> None:
48
47
  """Fulfill outcomes."""
49
- unlink_outcomes = [
50
- x for x in self.outcomes if isinstance(x, UnlinkItemUnlinkOutcome)
51
- ]
52
-
53
- if unlink_outcomes:
54
- os.unlink(unlink_outcomes[0].path)
48
+ for outcome in self.outcomes:
49
+ os.unlink(outcome.path)
55
50
 
56
51
  def __eq__(self, other: object) -> bool:
57
52
  """Get equality based on attributes."""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python3-cyberfusion-queue-support
3
- Version: 1.1.3
3
+ Version: 1.1.4
4
4
  Summary: Library to queue actions.
5
5
  Author-email: Cyberfusion <support@cyberfusion.io>
6
6
  Project-URL: Source, https://github.com/CyberfusionIO/python3-cyberfusion-queue-support