File tree Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ Python-manatools
2
2
================
3
3
X.Y.Z
4
4
- dialog icon set if passed
5
+ - exported Service Manager Interface to allow using systemd api
5
6
6
7
0.0.3
7
8
- fixed release version (manatools/version.py)
Original file line number Diff line number Diff line change @@ -31,6 +31,13 @@ def __init__(self):
31
31
self ._reload = True
32
32
self ._services = {}
33
33
34
+ @property
35
+ def manager (self ):
36
+ '''
37
+ Returns the Service Manager Interface
38
+ '''
39
+ return dbus .Interface (self ._systemd , dbus_interface = 'org.freedesktop.systemd1.Manager' )
40
+
34
41
@property
35
42
def service_info (self ):
36
43
'''
@@ -40,9 +47,8 @@ def service_info(self):
40
47
'''
41
48
if not self ._reload :
42
49
return self ._services
43
-
44
- manager = dbus .Interface (self ._systemd , dbus_interface = 'org.freedesktop.systemd1.Manager' )
45
- units = manager .ListUnits ()
50
+
51
+ units = self .manager .ListUnits ()
46
52
self ._services = {}
47
53
self ._reload = False
48
54
@@ -52,7 +58,7 @@ def service_info(self):
52
58
if pos != - 1 :
53
59
try :
54
60
if unitName .find ("@" ) == - 1 :
55
- st = manager .GetUnitFileState (unitName )
61
+ st = self . manager .GetUnitFileState (unitName )
56
62
name = unitName [0 :pos ]
57
63
if st and (self .include_static_services or st != 'static' ):
58
64
self ._services [name ] = {
@@ -68,7 +74,7 @@ def service_info(self):
68
74
except :
69
75
pass
70
76
71
- unit_files = manager .ListUnitFiles ()
77
+ unit_files = self . manager .ListUnitFiles ()
72
78
for u in unit_files :
73
79
unitName = u [0 ]
74
80
st = u [1 ]
You can’t perform that action at this time.
0 commit comments