python3-cyberfusion-queue-support 1.1.4__tar.gz → 1.3__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 (33) hide show
  1. python3_cyberfusion_queue_support-1.3/PKG-INFO +171 -0
  2. python3_cyberfusion_queue_support-1.3/README.md +162 -0
  3. {python3_cyberfusion_queue_support-1.1.4 → python3_cyberfusion_queue_support-1.3}/pyproject.toml +2 -2
  4. python3_cyberfusion_queue_support-1.3/src/cyberfusion/QueueSupport/items/rmtree.py +57 -0
  5. {python3_cyberfusion_queue_support-1.1.4 → python3_cyberfusion_queue_support-1.3}/src/cyberfusion/QueueSupport/outcomes.py +19 -0
  6. python3_cyberfusion_queue_support-1.3/src/python3_cyberfusion_queue_support.egg-info/PKG-INFO +171 -0
  7. {python3_cyberfusion_queue_support-1.1.4 → python3_cyberfusion_queue_support-1.3}/src/python3_cyberfusion_queue_support.egg-info/SOURCES.txt +1 -0
  8. python3_cyberfusion_queue_support-1.3/src/python3_cyberfusion_queue_support.egg-info/requires.txt +1 -0
  9. python3_cyberfusion_queue_support-1.1.4/PKG-INFO +0 -54
  10. python3_cyberfusion_queue_support-1.1.4/README.md +0 -45
  11. python3_cyberfusion_queue_support-1.1.4/src/python3_cyberfusion_queue_support.egg-info/PKG-INFO +0 -54
  12. python3_cyberfusion_queue_support-1.1.4/src/python3_cyberfusion_queue_support.egg-info/requires.txt +0 -1
  13. {python3_cyberfusion_queue_support-1.1.4 → python3_cyberfusion_queue_support-1.3}/setup.cfg +0 -0
  14. {python3_cyberfusion_queue_support-1.1.4 → python3_cyberfusion_queue_support-1.3}/src/cyberfusion/QueueSupport/__init__.py +0 -0
  15. {python3_cyberfusion_queue_support-1.1.4 → python3_cyberfusion_queue_support-1.3}/src/cyberfusion/QueueSupport/exceptions/__init__.py +0 -0
  16. {python3_cyberfusion_queue_support-1.1.4 → python3_cyberfusion_queue_support-1.3}/src/cyberfusion/QueueSupport/interfaces.py +0 -0
  17. {python3_cyberfusion_queue_support-1.1.4 → python3_cyberfusion_queue_support-1.3}/src/cyberfusion/QueueSupport/items/__init__.py +0 -0
  18. {python3_cyberfusion_queue_support-1.1.4 → python3_cyberfusion_queue_support-1.3}/src/cyberfusion/QueueSupport/items/chmod.py +0 -0
  19. {python3_cyberfusion_queue_support-1.1.4 → python3_cyberfusion_queue_support-1.3}/src/cyberfusion/QueueSupport/items/chown.py +0 -0
  20. {python3_cyberfusion_queue_support-1.1.4 → python3_cyberfusion_queue_support-1.3}/src/cyberfusion/QueueSupport/items/command.py +0 -0
  21. {python3_cyberfusion_queue_support-1.1.4 → python3_cyberfusion_queue_support-1.3}/src/cyberfusion/QueueSupport/items/copy.py +0 -0
  22. {python3_cyberfusion_queue_support-1.1.4 → python3_cyberfusion_queue_support-1.3}/src/cyberfusion/QueueSupport/items/mkdir.py +0 -0
  23. {python3_cyberfusion_queue_support-1.1.4 → python3_cyberfusion_queue_support-1.3}/src/cyberfusion/QueueSupport/items/move.py +0 -0
  24. {python3_cyberfusion_queue_support-1.1.4 → python3_cyberfusion_queue_support-1.3}/src/cyberfusion/QueueSupport/items/systemd_tmp_files_create.py +0 -0
  25. {python3_cyberfusion_queue_support-1.1.4 → python3_cyberfusion_queue_support-1.3}/src/cyberfusion/QueueSupport/items/systemd_unit_disable.py +0 -0
  26. {python3_cyberfusion_queue_support-1.1.4 → python3_cyberfusion_queue_support-1.3}/src/cyberfusion/QueueSupport/items/systemd_unit_enable.py +0 -0
  27. {python3_cyberfusion_queue_support-1.1.4 → python3_cyberfusion_queue_support-1.3}/src/cyberfusion/QueueSupport/items/systemd_unit_reload.py +0 -0
  28. {python3_cyberfusion_queue_support-1.1.4 → python3_cyberfusion_queue_support-1.3}/src/cyberfusion/QueueSupport/items/systemd_unit_restart.py +0 -0
  29. {python3_cyberfusion_queue_support-1.1.4 → python3_cyberfusion_queue_support-1.3}/src/cyberfusion/QueueSupport/items/systemd_unit_stop.py +0 -0
  30. {python3_cyberfusion_queue_support-1.1.4 → python3_cyberfusion_queue_support-1.3}/src/cyberfusion/QueueSupport/items/unlink.py +0 -0
  31. {python3_cyberfusion_queue_support-1.1.4 → python3_cyberfusion_queue_support-1.3}/src/cyberfusion/QueueSupport/utilities.py +0 -0
  32. {python3_cyberfusion_queue_support-1.1.4 → python3_cyberfusion_queue_support-1.3}/src/python3_cyberfusion_queue_support.egg-info/dependency_links.txt +0 -0
  33. {python3_cyberfusion_queue_support-1.1.4 → python3_cyberfusion_queue_support-1.3}/src/python3_cyberfusion_queue_support.egg-info/top_level.txt +0 -0
@@ -0,0 +1,171 @@
1
+ Metadata-Version: 2.1
2
+ Name: python3-cyberfusion-queue-support
3
+ Version: 1.3
4
+ Summary: Library to queue actions.
5
+ Author-email: Cyberfusion <support@cyberfusion.io>
6
+ Project-URL: Source, https://github.com/CyberfusionIO/python3-cyberfusion-queue-support
7
+ Description-Content-Type: text/markdown
8
+ Requires-Dist: python3-cyberfusion-systemd-support~=2.0
9
+
10
+ # python3-cyberfusion-queue-support
11
+
12
+ Library to queue actions.
13
+
14
+ `QueueSupport` allows you to _queue_ certain actions, such as restarting a service, unlinking a file, and much more.
15
+
16
+ For example, suppose the file `/tmp/example.txt` should be chmodded to 0600. You can queue the chmod:
17
+
18
+ ```
19
+ >>> from cyberfusion.QueueSupport import Queue
20
+ >>> from cyberfusion.QueueSupport.items.chmod import ChmodItem
21
+ >>> queue = Queue()
22
+ >>> queue.add(ChmodItem(path="/tmp/example.txt", mode=0o600))
23
+ ```
24
+
25
+ ... see what the chmod _would_ do with 'preview mode':
26
+
27
+ ```
28
+ >>> queue.process(preview=False)
29
+ [<cyberfusion.QueueSupport.outcomes.ChmodItemModeChangeOutcome object at 0x7f947e8ef510>]
30
+ >>> print(queue.process(preview=True)[0])
31
+ Change mode of /tmp/example.txt from 0o644 to 0o600
32
+ ```
33
+
34
+ ... then actually run the chmod:
35
+
36
+ ```
37
+ >>> print(queue.process(preview=False)[0])
38
+ Change mode of /tmp/example2.txt from 0o644 to 0o600
39
+ ```
40
+
41
+ # Install
42
+
43
+ ## PyPI
44
+
45
+ Run the following command to install the package from PyPI:
46
+
47
+ pip3 install python3-cyberfusion-queue-support
48
+
49
+ ## Debian
50
+
51
+ Run the following commands to build a Debian package:
52
+
53
+ mk-build-deps -i -t 'apt -o Debug::pkgProblemResolver=yes --no-install-recommends -y'
54
+ dpkg-buildpackage -us -uc
55
+
56
+ # Configure
57
+
58
+ No configuration is supported.
59
+
60
+ # Usage
61
+
62
+ ## Concepts
63
+
64
+ All project-specific terms are in _italic_.
65
+
66
+ After creating a _queue_, _items_ can be added to it.
67
+
68
+ ```python
69
+ from cyberfusion.QueueSupport import Queue
70
+
71
+ queue = Queue()
72
+
73
+ item = ...
74
+
75
+ queue.add(item)
76
+ ```
77
+
78
+ _Items_ are of a certain type. Such as `ChmodItem` or `SystemdUnitRestartItem`. Items can have attributes, such as a path for an `MkdirItem`, or a unit name for `SystemdUnitEnableItem`.
79
+
80
+ ```python
81
+ from cyberfusion.QueueSupport.items.chmod import ChmodItem
82
+ from cyberfusion.QueueSupport.items.systemd_unit_enable import SystemdUnitEnableItem
83
+
84
+ item1 = ChmodItem(path="/tmp/example.txt", mode=0o600)
85
+ item2 = SystemdUnitEnableItem(name="httpd.service")
86
+ ```
87
+
88
+ Each _item_ type has one or multiple _outcomes_. These should come true for an _item_ of that type to be completed. **For example: for an _item_ of type `UnlinkItem`, the _outcome_ is that the file at the path given with the _item_ is unlinked.**
89
+
90
+ When a _queue_ is _processed_, all the _items_ added to it are _fulfilled_, meaning all the _items'_ _outcomes_ come true.
91
+
92
+ ```python
93
+ from cyberfusion.QueueSupport import Queue
94
+
95
+ from cyberfusion.QueueSupport.items.rmtree import RmTreeItem
96
+
97
+ item = RmTreeItem(path="/tmp/dir")
98
+
99
+ queue = Queue()
100
+
101
+ queue.add(item)
102
+
103
+ # Fulfill every item in the queue
104
+
105
+ queue.process(preview=False)
106
+ queue.process(preview=True) # Only show what the outcomes would be
107
+
108
+ # Fulfill a single item
109
+
110
+ item.fulfill()
111
+ ```
112
+
113
+ ## Diagram
114
+
115
+ ```mermaid
116
+ graph TD;
117
+
118
+ subgraph QueueSupport
119
+ Queue["Queue"]
120
+ Item["Add item"]
121
+ Process["Process (fulfill all items)"]
122
+ end
123
+
124
+ Queue --> Item
125
+
126
+ subgraph ItemTypes["Item types"]
127
+ ChmodItem["ChmodItem"]
128
+ SystemdUnitEnableItem["SystemdUnitEnableItem"]
129
+ SystemdUnitRestartItem["SystemdUnitRestartItem"]
130
+ MkdirItem["MkdirItem"]
131
+ UnlinkItem["UnlinkItem"]
132
+ RmTreeItem["RmTreeItem"]
133
+ Other["Others..."]
134
+ end
135
+
136
+ Item --> ItemTypes
137
+ ItemTypes --> Outcome["Outcome (item's goal)"]
138
+
139
+ Process --> Fulfill["Fulfill outcomes for each item"]
140
+
141
+ %% Example flows for item attributes and outcomes
142
+ ChmodItem -.->|path, mode| Outcome
143
+ SystemdUnitEnableItem -.->|unit name| Outcome
144
+ MkdirItem -.->|path| Outcome
145
+ UnlinkItem -.->|unlink file| Outcome
146
+ RmTreeItem -.->|remove directory| Outcome
147
+
148
+ Queue --> Process
149
+ Process --> Fulfill
150
+ ```
151
+
152
+ ## Example
153
+
154
+ ```python
155
+ from cyberfusion.QueueSupport import Queue
156
+ from cyberfusion.QueueSupport.items.chmod import ChmodItem
157
+
158
+ queue = Queue()
159
+
160
+ item = ChmodItem(path="/tmp/example.txt", mode=0o600)
161
+ print(item.outcomes)
162
+
163
+ queue.add(item)
164
+
165
+ preview = True or False
166
+
167
+ outcomes = queue.process(preview=preview)
168
+
169
+ for outcome in outcomes:
170
+ print(str(outcome))
171
+ ```
@@ -0,0 +1,162 @@
1
+ # python3-cyberfusion-queue-support
2
+
3
+ Library to queue actions.
4
+
5
+ `QueueSupport` allows you to _queue_ certain actions, such as restarting a service, unlinking a file, and much more.
6
+
7
+ For example, suppose the file `/tmp/example.txt` should be chmodded to 0600. You can queue the chmod:
8
+
9
+ ```
10
+ >>> from cyberfusion.QueueSupport import Queue
11
+ >>> from cyberfusion.QueueSupport.items.chmod import ChmodItem
12
+ >>> queue = Queue()
13
+ >>> queue.add(ChmodItem(path="/tmp/example.txt", mode=0o600))
14
+ ```
15
+
16
+ ... see what the chmod _would_ do with 'preview mode':
17
+
18
+ ```
19
+ >>> queue.process(preview=False)
20
+ [<cyberfusion.QueueSupport.outcomes.ChmodItemModeChangeOutcome object at 0x7f947e8ef510>]
21
+ >>> print(queue.process(preview=True)[0])
22
+ Change mode of /tmp/example.txt from 0o644 to 0o600
23
+ ```
24
+
25
+ ... then actually run the chmod:
26
+
27
+ ```
28
+ >>> print(queue.process(preview=False)[0])
29
+ Change mode of /tmp/example2.txt from 0o644 to 0o600
30
+ ```
31
+
32
+ # Install
33
+
34
+ ## PyPI
35
+
36
+ Run the following command to install the package from PyPI:
37
+
38
+ pip3 install python3-cyberfusion-queue-support
39
+
40
+ ## Debian
41
+
42
+ Run the following commands to build a Debian package:
43
+
44
+ mk-build-deps -i -t 'apt -o Debug::pkgProblemResolver=yes --no-install-recommends -y'
45
+ dpkg-buildpackage -us -uc
46
+
47
+ # Configure
48
+
49
+ No configuration is supported.
50
+
51
+ # Usage
52
+
53
+ ## Concepts
54
+
55
+ All project-specific terms are in _italic_.
56
+
57
+ After creating a _queue_, _items_ can be added to it.
58
+
59
+ ```python
60
+ from cyberfusion.QueueSupport import Queue
61
+
62
+ queue = Queue()
63
+
64
+ item = ...
65
+
66
+ queue.add(item)
67
+ ```
68
+
69
+ _Items_ are of a certain type. Such as `ChmodItem` or `SystemdUnitRestartItem`. Items can have attributes, such as a path for an `MkdirItem`, or a unit name for `SystemdUnitEnableItem`.
70
+
71
+ ```python
72
+ from cyberfusion.QueueSupport.items.chmod import ChmodItem
73
+ from cyberfusion.QueueSupport.items.systemd_unit_enable import SystemdUnitEnableItem
74
+
75
+ item1 = ChmodItem(path="/tmp/example.txt", mode=0o600)
76
+ item2 = SystemdUnitEnableItem(name="httpd.service")
77
+ ```
78
+
79
+ Each _item_ type has one or multiple _outcomes_. These should come true for an _item_ of that type to be completed. **For example: for an _item_ of type `UnlinkItem`, the _outcome_ is that the file at the path given with the _item_ is unlinked.**
80
+
81
+ When a _queue_ is _processed_, all the _items_ added to it are _fulfilled_, meaning all the _items'_ _outcomes_ come true.
82
+
83
+ ```python
84
+ from cyberfusion.QueueSupport import Queue
85
+
86
+ from cyberfusion.QueueSupport.items.rmtree import RmTreeItem
87
+
88
+ item = RmTreeItem(path="/tmp/dir")
89
+
90
+ queue = Queue()
91
+
92
+ queue.add(item)
93
+
94
+ # Fulfill every item in the queue
95
+
96
+ queue.process(preview=False)
97
+ queue.process(preview=True) # Only show what the outcomes would be
98
+
99
+ # Fulfill a single item
100
+
101
+ item.fulfill()
102
+ ```
103
+
104
+ ## Diagram
105
+
106
+ ```mermaid
107
+ graph TD;
108
+
109
+ subgraph QueueSupport
110
+ Queue["Queue"]
111
+ Item["Add item"]
112
+ Process["Process (fulfill all items)"]
113
+ end
114
+
115
+ Queue --> Item
116
+
117
+ subgraph ItemTypes["Item types"]
118
+ ChmodItem["ChmodItem"]
119
+ SystemdUnitEnableItem["SystemdUnitEnableItem"]
120
+ SystemdUnitRestartItem["SystemdUnitRestartItem"]
121
+ MkdirItem["MkdirItem"]
122
+ UnlinkItem["UnlinkItem"]
123
+ RmTreeItem["RmTreeItem"]
124
+ Other["Others..."]
125
+ end
126
+
127
+ Item --> ItemTypes
128
+ ItemTypes --> Outcome["Outcome (item's goal)"]
129
+
130
+ Process --> Fulfill["Fulfill outcomes for each item"]
131
+
132
+ %% Example flows for item attributes and outcomes
133
+ ChmodItem -.->|path, mode| Outcome
134
+ SystemdUnitEnableItem -.->|unit name| Outcome
135
+ MkdirItem -.->|path| Outcome
136
+ UnlinkItem -.->|unlink file| Outcome
137
+ RmTreeItem -.->|remove directory| Outcome
138
+
139
+ Queue --> Process
140
+ Process --> Fulfill
141
+ ```
142
+
143
+ ## Example
144
+
145
+ ```python
146
+ from cyberfusion.QueueSupport import Queue
147
+ from cyberfusion.QueueSupport.items.chmod import ChmodItem
148
+
149
+ queue = Queue()
150
+
151
+ item = ChmodItem(path="/tmp/example.txt", mode=0o600)
152
+ print(item.outcomes)
153
+
154
+ queue.add(item)
155
+
156
+ preview = True or False
157
+
158
+ outcomes = queue.process(preview=preview)
159
+
160
+ for outcome in outcomes:
161
+ print(str(outcome))
162
+ ```
@@ -4,14 +4,14 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "python3-cyberfusion-queue-support"
7
- version = "1.1.4"
7
+ version = "1.3"
8
8
  description = "Library to queue actions."
9
9
  readme = "README.md"
10
10
  authors = [
11
11
  { name = "Cyberfusion", email = "support@cyberfusion.io" },
12
12
  ]
13
13
  dependencies = [
14
- "python3-cyberfusion-systemd-support~=1.0",
14
+ "python3-cyberfusion-systemd-support~=2.0",
15
15
  ]
16
16
 
17
17
  [project.urls]
@@ -0,0 +1,57 @@
1
+ """Item."""
2
+
3
+ import logging
4
+ import os
5
+ import shutil
6
+ from typing import List, Optional
7
+
8
+ from cyberfusion.QueueSupport.exceptions import PathIsSymlinkError
9
+ from cyberfusion.QueueSupport.items import _Item
10
+ from cyberfusion.QueueSupport.outcomes import RmTreeItemRemoveOutcome
11
+
12
+ logger = logging.getLogger(__name__)
13
+
14
+
15
+ class RmTreeItem(_Item):
16
+ """Represents item."""
17
+
18
+ def __init__(
19
+ self,
20
+ *,
21
+ path: str,
22
+ reference: Optional[str] = None,
23
+ hide_outcomes: bool = False,
24
+ ) -> None:
25
+ """Set attributes."""
26
+ self.path = path
27
+ self._reference = reference
28
+ self._hide_outcomes = hide_outcomes
29
+
30
+ if os.path.islink(self.path):
31
+ raise PathIsSymlinkError(self.path)
32
+
33
+ @property
34
+ def outcomes(self) -> List[RmTreeItemRemoveOutcome]:
35
+ """Get outcomes of calling self.fulfill."""
36
+ outcomes = []
37
+
38
+ if os.path.exists(self.path):
39
+ outcomes.append(
40
+ RmTreeItemRemoveOutcome(
41
+ path=self.path,
42
+ )
43
+ )
44
+
45
+ return outcomes
46
+
47
+ def fulfill(self) -> None:
48
+ """Fulfill outcomes."""
49
+ for outcome in self.outcomes:
50
+ shutil.rmtree(outcome.path)
51
+
52
+ def __eq__(self, other: object) -> bool:
53
+ """Get equality based on attributes."""
54
+ if not isinstance(other, RmTreeItem):
55
+ return False
56
+
57
+ return other.path == self.path
@@ -105,6 +105,25 @@ class UnlinkItemUnlinkOutcome(OutcomeInterface):
105
105
  return other.path == self.path
106
106
 
107
107
 
108
+ class RmTreeItemRemoveOutcome(OutcomeInterface):
109
+ """Represents outcome."""
110
+
111
+ def __init__(self, *, path: str) -> None:
112
+ """Set attributes."""
113
+ self.path = path
114
+
115
+ def __str__(self) -> str:
116
+ """Get human-readable string."""
117
+ return f"Remove directory tree {self.path}"
118
+
119
+ def __eq__(self, other: object) -> bool:
120
+ """Get equality based on attributes."""
121
+ if not isinstance(other, RmTreeItemRemoveOutcome):
122
+ return False
123
+
124
+ return other.path == self.path
125
+
126
+
108
127
  class CommandItemRunOutcome(OutcomeInterface):
109
128
  """Represents outcome."""
110
129
 
@@ -0,0 +1,171 @@
1
+ Metadata-Version: 2.1
2
+ Name: python3-cyberfusion-queue-support
3
+ Version: 1.3
4
+ Summary: Library to queue actions.
5
+ Author-email: Cyberfusion <support@cyberfusion.io>
6
+ Project-URL: Source, https://github.com/CyberfusionIO/python3-cyberfusion-queue-support
7
+ Description-Content-Type: text/markdown
8
+ Requires-Dist: python3-cyberfusion-systemd-support~=2.0
9
+
10
+ # python3-cyberfusion-queue-support
11
+
12
+ Library to queue actions.
13
+
14
+ `QueueSupport` allows you to _queue_ certain actions, such as restarting a service, unlinking a file, and much more.
15
+
16
+ For example, suppose the file `/tmp/example.txt` should be chmodded to 0600. You can queue the chmod:
17
+
18
+ ```
19
+ >>> from cyberfusion.QueueSupport import Queue
20
+ >>> from cyberfusion.QueueSupport.items.chmod import ChmodItem
21
+ >>> queue = Queue()
22
+ >>> queue.add(ChmodItem(path="/tmp/example.txt", mode=0o600))
23
+ ```
24
+
25
+ ... see what the chmod _would_ do with 'preview mode':
26
+
27
+ ```
28
+ >>> queue.process(preview=False)
29
+ [<cyberfusion.QueueSupport.outcomes.ChmodItemModeChangeOutcome object at 0x7f947e8ef510>]
30
+ >>> print(queue.process(preview=True)[0])
31
+ Change mode of /tmp/example.txt from 0o644 to 0o600
32
+ ```
33
+
34
+ ... then actually run the chmod:
35
+
36
+ ```
37
+ >>> print(queue.process(preview=False)[0])
38
+ Change mode of /tmp/example2.txt from 0o644 to 0o600
39
+ ```
40
+
41
+ # Install
42
+
43
+ ## PyPI
44
+
45
+ Run the following command to install the package from PyPI:
46
+
47
+ pip3 install python3-cyberfusion-queue-support
48
+
49
+ ## Debian
50
+
51
+ Run the following commands to build a Debian package:
52
+
53
+ mk-build-deps -i -t 'apt -o Debug::pkgProblemResolver=yes --no-install-recommends -y'
54
+ dpkg-buildpackage -us -uc
55
+
56
+ # Configure
57
+
58
+ No configuration is supported.
59
+
60
+ # Usage
61
+
62
+ ## Concepts
63
+
64
+ All project-specific terms are in _italic_.
65
+
66
+ After creating a _queue_, _items_ can be added to it.
67
+
68
+ ```python
69
+ from cyberfusion.QueueSupport import Queue
70
+
71
+ queue = Queue()
72
+
73
+ item = ...
74
+
75
+ queue.add(item)
76
+ ```
77
+
78
+ _Items_ are of a certain type. Such as `ChmodItem` or `SystemdUnitRestartItem`. Items can have attributes, such as a path for an `MkdirItem`, or a unit name for `SystemdUnitEnableItem`.
79
+
80
+ ```python
81
+ from cyberfusion.QueueSupport.items.chmod import ChmodItem
82
+ from cyberfusion.QueueSupport.items.systemd_unit_enable import SystemdUnitEnableItem
83
+
84
+ item1 = ChmodItem(path="/tmp/example.txt", mode=0o600)
85
+ item2 = SystemdUnitEnableItem(name="httpd.service")
86
+ ```
87
+
88
+ Each _item_ type has one or multiple _outcomes_. These should come true for an _item_ of that type to be completed. **For example: for an _item_ of type `UnlinkItem`, the _outcome_ is that the file at the path given with the _item_ is unlinked.**
89
+
90
+ When a _queue_ is _processed_, all the _items_ added to it are _fulfilled_, meaning all the _items'_ _outcomes_ come true.
91
+
92
+ ```python
93
+ from cyberfusion.QueueSupport import Queue
94
+
95
+ from cyberfusion.QueueSupport.items.rmtree import RmTreeItem
96
+
97
+ item = RmTreeItem(path="/tmp/dir")
98
+
99
+ queue = Queue()
100
+
101
+ queue.add(item)
102
+
103
+ # Fulfill every item in the queue
104
+
105
+ queue.process(preview=False)
106
+ queue.process(preview=True) # Only show what the outcomes would be
107
+
108
+ # Fulfill a single item
109
+
110
+ item.fulfill()
111
+ ```
112
+
113
+ ## Diagram
114
+
115
+ ```mermaid
116
+ graph TD;
117
+
118
+ subgraph QueueSupport
119
+ Queue["Queue"]
120
+ Item["Add item"]
121
+ Process["Process (fulfill all items)"]
122
+ end
123
+
124
+ Queue --> Item
125
+
126
+ subgraph ItemTypes["Item types"]
127
+ ChmodItem["ChmodItem"]
128
+ SystemdUnitEnableItem["SystemdUnitEnableItem"]
129
+ SystemdUnitRestartItem["SystemdUnitRestartItem"]
130
+ MkdirItem["MkdirItem"]
131
+ UnlinkItem["UnlinkItem"]
132
+ RmTreeItem["RmTreeItem"]
133
+ Other["Others..."]
134
+ end
135
+
136
+ Item --> ItemTypes
137
+ ItemTypes --> Outcome["Outcome (item's goal)"]
138
+
139
+ Process --> Fulfill["Fulfill outcomes for each item"]
140
+
141
+ %% Example flows for item attributes and outcomes
142
+ ChmodItem -.->|path, mode| Outcome
143
+ SystemdUnitEnableItem -.->|unit name| Outcome
144
+ MkdirItem -.->|path| Outcome
145
+ UnlinkItem -.->|unlink file| Outcome
146
+ RmTreeItem -.->|remove directory| Outcome
147
+
148
+ Queue --> Process
149
+ Process --> Fulfill
150
+ ```
151
+
152
+ ## Example
153
+
154
+ ```python
155
+ from cyberfusion.QueueSupport import Queue
156
+ from cyberfusion.QueueSupport.items.chmod import ChmodItem
157
+
158
+ queue = Queue()
159
+
160
+ item = ChmodItem(path="/tmp/example.txt", mode=0o600)
161
+ print(item.outcomes)
162
+
163
+ queue.add(item)
164
+
165
+ preview = True or False
166
+
167
+ outcomes = queue.process(preview=preview)
168
+
169
+ for outcome in outcomes:
170
+ print(str(outcome))
171
+ ```
@@ -13,6 +13,7 @@ src/cyberfusion/QueueSupport/items/command.py
13
13
  src/cyberfusion/QueueSupport/items/copy.py
14
14
  src/cyberfusion/QueueSupport/items/mkdir.py
15
15
  src/cyberfusion/QueueSupport/items/move.py
16
+ src/cyberfusion/QueueSupport/items/rmtree.py
16
17
  src/cyberfusion/QueueSupport/items/systemd_tmp_files_create.py
17
18
  src/cyberfusion/QueueSupport/items/systemd_unit_disable.py
18
19
  src/cyberfusion/QueueSupport/items/systemd_unit_enable.py
@@ -0,0 +1 @@
1
+ python3-cyberfusion-systemd-support~=2.0
@@ -1,54 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: python3-cyberfusion-queue-support
3
- Version: 1.1.4
4
- Summary: Library to queue actions.
5
- Author-email: Cyberfusion <support@cyberfusion.io>
6
- Project-URL: Source, https://github.com/CyberfusionIO/python3-cyberfusion-queue-support
7
- Description-Content-Type: text/markdown
8
- Requires-Dist: python3-cyberfusion-systemd-support~=1.0
9
-
10
- # python3-cyberfusion-queue-support
11
-
12
- Library to queue actions.
13
-
14
- # Install
15
-
16
- ## PyPI
17
-
18
- Run the following command to install the package from PyPI:
19
-
20
- pip3 install python3-cyberfusion-queue-support
21
-
22
- ## Debian
23
-
24
- Run the following commands to build a Debian package:
25
-
26
- mk-build-deps -i -t 'apt -o Debug::pkgProblemResolver=yes --no-install-recommends -y'
27
- dpkg-buildpackage -us -uc
28
-
29
- # Configure
30
-
31
- No configuration is supported.
32
-
33
- # Usage
34
-
35
- ## Example
36
-
37
- ```python
38
- from cyberfusion.QueueSupport import Queue
39
- from cyberfusion.QueueSupport.items.chmod import ChmodItem
40
-
41
- queue = Queue()
42
-
43
- item = ChmodItem(path="/tmp/example.txt", mode=0o600)
44
- print(item.outcomes)
45
-
46
- queue.add(item)
47
-
48
- preview = True or False
49
-
50
- outcomes = queue.process(preview=preview)
51
-
52
- for outcome in outcomes:
53
- print(str(outcome))
54
- ```
@@ -1,45 +0,0 @@
1
- # python3-cyberfusion-queue-support
2
-
3
- Library to queue actions.
4
-
5
- # Install
6
-
7
- ## PyPI
8
-
9
- Run the following command to install the package from PyPI:
10
-
11
- pip3 install python3-cyberfusion-queue-support
12
-
13
- ## Debian
14
-
15
- Run the following commands to build a Debian package:
16
-
17
- mk-build-deps -i -t 'apt -o Debug::pkgProblemResolver=yes --no-install-recommends -y'
18
- dpkg-buildpackage -us -uc
19
-
20
- # Configure
21
-
22
- No configuration is supported.
23
-
24
- # Usage
25
-
26
- ## Example
27
-
28
- ```python
29
- from cyberfusion.QueueSupport import Queue
30
- from cyberfusion.QueueSupport.items.chmod import ChmodItem
31
-
32
- queue = Queue()
33
-
34
- item = ChmodItem(path="/tmp/example.txt", mode=0o600)
35
- print(item.outcomes)
36
-
37
- queue.add(item)
38
-
39
- preview = True or False
40
-
41
- outcomes = queue.process(preview=preview)
42
-
43
- for outcome in outcomes:
44
- print(str(outcome))
45
- ```
@@ -1,54 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: python3-cyberfusion-queue-support
3
- Version: 1.1.4
4
- Summary: Library to queue actions.
5
- Author-email: Cyberfusion <support@cyberfusion.io>
6
- Project-URL: Source, https://github.com/CyberfusionIO/python3-cyberfusion-queue-support
7
- Description-Content-Type: text/markdown
8
- Requires-Dist: python3-cyberfusion-systemd-support~=1.0
9
-
10
- # python3-cyberfusion-queue-support
11
-
12
- Library to queue actions.
13
-
14
- # Install
15
-
16
- ## PyPI
17
-
18
- Run the following command to install the package from PyPI:
19
-
20
- pip3 install python3-cyberfusion-queue-support
21
-
22
- ## Debian
23
-
24
- Run the following commands to build a Debian package:
25
-
26
- mk-build-deps -i -t 'apt -o Debug::pkgProblemResolver=yes --no-install-recommends -y'
27
- dpkg-buildpackage -us -uc
28
-
29
- # Configure
30
-
31
- No configuration is supported.
32
-
33
- # Usage
34
-
35
- ## Example
36
-
37
- ```python
38
- from cyberfusion.QueueSupport import Queue
39
- from cyberfusion.QueueSupport.items.chmod import ChmodItem
40
-
41
- queue = Queue()
42
-
43
- item = ChmodItem(path="/tmp/example.txt", mode=0o600)
44
- print(item.outcomes)
45
-
46
- queue.add(item)
47
-
48
- preview = True or False
49
-
50
- outcomes = queue.process(preview=preview)
51
-
52
- for outcome in outcomes:
53
- print(str(outcome))
54
- ```
@@ -1 +0,0 @@
1
- python3-cyberfusion-systemd-support~=1.0