1
0
mirror of https://github.com/openSUSE/snapper.git synced 2026-02-06 18:46:06 +01:00
Files
snapper/examples/python/get-snapshot.py
2023-03-28 15:00:27 +02:00

20 lines
536 B
Python
Executable File

#!/usr/bin/python3
from time import gmtime, asctime
from pwd import getpwuid
import dbus
bus = dbus.SystemBus()
snapper = dbus.Interface(bus.get_object('org.opensuse.Snapper', '/org/opensuse/Snapper'),
dbus_interface='org.opensuse.Snapper')
snapshot = snapper.GetSnapshot("root", 1)
print(snapshot[0], snapshot[1], snapshot[2], asctime(gmtime(snapshot[3])),
getpwuid(snapshot[4])[0], snapshot[5], snapshot[6], end='')
for k, v in snapshot[7].items():
print("", "%s=%s" % (k, v), end='')
print()