Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reporegistry: add NoReposLoadedError and use it #946

Merged
merged 1 commit into from
Oct 25, 2024

Conversation

thozza
Copy link
Member

@thozza thozza commented Sep 23, 2024

Add NoReposLoadedError custom error type for the case when any function that is supposed to load repository configs, does not load any. Use it in all functions that are directly loading repositories from configuration files.

I considered NoReposError name, but that could be later added for functions such as RepoRegistry.ReposBy...(), in case there are no repositories in the RepoRegistry for the given image type / arch.

This is a follow-up to osbuild/osbuild-composer#4378

Add `NoReposLoadedError` custom error type for the case when any
function that is supposed to load repository configs, does not load
any. Use it in all functions that are directly loading repositories
from configuration files.

I considered `NoReposError` name, but that could be later added for
functions such as `RepoRegistry.ReposBy...()`, in case there are no
repositories in the RepoRegistry for the given image type / arch.

Signed-off-by: Tomáš Hozza <[email protected]>
Copy link
Contributor

@mvo5 mvo5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

Copy link

This PR is stale because it has been open 30 days with no activity. Remove "Stale" label or comment or this will be closed in 7 days.

@github-actions github-actions bot added the Stale label Oct 25, 2024
@mvo5 mvo5 removed the Stale label Oct 25, 2024
@mvo5 mvo5 added this pull request to the merge queue Oct 25, 2024
Merged via the queue into osbuild:main with commit a30708c Oct 25, 2024
17 of 19 checks passed
achilleas-k added a commit to achilleas-k/osbuild-composer that referenced this pull request Oct 30, 2024
osbuild/images added an error type that's returned when the reporegistry
loader doesn't find any repository configurations to load [1].  This
lets callers decide whether to stop or continue execution based on
whether repository configurations are required.

Weldr (running on-prem) requires local repository configurations, while
the API (SaaS) doesn't.  However, at the time during startup when
reporegistry.LoadAllRepositories() is called, it is still not known
whether the Weldr API will be initialised.

Log the error message as an info message when it is detected but
continue execution.

[1] osbuild/images#946
achilleas-k added a commit to achilleas-k/osbuild-composer that referenced this pull request Oct 30, 2024
osbuild/images added an error type that's returned when the reporegistry
loader doesn't find any repository configurations to load [1].  This
lets callers decide whether to stop or continue execution based on
whether repository configurations are required.

Weldr (running on-prem) requires local repository configurations, while
the API (SaaS) doesn't.  However, at the time during startup when
reporegistry.LoadAllRepositories() is called, it is still not known
whether the Weldr API will be initialised.

Log the error message as an info message when it is detected but
continue execution.

[1] osbuild/images#946
achilleas-k added a commit to achilleas-k/osbuild-composer that referenced this pull request Oct 31, 2024
osbuild/images added an error type that's returned when the reporegistry
loader doesn't find any repository configurations to load [1].  This
lets callers decide whether to stop or continue execution based on
whether repository configurations are required.

Weldr (running on-prem) requires local repository configurations, while
the API (SaaS) doesn't.  However, at the time during startup when
reporegistry.LoadAllRepositories() is called, it is still not known
whether the Weldr API will be initialised.

Log the error message as an info message when it is detected but
continue execution.

[1] osbuild/images#946
achilleas-k added a commit to achilleas-k/osbuild-composer that referenced this pull request Oct 31, 2024
osbuild/images added an error type that's returned when the reporegistry
loader doesn't find any repository configurations to load [1].  This
lets callers decide whether to stop or continue execution based on
whether repository configurations are required.

Weldr (running on-prem) requires local repository configurations, while
the API (SaaS) doesn't.  However, at the time during startup when
reporegistry.LoadAllRepositories() is called, it is still not known
whether the Weldr API will be initialised.

Log the error message as an info message when it is detected but
continue execution.

[1] osbuild/images#946
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.

2 participants