Created
November 12, 2024 20:09
-
-
Save Thesola10/5e689a5a4f38074bcc49edc7b4e5f382 to your computer and use it in GitHub Desktop.
Parse metadata for staged OSTree deployment
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# Parse metadata for staged OSTree deployment | |
# (c) Karim Vergnes <[email protected]> | |
import json | |
from gi.repository import GLib | |
VARIANT_TYPE = GLib.VariantType("a{sv}") | |
sdict: dict | |
with open('/run/ostree/staged-deployment', 'rb') as sfile: | |
svar = GLib.Variant.new_from_bytes(VARIANT_TYPE, GLib.Bytes(sfile.read()), True) | |
sdict = dict(svar) | |
print(json.dumps(sdict)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment