python3-cyberfusion-queue-support 1.4__tar.gz → 1.6__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.
- {python3_cyberfusion_queue_support-1.4 → python3_cyberfusion_queue_support-1.6}/PKG-INFO +2 -2
- {python3_cyberfusion_queue_support-1.4 → python3_cyberfusion_queue_support-1.6}/pyproject.toml +1 -1
- {python3_cyberfusion_queue_support-1.4 → python3_cyberfusion_queue_support-1.6}/src/cyberfusion/QueueSupport/items/copy.py +37 -3
- python3_cyberfusion_queue_support-1.6/src/cyberfusion/QueueSupport/items/systemd_daemon_reload.py +48 -0
- {python3_cyberfusion_queue_support-1.4 → python3_cyberfusion_queue_support-1.6}/src/cyberfusion/QueueSupport/outcomes.py +35 -3
- {python3_cyberfusion_queue_support-1.4 → python3_cyberfusion_queue_support-1.6}/src/python3_cyberfusion_queue_support.egg-info/PKG-INFO +2 -2
- {python3_cyberfusion_queue_support-1.4 → python3_cyberfusion_queue_support-1.6}/src/python3_cyberfusion_queue_support.egg-info/SOURCES.txt +1 -0
- {python3_cyberfusion_queue_support-1.4 → python3_cyberfusion_queue_support-1.6}/README.md +0 -0
- {python3_cyberfusion_queue_support-1.4 → python3_cyberfusion_queue_support-1.6}/setup.cfg +0 -0
- {python3_cyberfusion_queue_support-1.4 → python3_cyberfusion_queue_support-1.6}/src/cyberfusion/QueueSupport/__init__.py +0 -0
- {python3_cyberfusion_queue_support-1.4 → python3_cyberfusion_queue_support-1.6}/src/cyberfusion/QueueSupport/exceptions/__init__.py +0 -0
- {python3_cyberfusion_queue_support-1.4 → python3_cyberfusion_queue_support-1.6}/src/cyberfusion/QueueSupport/interfaces.py +0 -0
- {python3_cyberfusion_queue_support-1.4 → python3_cyberfusion_queue_support-1.6}/src/cyberfusion/QueueSupport/items/__init__.py +0 -0
- {python3_cyberfusion_queue_support-1.4 → python3_cyberfusion_queue_support-1.6}/src/cyberfusion/QueueSupport/items/chmod.py +0 -0
- {python3_cyberfusion_queue_support-1.4 → python3_cyberfusion_queue_support-1.6}/src/cyberfusion/QueueSupport/items/chown.py +0 -0
- {python3_cyberfusion_queue_support-1.4 → python3_cyberfusion_queue_support-1.6}/src/cyberfusion/QueueSupport/items/command.py +0 -0
- {python3_cyberfusion_queue_support-1.4 → python3_cyberfusion_queue_support-1.6}/src/cyberfusion/QueueSupport/items/mkdir.py +0 -0
- {python3_cyberfusion_queue_support-1.4 → python3_cyberfusion_queue_support-1.6}/src/cyberfusion/QueueSupport/items/move.py +0 -0
- {python3_cyberfusion_queue_support-1.4 → python3_cyberfusion_queue_support-1.6}/src/cyberfusion/QueueSupport/items/rmtree.py +0 -0
- {python3_cyberfusion_queue_support-1.4 → python3_cyberfusion_queue_support-1.6}/src/cyberfusion/QueueSupport/items/systemd_tmp_files_create.py +0 -0
- {python3_cyberfusion_queue_support-1.4 → python3_cyberfusion_queue_support-1.6}/src/cyberfusion/QueueSupport/items/systemd_unit_disable.py +0 -0
- {python3_cyberfusion_queue_support-1.4 → python3_cyberfusion_queue_support-1.6}/src/cyberfusion/QueueSupport/items/systemd_unit_enable.py +0 -0
- {python3_cyberfusion_queue_support-1.4 → python3_cyberfusion_queue_support-1.6}/src/cyberfusion/QueueSupport/items/systemd_unit_reload.py +0 -0
- {python3_cyberfusion_queue_support-1.4 → python3_cyberfusion_queue_support-1.6}/src/cyberfusion/QueueSupport/items/systemd_unit_restart.py +0 -0
- {python3_cyberfusion_queue_support-1.4 → python3_cyberfusion_queue_support-1.6}/src/cyberfusion/QueueSupport/items/systemd_unit_start.py +0 -0
- {python3_cyberfusion_queue_support-1.4 → python3_cyberfusion_queue_support-1.6}/src/cyberfusion/QueueSupport/items/systemd_unit_stop.py +0 -0
- {python3_cyberfusion_queue_support-1.4 → python3_cyberfusion_queue_support-1.6}/src/cyberfusion/QueueSupport/items/unlink.py +0 -0
- {python3_cyberfusion_queue_support-1.4 → python3_cyberfusion_queue_support-1.6}/src/cyberfusion/QueueSupport/utilities.py +0 -0
- {python3_cyberfusion_queue_support-1.4 → python3_cyberfusion_queue_support-1.6}/src/python3_cyberfusion_queue_support.egg-info/dependency_links.txt +0 -0
- {python3_cyberfusion_queue_support-1.4 → python3_cyberfusion_queue_support-1.6}/src/python3_cyberfusion_queue_support.egg-info/requires.txt +0 -0
- {python3_cyberfusion_queue_support-1.4 → python3_cyberfusion_queue_support-1.6}/src/python3_cyberfusion_queue_support.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: python3-cyberfusion-queue-support
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.6
|
|
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
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"""Item."""
|
|
2
2
|
|
|
3
|
+
import difflib
|
|
3
4
|
import logging
|
|
4
5
|
import os
|
|
5
6
|
import shutil
|
|
@@ -35,14 +36,47 @@ class CopyItem(_Item):
|
|
|
35
36
|
if os.path.islink(self.destination):
|
|
36
37
|
raise PathIsSymlinkError(self.destination)
|
|
37
38
|
|
|
39
|
+
def _get_changed_lines(self) -> List[str]:
|
|
40
|
+
"""Get differences with destination file.
|
|
41
|
+
|
|
42
|
+
No differences are returned when contents is not string.
|
|
43
|
+
"""
|
|
44
|
+
changed_lines = []
|
|
45
|
+
|
|
46
|
+
contents = []
|
|
47
|
+
|
|
48
|
+
if os.path.isfile(self.destination):
|
|
49
|
+
contents = open(self.destination).readlines()
|
|
50
|
+
|
|
51
|
+
source_contents = open(self.source).readlines()
|
|
52
|
+
|
|
53
|
+
for line in difflib.unified_diff(
|
|
54
|
+
contents,
|
|
55
|
+
source_contents,
|
|
56
|
+
fromfile=self.source,
|
|
57
|
+
tofile=self.destination,
|
|
58
|
+
lineterm="",
|
|
59
|
+
n=0,
|
|
60
|
+
):
|
|
61
|
+
changed_lines.append(line)
|
|
62
|
+
|
|
63
|
+
return changed_lines
|
|
64
|
+
|
|
38
65
|
@property
|
|
39
66
|
def outcomes(self) -> List[CopyItemCopyOutcome]:
|
|
40
67
|
"""Get outcomes of item."""
|
|
41
68
|
outcomes = []
|
|
42
69
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
)
|
|
70
|
+
changed_lines = self._get_changed_lines()
|
|
71
|
+
|
|
72
|
+
if not os.path.exists(self.destination) or changed_lines:
|
|
73
|
+
outcomes.append(
|
|
74
|
+
CopyItemCopyOutcome(
|
|
75
|
+
source=self.source,
|
|
76
|
+
destination=self.destination,
|
|
77
|
+
changed_lines=changed_lines,
|
|
78
|
+
)
|
|
79
|
+
)
|
|
46
80
|
|
|
47
81
|
return outcomes
|
|
48
82
|
|
python3_cyberfusion_queue_support-1.6/src/cyberfusion/QueueSupport/items/systemd_daemon_reload.py
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"""Item."""
|
|
2
|
+
|
|
3
|
+
import logging
|
|
4
|
+
from typing import List, Optional
|
|
5
|
+
|
|
6
|
+
from cyberfusion.SystemdSupport.manager import SystemdManager
|
|
7
|
+
|
|
8
|
+
from cyberfusion.QueueSupport.items import _Item
|
|
9
|
+
from cyberfusion.QueueSupport.outcomes import (
|
|
10
|
+
SystemdDaemonReloadItemReloadOutcome,
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
logger = logging.getLogger(__name__)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class SystemdDaemonReloadItem(_Item):
|
|
17
|
+
"""Represents item."""
|
|
18
|
+
|
|
19
|
+
def __init__(
|
|
20
|
+
self,
|
|
21
|
+
*,
|
|
22
|
+
reference: Optional[str] = None,
|
|
23
|
+
hide_outcomes: bool = False,
|
|
24
|
+
) -> None:
|
|
25
|
+
"""Set attributes."""
|
|
26
|
+
self._reference = reference
|
|
27
|
+
self._hide_outcomes = hide_outcomes
|
|
28
|
+
|
|
29
|
+
@property
|
|
30
|
+
def outcomes(self) -> List[SystemdDaemonReloadItemReloadOutcome]:
|
|
31
|
+
"""Get outcomes of item."""
|
|
32
|
+
outcomes = []
|
|
33
|
+
|
|
34
|
+
outcomes.append(SystemdDaemonReloadItemReloadOutcome())
|
|
35
|
+
|
|
36
|
+
return outcomes
|
|
37
|
+
|
|
38
|
+
def fulfill(self) -> None:
|
|
39
|
+
"""Fulfill outcomes."""
|
|
40
|
+
for _ in self.outcomes:
|
|
41
|
+
SystemdManager.daemon_reload()
|
|
42
|
+
|
|
43
|
+
def __eq__(self, other: object) -> bool:
|
|
44
|
+
"""Get equality based on attributes."""
|
|
45
|
+
if not isinstance(other, SystemdDaemonReloadItem):
|
|
46
|
+
return False
|
|
47
|
+
|
|
48
|
+
return True
|
|
@@ -9,21 +9,32 @@ from cyberfusion.SystemdSupport.units import Unit
|
|
|
9
9
|
class CopyItemCopyOutcome(OutcomeInterface):
|
|
10
10
|
"""Represents outcome."""
|
|
11
11
|
|
|
12
|
-
def __init__(
|
|
12
|
+
def __init__(
|
|
13
|
+
self, *, source: str, destination: str, changed_lines: list[str]
|
|
14
|
+
) -> None:
|
|
13
15
|
"""Set attributes."""
|
|
14
16
|
self.source = source
|
|
15
17
|
self.destination = destination
|
|
18
|
+
self.changed_lines = changed_lines
|
|
16
19
|
|
|
17
20
|
def __str__(self) -> str:
|
|
18
21
|
"""Get human-readable string."""
|
|
19
|
-
|
|
22
|
+
changed_lines = "\n".join(self.changed_lines)
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
f"Copy {self.source} to {self.destination}.\nChanged_lines:\n{changed_lines}"
|
|
26
|
+
)
|
|
20
27
|
|
|
21
28
|
def __eq__(self, other: object) -> bool:
|
|
22
29
|
"""Get equality based on attributes."""
|
|
23
30
|
if not isinstance(other, CopyItemCopyOutcome):
|
|
24
31
|
return False
|
|
25
32
|
|
|
26
|
-
return
|
|
33
|
+
return (
|
|
34
|
+
other.source == self.source
|
|
35
|
+
and other.destination == self.destination
|
|
36
|
+
and other.changed_lines == self.changed_lines
|
|
37
|
+
)
|
|
27
38
|
|
|
28
39
|
|
|
29
40
|
class MoveItemMoveOutcome(OutcomeInterface):
|
|
@@ -248,6 +259,27 @@ class SystemdUnitEnableItemEnableOutcome(OutcomeInterface):
|
|
|
248
259
|
return other.unit.name == self.unit.name
|
|
249
260
|
|
|
250
261
|
|
|
262
|
+
class SystemdDaemonReloadItemReloadOutcome(OutcomeInterface):
|
|
263
|
+
"""Represents outcome."""
|
|
264
|
+
|
|
265
|
+
def __init__(
|
|
266
|
+
self,
|
|
267
|
+
) -> None:
|
|
268
|
+
"""Set attributes."""
|
|
269
|
+
pass
|
|
270
|
+
|
|
271
|
+
def __str__(self) -> str:
|
|
272
|
+
"""Get human-readable string."""
|
|
273
|
+
return "Reload daemon"
|
|
274
|
+
|
|
275
|
+
def __eq__(self, other: object) -> bool:
|
|
276
|
+
"""Get equality based on attributes."""
|
|
277
|
+
if not isinstance(other, SystemdDaemonReloadItemReloadOutcome):
|
|
278
|
+
return False
|
|
279
|
+
|
|
280
|
+
return True
|
|
281
|
+
|
|
282
|
+
|
|
251
283
|
class SystemdUnitStartItemStartOutcome(OutcomeInterface):
|
|
252
284
|
"""Represents outcome."""
|
|
253
285
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: python3-cyberfusion-queue-support
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.6
|
|
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
|
|
@@ -14,6 +14,7 @@ src/cyberfusion/QueueSupport/items/copy.py
|
|
|
14
14
|
src/cyberfusion/QueueSupport/items/mkdir.py
|
|
15
15
|
src/cyberfusion/QueueSupport/items/move.py
|
|
16
16
|
src/cyberfusion/QueueSupport/items/rmtree.py
|
|
17
|
+
src/cyberfusion/QueueSupport/items/systemd_daemon_reload.py
|
|
17
18
|
src/cyberfusion/QueueSupport/items/systemd_tmp_files_create.py
|
|
18
19
|
src/cyberfusion/QueueSupport/items/systemd_unit_disable.py
|
|
19
20
|
src/cyberfusion/QueueSupport/items/systemd_unit_enable.py
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|