feat(gorgone): use /administation/tokens endpoint to validate POLLER_TOKEN on Central#3465
Conversation
|
Important Review skippedAuto reviews are limited based on label configuration. 🏷️ Required labels (at least one) (1)
Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
| ); | ||
| } | ||
| } else { | ||
| $self->{logger}->writeLogDebug('[proxy-httpserver] cannot get token ' . $token_name . ' - ' . $self->{tpapi_centreonv2}->error()); |
There was a problem hiding this comment.
If the token does not exist you should disconnect the poller. I think you can invert your l212 condition to if (status != 0 or !defined($results->{token} or $results->{is_revoked} or str2time($results->{expiration_date}) < time()))
| ${log_central_query} Create List [proxy-httpserver] invalid token | ||
| # The poller is connected | ||
| Check Poller Is Connected port=8086 expected_nb=2 | ||
| ${logs_central} Ctn Find In Log With Timeout log=/var/log/centreon-gorgone/pullwss_gorgone_central_simple/gorgoned.log content=${log_central_query} date=${start_date} |
There was a problem hiding this comment.
By default this search the log for 20 second, is it really what you want ?
I think if you start the search before the start (as l127 show) then you can either not wait 20 second or wait and call it only once or check each time you see the "recurring token revocation check" log
| Ctn Check No Error In Logs ${mode}_gorgone_poller_2_simple | ||
| # we need to find the message that explains the connection refusal | ||
| ${log_central_query} Create List ${message} | ||
| ${logs_central} Ctn Find In Log With Timeout log=/var/log/centreon-gorgone/${mode}_gorgone_central_simple/gorgoned.log content=${log_central_query} date=${start_date} timeout=70 |
There was a problem hiding this comment.
Why not checking the poller get a disconnect instead of the central ? the central can create a log saying "disconnecting" without actually making any action, checking the poller allows to be sure the action was realized.
Description
Use /administration/tokens/ Centreon API endpoint to validate pollers token.
Token from the conf file is used if the token isn't found with the API, so the "old way" is still working.
The token is invalid if it's revoked or expired, and we check that they're all still valid every 5 seconds.
Fixes MON-198541
Type of change
Target serie
How this pull request can be tested ?
See automated test:
Checklist