-
Notifications
You must be signed in to change notification settings - Fork 578
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
ConfigPackageUtility::CreatePackage("_api") broken #7173
Comments
What I forgot to mention in this context. Without API beeing enabled there are also backtraces in the logs, instead only complaining about api not available. (Also from the downtimes.) Example:
|
Hmmm, the API becomes are hard requirement in the future, since we will remove the external command pipe. Still, adding exceptions in places where they have never been tested for years, turns out to be a bad idea. Thanks for finding this, I will tackle this soon. |
Orrrrrrrr. I totally forgot that SDs use the config package too. Crap. |
Yes would be better if they would work on a box without api configuration and only static configuration as long as they are part of the static configuration. (For the uncommon use case to use Icinga2 as standalone monitoring agent.) |
Hmmm, the config packages are a bit broken by design. Reading the package's active stage from disk must not throw exceptions since it is a valid use case, e.g. when creating a package for the first time. The later steps then involve creating a new stage and activating it, essentially what's done with subsequent API requests. The _api package is special, and must be created on startup at the soonest point possible though with a special note to the user when this really is broken. |
Will continue tomorrow, pushed a branch. |
This partially reverts #7150 and avoids exceptions inside the flow. Each time an empty active stage is detected, Icinga tries to repair it from the the given directory tree. Also, the code now takes into account that it should create the package storage on startup, whether within the API object, or if disabled, inside the application. Caching the active stages for packages in memory only is in effect with the API feature being enabled. This is useful for other deployed config packages, not only the internal one. fixes #7173 refs #7150 refs #7119 fixes #6959
Fine, thanks. But still one issue in that context remains. |
I thought of purging an empty
|
Describe the bug
After fresh installation the the _api package cannot be created.
To Reproduce
Expected behavior
Initial stage is created
Your Environment
icinga2 --version
): current snapshoticinga2 feature list
): api checker mainlog notificationAdditional context
Observe logs (happens also for example downtime without external requests):
Try to create downtime via API:
This one is logged only as follows in the logs:
Cause
There is a kind of dead-loop (not really an infinite loop) in ConfigPackageUtility::CreatePackage which is triggered for the _api Package when Package not exists:
ConfigPackageUtility::CreatePackage calls ConfigPackageUtility::WritePackageConfig which in turn calls ConfigPackageUtility::GetActiveStage at the very beginning which is forced to ConfigPackageUtility::GetActiveStageFromFile which fails when no such file exists.
The ApiListener::CheckApiPackageIntegrity cannot help here, of cause.
I assume this issue came in context of #7119 / #7150 .
The text was updated successfully, but these errors were encountered: