Skip to content

Commit

Permalink
fix(cli): workaround for cloud api to return a single telegraf config…
Browse files Browse the repository at this point in the history
… if specified (#19695)
  • Loading branch information
glinton authored Oct 6, 2020
1 parent fcb70c2 commit 8243eb8
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions cmd/influx/telegraf.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,19 +82,23 @@ func (b *cmdTelegrafBuilder) listRunE(cmd *cobra.Command, args []string) error {
}
}

var filter influxdb.UserResourceMappingFilter
if b.id != "" {
id, err := influxdb.IDFromString(b.id)
if err != nil {
return err
}
filter.ResourceID = *id
filter.ResourceType = influxdb.TelegrafsResourceType

cfg, err := svc.FindTelegrafConfigByID(context.Background(), *id)
if err != nil {
return err
}

return b.writeTelegrafConfig(cfg)
}

cfgs, _, err := svc.FindTelegrafConfigs(context.Background(), influxdb.TelegrafConfigFilter{
OrgID: &orgID,
UserResourceMappingFilter: filter,
UserResourceMappingFilter: influxdb.UserResourceMappingFilter{ResourceType: influxdb.TelegrafsResourceType},
})
if err != nil {
return err
Expand Down

0 comments on commit 8243eb8

Please sign in to comment.