-
Notifications
You must be signed in to change notification settings - Fork 782
Expand file tree
/
Copy pathsystemd.py
More file actions
783 lines (646 loc) · 24.6 KB
/
systemd.py
File metadata and controls
783 lines (646 loc) · 24.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
"""Mock of systemd dbus service."""
from dbus_fast import DBusError
from dbus_fast.service import PropertyAccess, dbus_property
from .base import DBusServiceMock, dbus_method
from .systemd_unit import SystemdUnit
BUS_NAME = "org.freedesktop.systemd1"
def setup(object_path: str | None = None) -> DBusServiceMock:
"""Create dbus mock object."""
return Systemd()
class Systemd(DBusServiceMock):
"""Systemd mock.
gdbus introspect --system --dest org.freedesktop.systemd1 --object-path /org/freedesktop/systemd1
"""
object_path = "/org/freedesktop/systemd1"
interface = "org.freedesktop.systemd1.Manager"
log_level = "info"
log_target = "journal-or-kmsg"
runtime_watchdog_usec = 0
reboot_watchdog_usec = 600000000
kexec_watchdog_usec = 0
service_watchdogs = True
system_state = "running"
virtualization = ""
response_get_unit: (
dict[str, list[str | DBusError]] | list[str | DBusError] | str | DBusError
) = "/org/freedesktop/systemd1/unit/tmp_2dyellow_2emount"
response_stop_unit: str | DBusError = "/org/freedesktop/systemd1/job/7623"
response_reload_or_restart_unit: str | DBusError = (
"/org/freedesktop/systemd1/job/7623"
)
response_restart_unit: str | DBusError = "/org/freedesktop/systemd1/job/7623"
response_start_transient_unit: str | DBusError = (
"/org/freedesktop/systemd1/job/7623"
)
mock_systemd_unit: SystemdUnit | None = None
@dbus_property(access=PropertyAccess.READ)
def Version(self) -> "s":
"""Get Version."""
return "245.4-4ubuntu3.11"
@dbus_property(access=PropertyAccess.READ)
def Features(self) -> "s":
"""Get Features."""
return "+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD +IDN2 -IDN +PCRE2 default-hierarchy=hybrid"
@dbus_property(access=PropertyAccess.READ)
def Virtualization(self) -> "s":
"""Get Virtualization."""
return self.virtualization
@dbus_property(access=PropertyAccess.READ)
def Architecture(self) -> "s":
"""Get Architecture."""
return "x86-64"
@dbus_property(access=PropertyAccess.READ)
def Tainted(self) -> "s":
"""Get Tainted."""
return ""
@dbus_property(access=PropertyAccess.READ)
def FirmwareTimestamp(self) -> "t":
"""Get FirmwareTimestamp."""
return 0
@dbus_property(access=PropertyAccess.READ)
def FirmwareTimestampMonotonic(self) -> "t":
"""Get FirmwareTimestampMonotonic."""
return 28723572
@dbus_property(access=PropertyAccess.READ)
def LoaderTimestamp(self) -> "t":
"""Get LoaderTimestamp."""
return 0
@dbus_property(access=PropertyAccess.READ)
def LoaderTimestampMonotonic(self) -> "t":
"""Get LoaderTimestampMonotonic."""
return 12402885
@dbus_property(access=PropertyAccess.READ)
def KernelTimestamp(self) -> "t":
"""Get KernelTimestamp."""
return 1632236694969442
@dbus_property(access=PropertyAccess.READ)
def KernelTimestampMonotonic(self) -> "t":
"""Get KernelTimestampMonotonic."""
return 0
@dbus_property(access=PropertyAccess.READ)
def InitRDTimestamp(self) -> "t":
"""Get InitRDTimestamp."""
return 0
@dbus_property(access=PropertyAccess.READ)
def InitRDTimestampMonotonic(self) -> "t":
"""Get InitRDTimestampMonotonic."""
return 0
@dbus_property(access=PropertyAccess.READ)
def UserspaceTimestamp(self) -> "t":
"""Get UserspaceTimestamp."""
return 1632236699147681
@dbus_property(access=PropertyAccess.READ)
def UserspaceTimestampMonotonic(self) -> "t":
"""Get UserspaceTimestampMonotonic."""
return 4178239
@dbus_property(access=PropertyAccess.READ)
def FinishTimestamp(self) -> "t":
"""Get FinishTimestamp."""
return 1632236713344227
@dbus_property(access=PropertyAccess.READ)
def FinishTimestampMonotonic(self) -> "t":
"""Get FinishTimestampMonotonic."""
return 18374785
@dbus_property(access=PropertyAccess.READ)
def SecurityStartTimestamp(self) -> "t":
"""Get SecurityStartTimestamp."""
return 1632236699156494
@dbus_property(access=PropertyAccess.READ)
def SecurityStartTimestampMonotonic(self) -> "t":
"""Get SecurityStartTimestampMonotonic."""
return 4187052
@dbus_property(access=PropertyAccess.READ)
def SecurityFinishTimestamp(self) -> "t":
"""Get SecurityFinishTimestamp."""
return 1632236699156980
@dbus_property(access=PropertyAccess.READ)
def SecurityFinishTimestampMonotonic(self) -> "t":
"""Get SecurityFinishTimestampMonotonic."""
return 4187538
@dbus_property(access=PropertyAccess.READ)
def GeneratorsStartTimestamp(self) -> "t":
"""Get GeneratorsStartTimestamp."""
return 1632236699281427
@dbus_property(access=PropertyAccess.READ)
def GeneratorsStartTimestampMonotonic(self) -> "t":
"""Get GeneratorsStartTimestampMonotonic."""
return 4311984
@dbus_property(access=PropertyAccess.READ)
def GeneratorsFinishTimestamp(self) -> "t":
"""Get GeneratorsFinishTimestamp."""
return 1632236699334042
@dbus_property(access=PropertyAccess.READ)
def GeneratorsFinishTimestampMonotonic(self) -> "t":
"""Get GeneratorsFinishTimestampMonotonic."""
return 4364600
@dbus_property(access=PropertyAccess.READ)
def UnitsLoadStartTimestamp(self) -> "t":
"""Get UnitsLoadStartTimestamp."""
return 1632236699334044
@dbus_property(access=PropertyAccess.READ)
def UnitsLoadStartTimestampMonotonic(self) -> "t":
"""Get UnitsLoadStartTimestampMonotonic."""
return 4364602
@dbus_property(access=PropertyAccess.READ)
def UnitsLoadFinishTimestamp(self) -> "t":
"""Get UnitsLoadFinishTimestamp."""
return 1632236699424558
@dbus_property(access=PropertyAccess.READ)
def UnitsLoadFinishTimestampMonotonic(self) -> "t":
"""Get UnitsLoadFinishTimestampMonotonic."""
return 4455116
@dbus_property(access=PropertyAccess.READ)
def InitRDSecurityStartTimestamp(self) -> "t":
"""Get InitRDSecurityStartTimestamp."""
return 0
@dbus_property(access=PropertyAccess.READ)
def InitRDSecurityStartTimestampMonotonic(self) -> "t":
"""Get InitRDSecurityStartTimestampMonotonic."""
return 0
@dbus_property(access=PropertyAccess.READ)
def InitRDSecurityFinishTimestamp(self) -> "t":
"""Get InitRDSecurityFinishTimestamp."""
return 0
@dbus_property(access=PropertyAccess.READ)
def InitRDSecurityFinishTimestampMonotonic(self) -> "t":
"""Get InitRDSecurityFinishTimestampMonotonic."""
return 0
@dbus_property(access=PropertyAccess.READ)
def InitRDGeneratorsStartTimestamp(self) -> "t":
"""Get InitRDGeneratorsStartTimestamp."""
return 0
@dbus_property(access=PropertyAccess.READ)
def InitRDGeneratorsStartTimestampMonotonic(self) -> "t":
"""Get InitRDGeneratorsStartTimestampMonotonic."""
return 0
@dbus_property(access=PropertyAccess.READ)
def InitRDGeneratorsFinishTimestamp(self) -> "t":
"""Get InitRDGeneratorsFinishTimestamp."""
return 0
@dbus_property(access=PropertyAccess.READ)
def InitRDGeneratorsFinishTimestampMonotonic(self) -> "t":
"""Get InitRDGeneratorsFinishTimestampMonotonic."""
return 0
@dbus_property(access=PropertyAccess.READ)
def InitRDUnitsLoadStartTimestamp(self) -> "t":
"""Get InitRDUnitsLoadStartTimestamp."""
return 0
@dbus_property(access=PropertyAccess.READ)
def InitRDUnitsLoadStartTimestampMonotonic(self) -> "t":
"""Get InitRDUnitsLoadStartTimestampMonotonic."""
return 0
@dbus_property(access=PropertyAccess.READ)
def InitRDUnitsLoadFinishTimestamp(self) -> "t":
"""Get InitRDUnitsLoadFinishTimestamp."""
return 0
@dbus_property(access=PropertyAccess.READ)
def InitRDUnitsLoadFinishTimestampMonotonic(self) -> "t":
"""Get InitRDUnitsLoadFinishTimestampMonotonic."""
return 0
@dbus_property()
def LogLevel(self) -> "s":
"""Get LogLevel."""
return self.log_level
@LogLevel.setter
def LogLevel(self, value: "s"):
"""Set LogLevel. Does not emit prop change."""
self.log_level = value
@dbus_property()
def LogTarget(self) -> "s":
"""Get LogTarget."""
return self.log_target
@LogTarget.setter
def LogTarget(self, value: "s"):
"""Set LogTarget. Does not emit prop change."""
self.log_target = value
@dbus_property(access=PropertyAccess.READ)
def NNames(self) -> "u":
"""Get NNames."""
return 564
@dbus_property(access=PropertyAccess.READ)
def NFailedUnits(self) -> "u":
"""Get NFailedUnits."""
return 0
@dbus_property(access=PropertyAccess.READ)
def NJobs(self) -> "u":
"""Get NJobs."""
return 0
@dbus_property(access=PropertyAccess.READ)
def NInstalledJobs(self) -> "u":
"""Get NInstalledJobs."""
return 1575
@dbus_property(access=PropertyAccess.READ)
def NFailedJobs(self) -> "u":
"""Get NFailedJobs."""
return 0
@dbus_property(access=PropertyAccess.READ)
def Progress(self) -> "d":
"""Get Progress."""
return 1.0
@dbus_property(access=PropertyAccess.READ)
def Environment(self) -> "as":
"""Get Environment."""
return [
"LANG=en_US.UTF-8",
"LC_ADDRESS=nb_NO.UTF-8",
"LC_IDENTIFICATION=nb_NO.UTF-8",
"LC_MEASUREMENT=nb_NO.UTF-8",
"LC_MONETARY=nb_NO.UTF-8",
"LC_NAME=nb_NO.UTF-8",
"LC_NUMERIC=nb_NO.UTF-8",
"LC_PAPER=nb_NO.UTF-8",
"LC_TELEPHONE=nb_NO.UTF-8",
"LC_TIME=nb_NO.UTF-8",
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin",
]
@dbus_property(access=PropertyAccess.READ)
def ConfirmSpawn(self) -> "b":
"""Get ConfirmSpawn."""
return False
@dbus_property(access=PropertyAccess.READ)
def ShowStatus(self) -> "b":
"""Get ShowStatus."""
return False
@dbus_property(access=PropertyAccess.READ)
def UnitPath(self) -> "as":
"""Get UnitPath."""
return [
"/etc/systemd/system.control",
"/run/systemd/system.control",
"/run/systemd/transient",
"/run/systemd/generator.early",
"/etc/systemd/system",
"/etc/systemd/system.attached",
"/run/systemd/system",
"/run/systemd/system.attached",
"/run/systemd/generator",
"/usr/local/lib/systemd/system",
"/lib/systemd/system",
"/usr/lib/systemd/system",
"/run/systemd/generator.late",
]
@dbus_property(access=PropertyAccess.READ)
def DefaultStandardOutput(self) -> "s":
"""Get DefaultStandardOutput."""
return "journal"
@dbus_property(access=PropertyAccess.READ)
def DefaultStandardError(self) -> "s":
"""Get DefaultStandardError."""
return "journal"
@dbus_property()
def RuntimeWatchdogUSec(self) -> "t":
"""Get RuntimeWatchdogUSec."""
return self.runtime_watchdog_usec
@RuntimeWatchdogUSec.setter
def RuntimeWatchdogUSec(self, value: "t"):
"""Set RuntimeWatchdogUSec. Does not emit prop change."""
self.runtime_watchdog_usec = value
@dbus_property()
def RebootWatchdogUSec(self) -> "t":
"""Get RebootWatchdogUSec."""
return self.reboot_watchdog_usec
@RebootWatchdogUSec.setter
def RebootWatchdogUSec(self, value: "t"):
"""Set RebootWatchdogUSec. Does not emit prop change."""
self.RebootWatchdogUSec = value
@dbus_property()
def KExecWatchdogUSec(self) -> "t":
"""Get KExecWatchdogUSec."""
return self.kexec_watchdog_usec
@KExecWatchdogUSec.setter
def KExecWatchdogUSec(self, value: "t"):
"""Set KExecWatchdogUSec. Does not emit prop change."""
self.KExecWatchdogUSec = value
@dbus_property()
def ServiceWatchdogs(self) -> "b":
"""Get ServiceWatchdogs."""
return self.service_watchdogs
@ServiceWatchdogs.setter
def ServiceWatchdogs(self, value: "b"):
"""Set ServiceWatchdogs. Does not emit prop change."""
self.service_watchdogs = value
@dbus_property(access=PropertyAccess.READ)
def ControlGroup(self) -> "s":
"""Get ControlGroup."""
return ""
@dbus_property(access=PropertyAccess.READ)
def SystemState(self) -> "s":
"""Get SystemState."""
return self.system_state
@dbus_property(access=PropertyAccess.READ)
def ExitCode(self) -> "y":
"""Get ExitCode."""
return 0x00
@dbus_property(access=PropertyAccess.READ)
def DefaultTimerAccuracyUSec(self) -> "t":
"""Get DefaultTimerAccuracyUSec."""
return 60000000
@dbus_property(access=PropertyAccess.READ)
def DefaultTimeoutStartUSec(self) -> "t":
"""Get DefaultTimeoutStartUSec."""
return 90000000
@dbus_property(access=PropertyAccess.READ)
def DefaultTimeoutStopUSec(self) -> "t":
"""Get DefaultTimeoutStopUSec."""
return 90000000
@dbus_property(access=PropertyAccess.READ)
def DefaultTimeoutAbortUSec(self) -> "t":
"""Get DefaultTimeoutAbortUSec."""
return 90000000
@dbus_property(access=PropertyAccess.READ)
def DefaultRestartUSec(self) -> "t":
"""Get DefaultRestartUSec."""
return 100000
@dbus_property(access=PropertyAccess.READ)
def DefaultStartLimitIntervalUSec(self) -> "t":
"""Get DefaultStartLimitIntervalUSec."""
return 10000000
@dbus_property(access=PropertyAccess.READ)
def DefaultStartLimitBurst(self) -> "u":
"""Get DefaultStartLimitBurst."""
return 5
@dbus_property(access=PropertyAccess.READ)
def DefaultCPUAccounting(self) -> "b":
"""Get DefaultCPUAccounting."""
return False
@dbus_property(access=PropertyAccess.READ)
def DefaultBlockIOAccounting(self) -> "b":
"""Get DefaultBlockIOAccounting."""
return False
@dbus_property(access=PropertyAccess.READ)
def DefaultMemoryAccounting(self) -> "b":
"""Get DefaultMemoryAccounting."""
return True
@dbus_property(access=PropertyAccess.READ)
def DefaultTasksAccounting(self) -> "b":
"""Get DefaultTasksAccounting."""
return True
@dbus_property(access=PropertyAccess.READ)
def DefaultLimitCPU(self) -> "t":
"""Get DefaultLimitCPU."""
return 18446744073709551615
@dbus_property(access=PropertyAccess.READ)
def DefaultLimitCPUSoft(self) -> "t":
"""Get DefaultLimitCPUSoft."""
return 18446744073709551615
@dbus_property(access=PropertyAccess.READ)
def DefaultLimitFSIZE(self) -> "t":
"""Get DefaultLimitFSIZE."""
return 18446744073709551615
@dbus_property(access=PropertyAccess.READ)
def DefaultLimitFSIZESoft(self) -> "t":
"""Get DefaultLimitFSIZESoft."""
return 18446744073709551615
@dbus_property(access=PropertyAccess.READ)
def DefaultLimitDATA(self) -> "t":
"""Get DefaultLimitDATA."""
return 18446744073709551615
@dbus_property(access=PropertyAccess.READ)
def DefaultLimitDATASoft(self) -> "t":
"""Get DefaultLimitDATASoft."""
return 18446744073709551615
@dbus_property(access=PropertyAccess.READ)
def DefaultLimitSTACK(self) -> "t":
"""Get DefaultLimitSTACK."""
return 18446744073709551615
@dbus_property(access=PropertyAccess.READ)
def DefaultLimitSTACKSoft(self) -> "t":
"""Get DefaultLimitSTACKSoft."""
return 8388608
@dbus_property(access=PropertyAccess.READ)
def DefaultLimitCORE(self) -> "t":
"""Get DefaultLimitCORE."""
return 18446744073709551615
@dbus_property(access=PropertyAccess.READ)
def DefaultLimitCORESoft(self) -> "t":
"""Get DefaultLimitCORESoft."""
return 0
@dbus_property(access=PropertyAccess.READ)
def DefaultLimitRSS(self) -> "t":
"""Get DefaultLimitRSS."""
return 18446744073709551615
@dbus_property(access=PropertyAccess.READ)
def DefaultLimitRSSSoft(self) -> "t":
"""Get DefaultLimitRSSSoft."""
return 18446744073709551615
@dbus_property(access=PropertyAccess.READ)
def DefaultLimitNOFILE(self) -> "t":
"""Get DefaultLimitNOFILE."""
return 524288
@dbus_property(access=PropertyAccess.READ)
def DefaultLimitNOFILESoft(self) -> "t":
"""Get DefaultLimitNOFILESoft."""
return 1024
@dbus_property(access=PropertyAccess.READ)
def DefaultLimitAS(self) -> "t":
"""Get DefaultLimitAS."""
return 18446744073709551615
@dbus_property(access=PropertyAccess.READ)
def DefaultLimitASSoft(self) -> "t":
"""Get DefaultLimitASSoft."""
return 18446744073709551615
@dbus_property(access=PropertyAccess.READ)
def DefaultLimitNPROC(self) -> "t":
"""Get DefaultLimitNPROC."""
return 127764
@dbus_property(access=PropertyAccess.READ)
def DefaultLimitNPROCSoft(self) -> "t":
"""Get DefaultLimitNPROCSoft."""
return 127764
@dbus_property(access=PropertyAccess.READ)
def DefaultLimitMEMLOCK(self) -> "t":
"""Get DefaultLimitMEMLOCK."""
return 65536
@dbus_property(access=PropertyAccess.READ)
def DefaultLimitMEMLOCKSoft(self) -> "t":
"""Get DefaultLimitMEMLOCKSoft."""
return 65536
@dbus_property(access=PropertyAccess.READ)
def DefaultLimitLOCKS(self) -> "t":
"""Get DefaultLimitLOCKS."""
return 18446744073709551615
@dbus_property(access=PropertyAccess.READ)
def DefaultLimitLOCKSSoft(self) -> "t":
"""Get DefaultLimitLOCKSSoft."""
return 18446744073709551615
@dbus_property(access=PropertyAccess.READ)
def DefaultLimitSIGPENDING(self) -> "t":
"""Get DefaultLimitSIGPENDING."""
return 127764
@dbus_property(access=PropertyAccess.READ)
def DefaultLimitSIGPENDINGSoft(self) -> "t":
"""Get DefaultLimitSIGPENDINGSoft."""
return 127764
@dbus_property(access=PropertyAccess.READ)
def DefaultLimitMSGQUEUE(self) -> "t":
"""Get DefaultLimitMSGQUEUE."""
return 819200
@dbus_property(access=PropertyAccess.READ)
def DefaultLimitMSGQUEUESoft(self) -> "t":
"""Get DefaultLimitMSGQUEUESoft."""
return 819200
@dbus_property(access=PropertyAccess.READ)
def DefaultLimitNICE(self) -> "t":
"""Get DefaultLimitNICE."""
return 0
@dbus_property(access=PropertyAccess.READ)
def DefaultLimitNICESoft(self) -> "t":
"""Get DefaultLimitNICESoft."""
return 0
@dbus_property(access=PropertyAccess.READ)
def DefaultLimitRTPRIO(self) -> "t":
"""Get DefaultLimitRTPRIO."""
return 0
@dbus_property(access=PropertyAccess.READ)
def DefaultLimitRTPRIOSoft(self) -> "t":
"""Get DefaultLimitRTPRIOSoft."""
return 0
@dbus_property(access=PropertyAccess.READ)
def DefaultLimitRTTIME(self) -> "t":
"""Get DefaultLimitRTTIME."""
return 18446744073709551615
@dbus_property(access=PropertyAccess.READ)
def DefaultLimitRTTIMESoft(self) -> "t":
"""Get DefaultLimitRTTIMESoft."""
return 18446744073709551615
@dbus_property(access=PropertyAccess.READ)
def DefaultTasksMax(self) -> "t":
"""Get DefaultTasksMax."""
return 38329
@dbus_property(access=PropertyAccess.READ)
def TimerSlackNSec(self) -> "t":
"""Get TimerSlackNSec."""
return 50000
@dbus_property(access=PropertyAccess.READ)
def DefaultOOMPolicy(self) -> "s":
"""Get DefaultOOMPolicy."""
return "stop"
@dbus_property(access=PropertyAccess.READ)
def DefaultOOMScoreAdjust(self) -> "i":
"""Get DefaultOOMScoreAdjust."""
return 0
@dbus_property(access=PropertyAccess.READ)
def CtrlAltDelBurstAction(self) -> "s":
"""Get CtrlAltDelBurstAction."""
return "reboot-force"
@dbus_method()
def Reboot(self) -> None:
"""Reboot host computer."""
@dbus_method()
def PowerOff(self) -> None:
"""Power off host computer."""
@dbus_method()
def Subscribe(self) -> None:
"""Subscribe to systemd signals."""
@dbus_method()
def StartUnit(self, name: "s", mode: "s") -> "o":
"""Start a service unit."""
if self.mock_systemd_unit:
self.mock_systemd_unit.active_state = "active"
return "/org/freedesktop/systemd1/job/7623"
@dbus_method()
def StopUnit(self, name: "s", mode: "s") -> "o":
"""Stop a service unit."""
if isinstance(self.response_stop_unit, DBusError):
raise self.response_stop_unit # pylint: disable=raising-bad-type
if self.mock_systemd_unit:
self.mock_systemd_unit.active_state = "inactive"
return self.response_stop_unit
@dbus_method()
def ReloadOrRestartUnit(self, name: "s", mode: "s") -> "o":
"""Reload or restart a service unit."""
if isinstance(self.response_reload_or_restart_unit, DBusError):
raise self.response_reload_or_restart_unit # pylint: disable=raising-bad-type
if self.mock_systemd_unit:
self.mock_systemd_unit.active_state = "active"
return self.response_reload_or_restart_unit
@dbus_method()
def RestartUnit(self, name: "s", mode: "s") -> "o":
"""Restart a service unit."""
if isinstance(self.response_restart_unit, DBusError):
raise self.response_restart_unit # pylint: disable=raising-bad-type
if self.mock_systemd_unit:
self.mock_systemd_unit.active_state = "active"
return self.response_restart_unit
@dbus_method()
def StartTransientUnit(
self, name: "s", mode: "s", properties: "a(sv)", aux: "a(sa(sv))"
) -> "o":
"""Start a transient service unit."""
if isinstance(self.response_start_transient_unit, DBusError):
raise self.response_start_transient_unit # pylint: disable=raising-bad-type
if self.mock_systemd_unit:
self.mock_systemd_unit.active_state = "active"
return self.response_start_transient_unit
@dbus_method()
def ResetFailedUnit(self, name: "s") -> None:
"""Reset a failed unit."""
if self.mock_systemd_unit:
self.mock_systemd_unit.active_state = "inactive"
@dbus_method()
def GetUnit(self, name: "s") -> "s":
"""Get unit."""
if isinstance(self.response_get_unit, dict):
unit = self.response_get_unit[name].pop(0)
elif isinstance(self.response_get_unit, list):
unit = self.response_get_unit.pop(0)
else:
unit = self.response_get_unit
if isinstance(unit, DBusError):
raise unit
return unit
@dbus_method()
def ListUnits(
self,
) -> "a(ssssssouso)":
"""Return a list of available services."""
return [
[
"etc-machine\\x2did.mount",
"/etc/machine-id",
"loaded",
"active",
"mounted",
"",
"/org/freedesktop/systemd1/unit/etc_2dmachine_5cx2did_2emount",
0,
"",
"/",
],
[
"firewalld.service",
"firewalld.service",
"not-found",
"inactive",
"dead",
"",
"/org/freedesktop/systemd1/unit/firewalld_2eservice",
0,
"",
"/",
],
[
"sys-devices-virtual-tty-ttypd.device",
"/sys/devices/virtual/tty/ttypd",
"loaded",
"active",
"plugged",
"",
"/org/freedesktop/systemd1/unit/sys_2ddevices_2dvirtual_2dtty_2dttypd_2edevice",
0,
"",
"/",
],
[
"zram-swap.service",
"HassOS ZRAM swap",
"loaded",
"active",
"exited",
"",
"/org/freedesktop/systemd1/unit/zram_2dswap_2eservice",
0,
"",
"/",
],
]