From 412a7ab089f65ef97533c6b9c5cd7d9924fd8ee7 Mon Sep 17 00:00:00 2001 From: Louis Abel Date: Fri, 1 Jul 2022 13:28:24 -0700 Subject: [PATCH] add json and yaml components --- iso/empanadas/empanadas/util/dnf_utils.py | 4 ++-- iso/empanadas/empanadas/util/shared.py | 11 ++++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/iso/empanadas/empanadas/util/dnf_utils.py b/iso/empanadas/empanadas/util/dnf_utils.py index c2243f1..62bd540 100644 --- a/iso/empanadas/empanadas/util/dnf_utils.py +++ b/iso/empanadas/empanadas/util/dnf_utils.py @@ -988,10 +988,10 @@ class RepoSync: Shared.write_metadata( self.timestamp, self.date_stamp, - self.fullname, + self.distname, self.fullversion, self.compose_id, - metadata_dir + 'metadata.json' + metadata_dir + '/metadata' ) self.log.info( diff --git a/iso/empanadas/empanadas/util/shared.py b/iso/empanadas/empanadas/util/shared.py index 407be7a..be3d33f 100644 --- a/iso/empanadas/empanadas/util/shared.py +++ b/iso/empanadas/empanadas/util/shared.py @@ -3,6 +3,7 @@ import os import json import hashlib +import yaml import productmd.treeinfo class ArchCheck: @@ -136,9 +137,13 @@ class Shared: } } - with open(file_path, "w+") as f: - json.dump(metadata, f) - f.close() + with open(file_path + ".json", "w+") as fp: + json.dump(metadata, fp, indent=4) + fp.close() + + with open(file_path + ".yaml", "w+") as yp: + yaml.dump(metadata, yp) + yp.close() @staticmethod def discinfo_write(timestamp, fullname, arch, file_path):