Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Ship Cat container manager
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
wizards
Ship Cat container manager
Commits
55afd775
Commit
55afd775
authored
Jun 4, 2024
by
Martin Mareš
Browse files
Options
Downloads
Patches
Plain Diff
Systemd communcations bits which will be probably removed
parent
c436fa14
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
client.py
+1
-1
1 addition, 1 deletion
client.py
server.py
+27
-1
27 additions, 1 deletion
server.py
with
28 additions
and
2 deletions
client.py
+
1
−
1
View file @
55afd775
...
@@ -12,7 +12,7 @@ from typing import Union, Optional, Callable, Dict, List, Set
...
@@ -12,7 +12,7 @@ from typing import Union, Optional, Callable, Dict, List, Set
async
def
main
():
async
def
main
():
bus
=
await
MessageBus
(
negotiate_unix_fd
=
True
).
connect
()
bus
=
await
MessageBus
(
bus_type
=
BusType
.
SYSTEM
,
negotiate_unix_fd
=
True
).
connect
()
ins
=
await
bus
.
introspect
(
'
cz.ucw.shipcat
'
,
'
/cz/ucw/ShipCat
'
)
ins
=
await
bus
.
introspect
(
'
cz.ucw.shipcat
'
,
'
/cz/ucw/ShipCat
'
)
...
...
This diff is collapsed.
Click to expand it.
server.py
+
27
−
1
View file @
55afd775
...
@@ -70,7 +70,7 @@ class BusLogic:
...
@@ -70,7 +70,7 @@ class BusLogic:
)
)
async
def
loop
(
self
)
->
None
:
async
def
loop
(
self
)
->
None
:
self
.
bus
=
await
MessageBus
(
negotiate_unix_fd
=
True
).
connect
()
self
.
bus
=
await
MessageBus
(
bus_type
=
BusType
.
SYSTEM
,
negotiate_unix_fd
=
True
).
connect
()
# Obtain proxy interface for org.freedesktop.DBus
# Obtain proxy interface for org.freedesktop.DBus
dbus_intro
=
await
self
.
bus
.
introspect
(
bus_name
=
'
org.freedesktop.DBus
'
,
path
=
'
/org/freedesktop/DBus
'
)
dbus_intro
=
await
self
.
bus
.
introspect
(
bus_name
=
'
org.freedesktop.DBus
'
,
path
=
'
/org/freedesktop/DBus
'
)
...
@@ -160,6 +160,32 @@ class BusLogic:
...
@@ -160,6 +160,32 @@ class BusLogic:
async
def
handle_Check
(
self
,
msg
:
Message
)
->
Message
:
async
def
handle_Check
(
self
,
msg
:
Message
)
->
Message
:
[
container
]
=
msg
.
body
[
container
]
=
msg
.
body
await
self
.
setup_container
(
container
,
msg
)
await
self
.
setup_container
(
container
,
msg
)
ins
=
await
self
.
bus
.
introspect
(
'
org.freedesktop.systemd1
'
,
'
/org/freedesktop/systemd1
'
)
pxy
=
self
.
bus
.
get_proxy_object
(
'
org.freedesktop.systemd1
'
,
'
/org/freedesktop/systemd1
'
,
ins
)
pif
=
pxy
.
get_interface
(
'
org.freedesktop.systemd1.Manager
'
)
p
=
await
pif
.
call_get_unit
(
'
inetd.service
'
)
print
(
p
)
uns
=
await
self
.
bus
.
introspect
(
'
org.freedesktop.systemd1
'
,
p
)
uxy
=
self
.
bus
.
get_proxy_object
(
'
org.freedesktop.systemd1
'
,
p
,
uns
)
uif
=
uxy
.
get_interface
(
'
org.freedesktop.systemd1.Unit
'
)
active
=
await
uif
.
get_active_state
()
sub_state
=
await
uif
.
get_sub_state
()
print
(
active
,
sub_state
)
await
pif
.
call_subscribe
()
def
cb
(
a
,
b
,
c
):
self
.
logger
.
debug
(
f
'
PROP:
{
a
}
{
b
}
{
c
}
'
)
prif
=
uxy
.
get_interface
(
'
org.freedesktop.DBus.Properties
'
)
prif
.
on_properties_changed
(
cb
)
await
asyncio
.
sleep
(
60
)
await
pif
.
call_unsubscribe
()
return
Message
.
new_method_return
(
msg
)
return
Message
.
new_method_return
(
msg
)
async
def
handle_Shell
(
self
,
msg
:
Message
)
->
Message
:
async
def
handle_Shell
(
self
,
msg
:
Message
)
->
Message
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment