Skip to content

Sanitize web config only once#2286

Open
VicDeo wants to merge 1 commit intoopencloud-eu:mainfrom
VicDeo:bugfix/issue-2271
Open

Sanitize web config only once#2286
VicDeo wants to merge 1 commit intoopencloud-eu:mainfrom
VicDeo:bugfix/issue-2271

Conversation

@VicDeo
Copy link

@VicDeo VicDeo commented Feb 5, 2026

Description

Suture restarts failing service by executing the respective command. Cobra tries to execute PreRunE one more time that triggers config sanitization for already sanitized config.
Checking against an empty string triggers panic.

Related Issue

Motivation and Context

It makes the world a better place to live and fixes the panic if the port 9200 is already taken.

P.S. Execute web.Execute(cfg.Web) command produces Usage: message in CLI on every restart on opencloud/pkg/runtime/service/service.go:264 so there are 5 such messages in console but that's completely different story.

How Has This Been Tested?

  • test environment:
  • test case 1:
nc -l 9200 &
./opencloud server

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests only (no source changes)

Checklist:

  • Code changes
  • Unit tests added
  • Acceptance tests added
  • Documentation added

@VicDeo
Copy link
Author

VicDeo commented Feb 5, 2026

@micbar @ScharfViktor it seems I can't add labels here.

@ScharfViktor
Copy link
Contributor

@micbar @ScharfViktor it seems I can't add labels here.

really? Is this available after clicking by label?

image

label check is skipped for PR from fork. but you should be able add label

@dragonchaser
Copy link
Member

@VicDeo You are onto sth here. But I am not really happy with your implementation, instead of using the config.sanitized variable, could you please add explicit nil-checks.

Copy link
Member

@dragonchaser dragonchaser left a comment

Choose a reason for hiding this comment

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

Please add explicit nil-checks instead of a bool workaround.

@VicDeo VicDeo force-pushed the bugfix/issue-2271 branch from 14a86ea to 6a271cd Compare February 6, 2026 09:28
@VicDeo
Copy link
Author

VicDeo commented Feb 6, 2026

@dragonchaser done

@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 6, 2026

@dragonchaser
Copy link
Member

Looks good, have approved CI-Run, waiting for it to turn green :)

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Server panic if 9200 port is taken up by another process

3 participants