stages/rhsm.facts: create facts file in /etc

Instead of creating the file in /usr/share and symlinking to /etc,
create it directly in /etc. This fixes an issue with SELinux labeling.
The file in /usr/share does not get labelled correctly because it
doesn't match the policy and causes issues with some tools (rhc).

See rhbz#2147450.
This commit is contained in:
Achilleas Koutsou 2023-01-02 19:50:47 +01:00 committed by Tomáš Hozza
parent d466d5d66a
commit 2efdbe0277

View file

@ -22,21 +22,14 @@ SCHEMA = r"""
def main(tree, options):
path = os.path.join(tree, "usr/share/osbuild/self")
file = os.path.join(path, "rhsm.facts")
path = os.path.join(tree, "etc/rhsm/facts")
file = os.path.join(path, "osbuild.facts")
os.makedirs(path, exist_ok=True)
with open(file, "x", encoding="utf8") as f:
json.dump(options["facts"], f)
os.makedirs(os.path.join(tree, "etc/rhsm/facts"), exist_ok=True)
os.symlink(
"/usr/share/osbuild/self/rhsm.facts",
os.path.join(tree, "etc/rhsm/facts/osbuild.facts"),
)
return 0