Skip to content

Instantly share code, notes, and snippets.

@Thesola10
Created November 12, 2024 20:09
Show Gist options
  • Save Thesola10/5e689a5a4f38074bcc49edc7b4e5f382 to your computer and use it in GitHub Desktop.
Save Thesola10/5e689a5a4f38074bcc49edc7b4e5f382 to your computer and use it in GitHub Desktop.
Parse metadata for staged OSTree deployment
#!/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