Skip to content

Return initial apply errors when parse config - #3531

Open
Ivan-Pokhabov wants to merge 2 commits into
osrg:masterfrom
Ivan-Pokhabov:feat/config
Open

Return initial apply errors when parse config #3531
Ivan-Pokhabov wants to merge 2 commits into
osrg:masterfrom
Ivan-Pokhabov:feat/config

Conversation

@Ivan-Pokhabov

Copy link
Copy Markdown
Contributor

Make InitialConfig return errors from failed config application instead of only
logging them, so gobgpd rejects invalid startup config such as missing peer-groups
or broken policy references. Keep UpdateConfig reloads non-fatal and covered by
tests.

Alse send sd_notify READY only after the startup config has been read and applied.
This prevents systemd from seeing gobgpd as ready right before it exits on an
invalid initial config, while preserving the no-config-file startup path.

@fujita

fujita commented Aug 5, 2026

Copy link
Copy Markdown
Member

What we want to do is that InitialConfig should stop on the first error and UpdateConfig should continue, right?

Then why not just adding an argument like stopOnError bool to functions used by both (e.g., addPeerGroups)?

deletePeerGroups/updatePeerGroups/deleteNeighbors/updateNeighbors are used only UpdateConfig so they can always continue with warning.

Then we don't need a new wrapper like configErrorHandler so we can use Go's typical error handling style; if err := f(); err != nil {}

@Ivan-Pokhabov

Copy link
Copy Markdown
Contributor Author

Then we don't need a new wrapper like configErrorHandler so we can use Go's typical error handling style; if err := f(); err != nil {}

I made it for future, because we probable would like to stop on error also UpdateConfig. But now I think you are right, i will rework it

Make InitialConfig return errors from failed config application instead of only
logging them, so gobgpd rejects invalid startup config such as missing peer-groups
or broken policy references. Keep UpdateConfig reloads non-fatal and covered by
tests.
Send sd_notify READY only after the startup config has been read and applied.
This prevents systemd from seeing gobgpd as ready right before it exits on an
invalid initial config, while preserving the no-config-file startup path.
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