Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Templating - reReplaceAll not defined #64

Open
dccarbone opened this issue May 26, 2023 · 0 comments
Open

Templating - reReplaceAll not defined #64

dccarbone opened this issue May 26, 2023 · 0 comments

Comments

@dccarbone
Copy link

Hi! I need to replace space in the alertname with %20 but the function "reReplaceAll" is appearing as not defined.
I tested with urlquery and it replace " " with +, but with this I need to replace + with %20.

Do you guys know how can I use the function reReplaceAll? I checked and it was implemented by the alertmanager lib here.

Error:
time="2023-05-26T13:04:08Z" level=fatal msg="error initialising google chat provider" error="template: message.tmpl:28: function \"reReplaceAll\" not defined"

Template:

{{- define "alert_silence_link" -}}
{{- if eq .Status "firing" -}}
{{ template "externalURL" . }}/#/silences/new?filter=%7B
{{- range .Labels.SortedPairs -}}
{{- if ne .Name "alertname" -}}
{{- .Name }}%3D%22{{ urlquery .Value | reReplaceAll "\+" "%20" }}%22%2C%20
{{- end -}}
{{- end -}}
alertname%3D%22{{ urlquery .Labels.alertname | reReplaceAll "\+" "%20" }}%22%7D
{{- end -}}
{{- end -}}

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

No branches or pull requests

1 participant