* Initialize usage reporting via plugin registry after auth server setup
Usage reporting was previously initialized in enterprise process
constructors (cloud.NewTeleport, pro.NewTeleport), which ran after the
OSS auth server completed initialization. This caused enterprise auth
extensions to miss the UsageReporter service because they were initialized
after the OSS auth server was created but before the usage reporting was set up.
To fix the ordering, add a callback mechanism to plugin.Registry:
- SetUsageReportingInitFunc registers a callback to be called once the
auth server is ready.
- InitUsageReporting triggers that callback from initAuthService, after
setLocalAuth makes the server available to callers.
Signed-off-by: Tiago Silva <tiago.silva@goteleport.com>
* update comment
* handle review feedback
* remove dynamic function load
* fix another addition
---------
Signed-off-by: Tiago Silva <tiago.silva@goteleport.com>
Enterprise tests do not always set the enterprise build type which
causes test failures due to duplicate service registration. To
prevent every test from needing to update the modules the PluginRegistry
was modified to expose a mechanism to detect if a plugin is registered
or not. The old check that registered a not implemented LoginRuleService
now makes use of this mechanism to verify that the enterprise auth
plugin is not registered.