Skip to content

Commit

Permalink
Revert "Add sprig utility function to snip templates"
Browse files Browse the repository at this point in the history
This reverts commit 526bcc1.
  • Loading branch information
jcreixell committed Nov 22, 2023
1 parent 526bcc1 commit dd5e3c7
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 11 deletions.
3 changes: 0 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -620,11 +620,8 @@ require (
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.19.0
)

require github.com/Masterminds/semver v1.5.0 // indirect

require (
dario.cat/mergo v1.0.0 // indirect
github.com/Masterminds/sprig v2.22.0+incompatible
github.com/Shopify/sarama v1.38.1 // indirect
github.com/Workiva/go-datastructures v1.1.0 // indirect
github.com/drone/envsubst v1.0.3 // indirect
Expand Down
4 changes: 0 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -193,13 +193,9 @@ github.com/Lusitaniae/apache_exporter v0.11.1-0.20220518131644-f9522724dab4/go.m
github.com/MasslessParticle/azure-storage-blob-go v0.14.1-0.20220216145902-b5e698eff68e/go.mod h1:SMqIBi+SuiQH32bvyjngEewEeXoPfKMgWlBDaYf6fck=
github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI=
github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU=
github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww=
github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y=
github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs=
github.com/Masterminds/semver/v3 v3.2.0 h1:3MEsd0SM6jqZojhjLWWeBY+Kcjy9i6MQAeY7YgDP83g=
github.com/Masterminds/semver/v3 v3.2.0/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ=
github.com/Masterminds/sprig v2.22.0+incompatible h1:z4yfnGrZ7netVz+0EDJ0Wi+5VZCSYp4Z0m2dk6cEM60=
github.com/Masterminds/sprig v2.22.0+incompatible/go.mod h1:y6hNFY5UBTIWBxnzTeuNhlNS5hqE0NB0E6fgfo2Br3o=
github.com/Masterminds/sprig/v3 v3.2.3 h1:eL2fZNezLomi0uOLqjQoN6BfsDD+fyLtgbJMAj9n6YA=
github.com/Masterminds/sprig/v3 v3.2.3/go.mod h1:rXcFaZ2zZbLRJv/xSysmlgIM1u11eBaRMhvYXJNkGuM=
github.com/Mellanox/rdmamap v0.0.0-20191106181932-7c3c4763a6ee/go.mod h1:jDA6v0TUYrFEIAE5uGJ29LQOeONIgMdP4Rkqb8HUnPM=
Expand Down
4 changes: 2 additions & 2 deletions pkg/config/agent_management_remote_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ integration_configs:
process_names:
- name: "grafana-agent"
cmdline:
- '{{ "grafana-agent" | replace "grafana-" "" }}'
- 'grafana-agent'
- name: "{{.nonexistent.foo.bar.baz.bat}}"
cmdline:
- "{{ ` + templateInsideTemplate + ` }}"
Expand Down Expand Up @@ -243,7 +243,7 @@ integration_configs:
require.Equal(t, 4, len(processExporterConfig.ProcessExporter))

require.Equal(t, "grafana-agent", processExporterConfig.ProcessExporter[0].Name)
require.Equal(t, "agent", processExporterConfig.ProcessExporter[0].CmdlineRules[0])
require.Equal(t, "grafana-agent", processExporterConfig.ProcessExporter[0].CmdlineRules[0])
require.Equal(t, 0, len(processExporterConfig.ProcessExporter[0].ExeRules))

require.Equal(t, "<no value>", processExporterConfig.ProcessExporter[1].Name)
Expand Down
3 changes: 1 addition & 2 deletions pkg/config/agentmanagement_remote_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"bytes"
"text/template"

"github.com/Masterminds/sprig"
"github.com/grafana/agent/pkg/integrations"
"github.com/grafana/agent/pkg/logs"
"github.com/grafana/agent/pkg/metrics/instance"
Expand Down Expand Up @@ -165,7 +164,7 @@ func appendExternalLabels(c *Config, externalLabels map[string]string) {
}

func evaluateTemplate(config string, templateVariables map[string]any) (string, error) {
tpl, err := template.New("config").Funcs(sprig.FuncMap()).Parse(config)
tpl, err := template.New("config").Parse(config)
if err != nil {
return "", err
}
Expand Down

0 comments on commit dd5e3c7

Please sign in to comment.