Skip to content

Update/pipeline uninstalls#25

Merged
Shalankwa merged 12 commits into
mainfrom
update/pipeline-uninstalls
Mar 21, 2025
Merged

Update/pipeline uninstalls#25
Shalankwa merged 12 commits into
mainfrom
update/pipeline-uninstalls

Conversation

@lrojash

@lrojash lrojash commented Mar 19, 2025

Copy link
Copy Markdown
Contributor

No description provided.

Comment on lines +267 to +288
func linuxApiUpdater(apikey, filePath string) error {
fullConfig, err := utils.ReadFile(filePath)
if err != nil {
return fmt.Errorf("error reading file: %v", err)
}

graphiteBlock := `\[\[outputs\.graphite\]\](?:.|\s)*?\[\[`
updates := map[string]string{
`prefix\s*=\s*".*?"`: fmt.Sprintf(`prefix = "%s.telegraf"`, apikey),
}
updatedConfig, err := utils.UpdateConfigBlock(fullConfig, graphiteBlock, updates)
if err != nil {
return fmt.Errorf("error writing file:%v", err)
}

err = utils.WriteFile(filePath, updatedConfig)
if err != nil {
return fmt.Errorf("error writing file:%v", err)
}

return nil
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I already had this function within the base telegraf_pipeline.go file. Why did you repeat it inside linux?

@Shalankwa Shalankwa marked this pull request as ready for review March 21, 2025 04:00
@Shalankwa Shalankwa merged commit 932546d into main Mar 21, 2025
@Shalankwa Shalankwa deleted the update/pipeline-uninstalls branch March 21, 2025 05:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants