python3-cyberfusion-systemd-support 2.5.1__py3-none-any.whl → 2.6__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cyberfusion/SystemdSupport/units.py +34 -0
- {python3_cyberfusion_systemd_support-2.5.1.dist-info → python3_cyberfusion_systemd_support-2.6.dist-info}/METADATA +1 -1
- {python3_cyberfusion_systemd_support-2.5.1.dist-info → python3_cyberfusion_systemd_support-2.6.dist-info}/RECORD +5 -5
- {python3_cyberfusion_systemd_support-2.5.1.dist-info → python3_cyberfusion_systemd_support-2.6.dist-info}/WHEEL +0 -0
- {python3_cyberfusion_systemd_support-2.5.1.dist-info → python3_cyberfusion_systemd_support-2.6.dist-info}/top_level.txt +0 -0
|
@@ -217,6 +217,40 @@ class TransientUnit:
|
|
|
217
217
|
|
|
218
218
|
return cls(Unit(json.loads(output)["unit"]))
|
|
219
219
|
|
|
220
|
+
@classmethod
|
|
221
|
+
def run_sync(
|
|
222
|
+
cls,
|
|
223
|
+
name: str,
|
|
224
|
+
command: List[str],
|
|
225
|
+
*,
|
|
226
|
+
properties: dict[str, str] | None = None,
|
|
227
|
+
input_: str | None = None,
|
|
228
|
+
) -> str:
|
|
229
|
+
"""Start transient unit, wait for it to finish, and return stdout."""
|
|
230
|
+
arguments = [
|
|
231
|
+
SYSTEMD_RUN_BIN,
|
|
232
|
+
f"--unit={name}",
|
|
233
|
+
# "Wait for the transient service to terminate"
|
|
234
|
+
"--wait",
|
|
235
|
+
# "Unload the transient unit after it completed, even if it failed"
|
|
236
|
+
"--collect",
|
|
237
|
+
# "standard input, output, and error of the transient service are inherited from the systemd-run command itself"
|
|
238
|
+
# Needed to pass stdin
|
|
239
|
+
"--pipe",
|
|
240
|
+
]
|
|
241
|
+
|
|
242
|
+
if properties:
|
|
243
|
+
for property_name, property_value in properties.items():
|
|
244
|
+
arguments.append(f"--property={property_name}={property_value}")
|
|
245
|
+
|
|
246
|
+
arguments.extend(command)
|
|
247
|
+
|
|
248
|
+
output = subprocess.run(
|
|
249
|
+
arguments, check=True, stdout=subprocess.PIPE, text=True, input=input_
|
|
250
|
+
).stdout
|
|
251
|
+
|
|
252
|
+
return output
|
|
253
|
+
|
|
220
254
|
def clean_up(self) -> None:
|
|
221
255
|
"""Stop unit if active, or reset it if failed."""
|
|
222
256
|
sub_state = self.unit.get_property("SubState")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python3-cyberfusion-systemd-support
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.6
|
|
4
4
|
Summary: Library for systemd.
|
|
5
5
|
Author-email: Cyberfusion <support@cyberfusion.io>
|
|
6
6
|
Project-URL: Source, https://github.com/CyberfusionIO/python3-cyberfusion-systemd-support
|
|
@@ -4,8 +4,8 @@ cyberfusion/SystemdSupport/enums.py,sha256=IipTcC2XnG2Lv-7g0YB-p-g8uETMyrrPbbrG1
|
|
|
4
4
|
cyberfusion/SystemdSupport/exceptions.py,sha256=w-PqHe2bJwIlvq56T40-u3Ji7-5c5RHAFED05D_BA2s,797
|
|
5
5
|
cyberfusion/SystemdSupport/manager.py,sha256=cWM2kqjEpmO88CCgalQsUlhbzqH0RFbmLbuVBvFGW_8,346
|
|
6
6
|
cyberfusion/SystemdSupport/tmp_files.py,sha256=0EHIN6wZnPthytOCPxozwC2t0dgQfI08OuEvlERVk-A,1350
|
|
7
|
-
cyberfusion/SystemdSupport/units.py,sha256=
|
|
8
|
-
python3_cyberfusion_systemd_support-2.
|
|
9
|
-
python3_cyberfusion_systemd_support-2.
|
|
10
|
-
python3_cyberfusion_systemd_support-2.
|
|
11
|
-
python3_cyberfusion_systemd_support-2.
|
|
7
|
+
cyberfusion/SystemdSupport/units.py,sha256=03Jqxa2hDedQtHfkoBvLqx1FeCm62hEgfiKen-4wO9g,8011
|
|
8
|
+
python3_cyberfusion_systemd_support-2.6.dist-info/METADATA,sha256=mItu6Tmh7AVe-Vcw0LFLFwfqNvWrEMU1efwi5K4rT3w,1739
|
|
9
|
+
python3_cyberfusion_systemd_support-2.6.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
|
|
10
|
+
python3_cyberfusion_systemd_support-2.6.dist-info/top_level.txt,sha256=ss011q9S6SL_KIIyq7iujFmIYa0grSjlnInO7cDkeag,12
|
|
11
|
+
python3_cyberfusion_systemd_support-2.6.dist-info/RECORD,,
|
|
File without changes
|