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

🐛 main.go: improve logging for configuration of global auth #417

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion cmd/manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -295,11 +295,13 @@ func podNamespace() string {
func authFilePathIfPresent(logger logr.Logger) string {
_, err := os.Stat(authFilePath)
if os.IsNotExist(err) {
logger.Info("auth file not found, skipping configuration of global auth file", "path", authFilePath)
return ""
}
if err != nil {
logger.Error(err, "could not stat auth file path", "path", authFilePath)
logger.Error(err, "unable to stat auth file path", "path", authFilePath)
os.Exit(1)
}
logger.Info("auth file found, configuring globally for image registry interactions", "path", authFilePath)
return authFilePath
}
2 changes: 1 addition & 1 deletion internal/controllers/core/clustercatalog_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ func (r *ClusterCatalogReconciler) reconcile(ctx context.Context, catalog *v1alp

unpackResult, err := r.Unpacker.Unpack(ctx, catalog)
if err != nil {
unpackErr := fmt.Errorf("source bundle content: %w", err)
unpackErr := fmt.Errorf("source catalog content: %w", err)
updateStatusProgressing(catalog, unpackErr)
return ctrl.Result{}, unpackErr
}
Expand Down
4 changes: 2 additions & 2 deletions internal/controllers/core/clustercatalog_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ func TestCatalogdControllerReconcile(t *testing.T) {
},
{
name: "valid source type, unpack returns error, status updated to reflect error state and error is returned",
expectedError: fmt.Errorf("source bundle content: %w", fmt.Errorf("mocksource error")),
expectedError: fmt.Errorf("source catalog content: %w", fmt.Errorf("mocksource error")),
source: &MockSource{
unpackError: errors.New("mocksource error"),
},
Expand Down Expand Up @@ -174,7 +174,7 @@ func TestCatalogdControllerReconcile(t *testing.T) {
},
{
name: "valid source type, unpack returns terminal error, status updated to reflect terminal error state(Blocked) and error is returned",
expectedError: fmt.Errorf("source bundle content: %w", reconcile.TerminalError(fmt.Errorf("mocksource terminal error"))),
expectedError: fmt.Errorf("source catalog content: %w", reconcile.TerminalError(fmt.Errorf("mocksource terminal error"))),
source: &MockSource{
unpackError: reconcile.TerminalError(errors.New("mocksource terminal error")),
},
Expand Down