Skip to content

fix: continue importing remaining URLs on failure in import-url command#435

Open
A-d-i-t-y wants to merge 1 commit into
microcks:masterfrom
A-d-i-t-y:fix/import-url-continue-on-failure
Open

fix: continue importing remaining URLs on failure in import-url command#435
A-d-i-t-y wants to merge 1 commit into
microcks:masterfrom
A-d-i-t-y:fix/import-url-continue-on-failure

Conversation

@A-d-i-t-y
Copy link
Copy Markdown

Summary

Fix early exit bug in import-url command when importing multiple URLs.

Problem

When running:
microcks import-url "https://url1.yaml,https://url2.yaml,https://url3.yaml"

If url1 fails, os.Exit(1) is called immediately and url2, url3
are never imported. Same bug as #393 which was fixed in import
command via PR #394.

Fix

  • Replaced os.Exit(1) with error collection and continue
  • All URLs are attempted regardless of individual failures
  • Exit with code 1 only if any URL failed

Example output after fix

Failed to import 'https://url2.yaml': connection refused
Microcks has discovered 'https://url1.yaml'
Microcks has discovered 'https://url3.yaml'

Files Changed

  • cmd/importURL.go — replaced os.Exit(1) with hasErrors flag and continue

Closes #399

Previously the import-url command would exit immediately on the first
failed URL, leaving remaining URLs unprocessed.

Now all URLs are attempted regardless of individual failures and a
non-zero exit code is returned only if any import failed.

Closes microcks#399

Signed-off-by: Aditya <aaaditya1909@gmail.com>
@A-d-i-t-y
Copy link
Copy Markdown
Author

Hi @Harsh4902 @Vaishnav88sk, I have raised this PR to fix the early exit bug in import-url command as discussed in issue #399. Same fix as PR #394 for the import command - all URLs are now attempted regardless of individual failures. Would love your feedback!

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.

fix: import-url command exits early on first failure when importing multiple URLs

1 participant