python3-cyberfusion-queue-support 1.2__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.
- python3_cyberfusion_queue_support-1.3/PKG-INFO +171 -0
- python3_cyberfusion_queue_support-1.3/README.md +162 -0
- {python3_cyberfusion_queue_support-1.2 → python3_cyberfusion_queue_support-1.3}/pyproject.toml +2 -2
- python3_cyberfusion_queue_support-1.3/src/python3_cyberfusion_queue_support.egg-info/PKG-INFO +171 -0
- python3_cyberfusion_queue_support-1.3/src/python3_cyberfusion_queue_support.egg-info/requires.txt +1 -0
- python3_cyberfusion_queue_support-1.2/PKG-INFO +0 -91
- python3_cyberfusion_queue_support-1.2/README.md +0 -82
- python3_cyberfusion_queue_support-1.2/src/python3_cyberfusion_queue_support.egg-info/PKG-INFO +0 -91
- python3_cyberfusion_queue_support-1.2/src/python3_cyberfusion_queue_support.egg-info/requires.txt +0 -1
- {python3_cyberfusion_queue_support-1.2 → python3_cyberfusion_queue_support-1.3}/setup.cfg +0 -0
- {python3_cyberfusion_queue_support-1.2 → python3_cyberfusion_queue_support-1.3}/src/cyberfusion/QueueSupport/__init__.py +0 -0
- {python3_cyberfusion_queue_support-1.2 → python3_cyberfusion_queue_support-1.3}/src/cyberfusion/QueueSupport/exceptions/__init__.py +0 -0
- {python3_cyberfusion_queue_support-1.2 → python3_cyberfusion_queue_support-1.3}/src/cyberfusion/QueueSupport/interfaces.py +0 -0
- {python3_cyberfusion_queue_support-1.2 → python3_cyberfusion_queue_support-1.3}/src/cyberfusion/QueueSupport/items/__init__.py +0 -0
- {python3_cyberfusion_queue_support-1.2 → python3_cyberfusion_queue_support-1.3}/src/cyberfusion/QueueSupport/items/chmod.py +0 -0
- {python3_cyberfusion_queue_support-1.2 → python3_cyberfusion_queue_support-1.3}/src/cyberfusion/QueueSupport/items/chown.py +0 -0
- {python3_cyberfusion_queue_support-1.2 → python3_cyberfusion_queue_support-1.3}/src/cyberfusion/QueueSupport/items/command.py +0 -0
- {python3_cyberfusion_queue_support-1.2 → python3_cyberfusion_queue_support-1.3}/src/cyberfusion/QueueSupport/items/copy.py +0 -0
- {python3_cyberfusion_queue_support-1.2 → python3_cyberfusion_queue_support-1.3}/src/cyberfusion/QueueSupport/items/mkdir.py +0 -0
- {python3_cyberfusion_queue_support-1.2 → python3_cyberfusion_queue_support-1.3}/src/cyberfusion/QueueSupport/items/move.py +0 -0
- {python3_cyberfusion_queue_support-1.2 → python3_cyberfusion_queue_support-1.3}/src/cyberfusion/QueueSupport/items/rmtree.py +0 -0
- {python3_cyberfusion_queue_support-1.2 → python3_cyberfusion_queue_support-1.3}/src/cyberfusion/QueueSupport/items/systemd_tmp_files_create.py +0 -0
- {python3_cyberfusion_queue_support-1.2 → python3_cyberfusion_queue_support-1.3}/src/cyberfusion/QueueSupport/items/systemd_unit_disable.py +0 -0
- {python3_cyberfusion_queue_support-1.2 → python3_cyberfusion_queue_support-1.3}/src/cyberfusion/QueueSupport/items/systemd_unit_enable.py +0 -0
- {python3_cyberfusion_queue_support-1.2 → python3_cyberfusion_queue_support-1.3}/src/cyberfusion/QueueSupport/items/systemd_unit_reload.py +0 -0
- {python3_cyberfusion_queue_support-1.2 → python3_cyberfusion_queue_support-1.3}/src/cyberfusion/QueueSupport/items/systemd_unit_restart.py +0 -0
- {python3_cyberfusion_queue_support-1.2 → python3_cyberfusion_queue_support-1.3}/src/cyberfusion/QueueSupport/items/systemd_unit_stop.py +0 -0
- {python3_cyberfusion_queue_support-1.2 → python3_cyberfusion_queue_support-1.3}/src/cyberfusion/QueueSupport/items/unlink.py +0 -0
- {python3_cyberfusion_queue_support-1.2 → python3_cyberfusion_queue_support-1.3}/src/cyberfusion/QueueSupport/outcomes.py +0 -0
- {python3_cyberfusion_queue_support-1.2 → python3_cyberfusion_queue_support-1.3}/src/cyberfusion/QueueSupport/utilities.py +0 -0
- {python3_cyberfusion_queue_support-1.2 → python3_cyberfusion_queue_support-1.3}/src/python3_cyberfusion_queue_support.egg-info/SOURCES.txt +0 -0
- {python3_cyberfusion_queue_support-1.2 → python3_cyberfusion_queue_support-1.3}/src/python3_cyberfusion_queue_support.egg-info/dependency_links.txt +0 -0
- {python3_cyberfusion_queue_support-1.2 → 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
|
+
```
|
{python3_cyberfusion_queue_support-1.2 → python3_cyberfusion_queue_support-1.3}/pyproject.toml
RENAMED
|
@@ -4,14 +4,14 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "python3-cyberfusion-queue-support"
|
|
7
|
-
version = "1.
|
|
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~=
|
|
14
|
+
"python3-cyberfusion-systemd-support~=2.0",
|
|
15
15
|
]
|
|
16
16
|
|
|
17
17
|
[project.urls]
|
|
@@ -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
|
+
```
|
python3_cyberfusion_queue_support-1.3/src/python3_cyberfusion_queue_support.egg-info/requires.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
python3-cyberfusion-systemd-support~=2.0
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: python3-cyberfusion-queue-support
|
|
3
|
-
Version: 1.2
|
|
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
|
-
# Concepts
|
|
15
|
-
|
|
16
|
-
All project-specific terms are in _italic_.
|
|
17
|
-
|
|
18
|
-
After creating a _queue_, _items_ can be added to it.
|
|
19
|
-
|
|
20
|
-
```python
|
|
21
|
-
queue = Queue()
|
|
22
|
-
|
|
23
|
-
queue.add(item)
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
These _items_ can be of multiple types such as `ChmodItem` or `SystemdUnitRestartItem`, and they can have attributes such as a path for an `MkdirItem` or a unit name for a `SystemdUnitEnableItem`.
|
|
27
|
-
|
|
28
|
-
```python
|
|
29
|
-
item1 = ChmodItem(path="/tmp/example.txt", mode=0o600)
|
|
30
|
-
item2 = SystemdUnitEnableItem(name="httpd.service")
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
Each _item_ type has one or multiple _outcomes_ that 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.
|
|
34
|
-
|
|
35
|
-
When a _queue_ is _processed_, all the _items_ added to it are _fulfilled_, meaning all the _items'_ _outcomes_ are completed.
|
|
36
|
-
|
|
37
|
-
```python
|
|
38
|
-
item = RmTreeItem(path="/tmp/dir")
|
|
39
|
-
|
|
40
|
-
queue = Queue()
|
|
41
|
-
|
|
42
|
-
queue.add(item)
|
|
43
|
-
|
|
44
|
-
# for each item added to the queue, its fulfill() function is run
|
|
45
|
-
queue.process()
|
|
46
|
-
|
|
47
|
-
# this would do the same
|
|
48
|
-
item.fulfill()
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
# Install
|
|
52
|
-
|
|
53
|
-
## PyPI
|
|
54
|
-
|
|
55
|
-
Run the following command to install the package from PyPI:
|
|
56
|
-
|
|
57
|
-
pip3 install python3-cyberfusion-queue-support
|
|
58
|
-
|
|
59
|
-
## Debian
|
|
60
|
-
|
|
61
|
-
Run the following commands to build a Debian package:
|
|
62
|
-
|
|
63
|
-
mk-build-deps -i -t 'apt -o Debug::pkgProblemResolver=yes --no-install-recommends -y'
|
|
64
|
-
dpkg-buildpackage -us -uc
|
|
65
|
-
|
|
66
|
-
# Configure
|
|
67
|
-
|
|
68
|
-
No configuration is supported.
|
|
69
|
-
|
|
70
|
-
# Usage
|
|
71
|
-
|
|
72
|
-
## Example
|
|
73
|
-
|
|
74
|
-
```python
|
|
75
|
-
from cyberfusion.QueueSupport import Queue
|
|
76
|
-
from cyberfusion.QueueSupport.items.chmod import ChmodItem
|
|
77
|
-
|
|
78
|
-
queue = Queue()
|
|
79
|
-
|
|
80
|
-
item = ChmodItem(path="/tmp/example.txt", mode=0o600)
|
|
81
|
-
print(item.outcomes)
|
|
82
|
-
|
|
83
|
-
queue.add(item)
|
|
84
|
-
|
|
85
|
-
preview = True or False
|
|
86
|
-
|
|
87
|
-
outcomes = queue.process(preview=preview)
|
|
88
|
-
|
|
89
|
-
for outcome in outcomes:
|
|
90
|
-
print(str(outcome))
|
|
91
|
-
```
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
# python3-cyberfusion-queue-support
|
|
2
|
-
|
|
3
|
-
Library to queue actions.
|
|
4
|
-
|
|
5
|
-
# Concepts
|
|
6
|
-
|
|
7
|
-
All project-specific terms are in _italic_.
|
|
8
|
-
|
|
9
|
-
After creating a _queue_, _items_ can be added to it.
|
|
10
|
-
|
|
11
|
-
```python
|
|
12
|
-
queue = Queue()
|
|
13
|
-
|
|
14
|
-
queue.add(item)
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
These _items_ can be of multiple types such as `ChmodItem` or `SystemdUnitRestartItem`, and they can have attributes such as a path for an `MkdirItem` or a unit name for a `SystemdUnitEnableItem`.
|
|
18
|
-
|
|
19
|
-
```python
|
|
20
|
-
item1 = ChmodItem(path="/tmp/example.txt", mode=0o600)
|
|
21
|
-
item2 = SystemdUnitEnableItem(name="httpd.service")
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
Each _item_ type has one or multiple _outcomes_ that 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.
|
|
25
|
-
|
|
26
|
-
When a _queue_ is _processed_, all the _items_ added to it are _fulfilled_, meaning all the _items'_ _outcomes_ are completed.
|
|
27
|
-
|
|
28
|
-
```python
|
|
29
|
-
item = RmTreeItem(path="/tmp/dir")
|
|
30
|
-
|
|
31
|
-
queue = Queue()
|
|
32
|
-
|
|
33
|
-
queue.add(item)
|
|
34
|
-
|
|
35
|
-
# for each item added to the queue, its fulfill() function is run
|
|
36
|
-
queue.process()
|
|
37
|
-
|
|
38
|
-
# this would do the same
|
|
39
|
-
item.fulfill()
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
# Install
|
|
43
|
-
|
|
44
|
-
## PyPI
|
|
45
|
-
|
|
46
|
-
Run the following command to install the package from PyPI:
|
|
47
|
-
|
|
48
|
-
pip3 install python3-cyberfusion-queue-support
|
|
49
|
-
|
|
50
|
-
## Debian
|
|
51
|
-
|
|
52
|
-
Run the following commands to build a Debian package:
|
|
53
|
-
|
|
54
|
-
mk-build-deps -i -t 'apt -o Debug::pkgProblemResolver=yes --no-install-recommends -y'
|
|
55
|
-
dpkg-buildpackage -us -uc
|
|
56
|
-
|
|
57
|
-
# Configure
|
|
58
|
-
|
|
59
|
-
No configuration is supported.
|
|
60
|
-
|
|
61
|
-
# Usage
|
|
62
|
-
|
|
63
|
-
## Example
|
|
64
|
-
|
|
65
|
-
```python
|
|
66
|
-
from cyberfusion.QueueSupport import Queue
|
|
67
|
-
from cyberfusion.QueueSupport.items.chmod import ChmodItem
|
|
68
|
-
|
|
69
|
-
queue = Queue()
|
|
70
|
-
|
|
71
|
-
item = ChmodItem(path="/tmp/example.txt", mode=0o600)
|
|
72
|
-
print(item.outcomes)
|
|
73
|
-
|
|
74
|
-
queue.add(item)
|
|
75
|
-
|
|
76
|
-
preview = True or False
|
|
77
|
-
|
|
78
|
-
outcomes = queue.process(preview=preview)
|
|
79
|
-
|
|
80
|
-
for outcome in outcomes:
|
|
81
|
-
print(str(outcome))
|
|
82
|
-
```
|
python3_cyberfusion_queue_support-1.2/src/python3_cyberfusion_queue_support.egg-info/PKG-INFO
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: python3-cyberfusion-queue-support
|
|
3
|
-
Version: 1.2
|
|
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
|
-
# Concepts
|
|
15
|
-
|
|
16
|
-
All project-specific terms are in _italic_.
|
|
17
|
-
|
|
18
|
-
After creating a _queue_, _items_ can be added to it.
|
|
19
|
-
|
|
20
|
-
```python
|
|
21
|
-
queue = Queue()
|
|
22
|
-
|
|
23
|
-
queue.add(item)
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
These _items_ can be of multiple types such as `ChmodItem` or `SystemdUnitRestartItem`, and they can have attributes such as a path for an `MkdirItem` or a unit name for a `SystemdUnitEnableItem`.
|
|
27
|
-
|
|
28
|
-
```python
|
|
29
|
-
item1 = ChmodItem(path="/tmp/example.txt", mode=0o600)
|
|
30
|
-
item2 = SystemdUnitEnableItem(name="httpd.service")
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
Each _item_ type has one or multiple _outcomes_ that 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.
|
|
34
|
-
|
|
35
|
-
When a _queue_ is _processed_, all the _items_ added to it are _fulfilled_, meaning all the _items'_ _outcomes_ are completed.
|
|
36
|
-
|
|
37
|
-
```python
|
|
38
|
-
item = RmTreeItem(path="/tmp/dir")
|
|
39
|
-
|
|
40
|
-
queue = Queue()
|
|
41
|
-
|
|
42
|
-
queue.add(item)
|
|
43
|
-
|
|
44
|
-
# for each item added to the queue, its fulfill() function is run
|
|
45
|
-
queue.process()
|
|
46
|
-
|
|
47
|
-
# this would do the same
|
|
48
|
-
item.fulfill()
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
# Install
|
|
52
|
-
|
|
53
|
-
## PyPI
|
|
54
|
-
|
|
55
|
-
Run the following command to install the package from PyPI:
|
|
56
|
-
|
|
57
|
-
pip3 install python3-cyberfusion-queue-support
|
|
58
|
-
|
|
59
|
-
## Debian
|
|
60
|
-
|
|
61
|
-
Run the following commands to build a Debian package:
|
|
62
|
-
|
|
63
|
-
mk-build-deps -i -t 'apt -o Debug::pkgProblemResolver=yes --no-install-recommends -y'
|
|
64
|
-
dpkg-buildpackage -us -uc
|
|
65
|
-
|
|
66
|
-
# Configure
|
|
67
|
-
|
|
68
|
-
No configuration is supported.
|
|
69
|
-
|
|
70
|
-
# Usage
|
|
71
|
-
|
|
72
|
-
## Example
|
|
73
|
-
|
|
74
|
-
```python
|
|
75
|
-
from cyberfusion.QueueSupport import Queue
|
|
76
|
-
from cyberfusion.QueueSupport.items.chmod import ChmodItem
|
|
77
|
-
|
|
78
|
-
queue = Queue()
|
|
79
|
-
|
|
80
|
-
item = ChmodItem(path="/tmp/example.txt", mode=0o600)
|
|
81
|
-
print(item.outcomes)
|
|
82
|
-
|
|
83
|
-
queue.add(item)
|
|
84
|
-
|
|
85
|
-
preview = True or False
|
|
86
|
-
|
|
87
|
-
outcomes = queue.process(preview=preview)
|
|
88
|
-
|
|
89
|
-
for outcome in outcomes:
|
|
90
|
-
print(str(outcome))
|
|
91
|
-
```
|
python3_cyberfusion_queue_support-1.2/src/python3_cyberfusion_queue_support.egg-info/requires.txt
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
python3-cyberfusion-systemd-support~=1.0
|
|
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
|