Skip to content

Commit

Permalink
Fix panic in pagerduty plugin init phase (#46925)
Browse files Browse the repository at this point in the history
This PR fixes a problem caused by pagerduty not having the Teleport
client initialized when starting from the standalone plugin.

This PR fixes the issue by moving the access monitoring rules init
function to a place where the teleport client is already initialized.

Signed-off-by: Tiago Silva <tiago.silva@goteleport.com>
  • Loading branch information
tigrato authored Sep 25, 2024
1 parent 59ad58b commit d48e0fb
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions integrations/access/pagerduty/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,18 +78,7 @@ func NewApp(conf Config) (*App, error) {
teleport: conf.Client,
statusSink: conf.StatusSink,
}
app.accessMonitoringRules = accessmonitoring.NewRuleHandler(accessmonitoring.RuleHandlerConfig{
Client: conf.Client,
PluginType: types.PluginTypePagerDuty,
PluginName: pluginName,
FetchRecipientCallback: func(_ context.Context, name string) (*common.Recipient, error) {
return &common.Recipient{
Name: name,
ID: name,
Kind: common.RecipientKindSchedule,
}, nil
},
})

app.mainJob = lib.NewServiceJob(app.run)

return app, nil
Expand Down Expand Up @@ -184,6 +173,19 @@ func (a *App) init(ctx context.Context) error {
}
}

a.accessMonitoringRules = accessmonitoring.NewRuleHandler(accessmonitoring.RuleHandlerConfig{
Client: a.teleport,
PluginType: types.PluginTypePagerDuty,
PluginName: pluginName,
FetchRecipientCallback: func(_ context.Context, name string) (*common.Recipient, error) {
return &common.Recipient{
Name: name,
ID: name,
Kind: common.RecipientKindSchedule,
}, nil
},
})

if pong, err = a.checkTeleportVersion(ctx); err != nil {
return trace.Wrap(err)
}
Expand Down

0 comments on commit d48e0fb

Please sign in to comment.