Skip to content

dnfparse: add support for dnf repos for overrides#478

Draft
lzap wants to merge 1 commit intoosbuild:mainfrom
lzap:parse-yum1
Draft

dnfparse: add support for dnf repos for overrides#478
lzap wants to merge 1 commit intoosbuild:mainfrom
lzap:parse-yum1

Conversation

@lzap
Copy link
Contributor

@lzap lzap commented Mar 10, 2026

This is just a rough idea, today I was testing how repo override for Satellite works, one needs to create a JSON file and pass it. But on a registered system (to Satellite), there is already a repo file that contains everything, so I thought it would be nice to allow passing it directly:

image-builder manifest qcow2 --distro rhel-10.1 --force-repo=file:///etc/yum.repos.d/redhat.repo

I created a tiny repofile parser that reads the format and detection - when the --force-repo is a local file (not directory), then it tries to parse it and uses the information to build the override. This generates a manifest:

{
...
                "sha256:ff7914961b7976be1d3444d5315a6e5fcf9cdbb45d4903ff72fb306739612ce0": {
                    "path": "Packages/l/libblkid-2.40.2-15.el10_1.x86_64.rpm",
                    "mirror": "091140efa994c49267d7a3107b5e97036b2dec07b6bcc71b738b078f1ea30a54"
                }
            },
            "options": {
                "mirrors": {
                    "091140efa994c49267d7a3107b5e97036b2dec07b6bcc71b738b078f1ea30a54": {
                        "url": "https://katello.routed.lan/pulp/content/Default_Organization/Library/content/dist/rhel10/$releasever/x86_64/baseos/os",
                        "type": "baseurl",
                        "secrets": {
                            "name": "org.osbuild.mtls"
                        }
                    },
                    "cddaec356806ced85d76d87435ca6457443fc53d97d3acbef5f142517f89a252": {
                        "url": "https://katello.routed.lan/pulp/content/Default_Organization/Library/content/dist/rhel10/$releasever/x86_64/appstream/os",
                        "type": "baseurl",
                        "secrets": {
                            "name": "org.osbuild.mtls"
                        }
                    }
                }
            }
        }
    }
}

However, I am getting an error when trying to build this. Not sure why, something is missing not sure what that is:

Traceback (most recent call last):
  File "/usr/bin/osbuild", line 33, in <module>
    sys.exit(load_entry_point('osbuild==176', 'console_scripts', 'osbuild')())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/osbuild/main_cli.py", line 187, in osbuild_cli
    manifest.download(object_store, monitor)
  File "/usr/lib/python3.12/site-packages/osbuild/pipeline.py", line 581, in download
    raise e
  File "/usr/lib/python3.12/site-packages/osbuild/pipeline.py", line 576, in download
    source.download(mgr, store)
  File "/usr/lib/python3.12/site-packages/osbuild/sources.py", line 40, in download
    reply = client.call("download", args)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/osbuild/host.py", line 348, in call
    ret, _ = self.call_with_fds(method, args)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/osbuild/host.py", line 384, in call_with_fds
    raise error
osbuild.host.RemoteError: RuntimeError: mtls secrets required but key (None) or cert (None) not defined
   File "/usr/lib/python3.12/site-packages/osbuild/host.py", line 268, in serve
    reply, reply_fds = self._handle_message(msg, fds)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/osbuild/host.py", line 301, in _handle_message
    ret, fds = self.dispatch(name, args, fds)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/osbuild/sources.py", line 106, in dispatch
    self.fetch_all(args["items"])
  File "/usr/lib/osbuild/sources/org.osbuild.librepo", line 259, in fetch_all
    self._setup_mtls(handle)
  File "/usr/lib/osbuild/sources/org.osbuild.librepo", line 167, in _setup_mtls
    raise RuntimeError(f"mtls secrets required but key ({key}) or cert ({cert}) not defined")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant