fix "copy" button by quoting description fields...

...in yaml output and escape quotes inside.

Without this change, the YAML outputted isn't valid due to ":"
characters in the description which end up throwing errors like

/etc/prometheus/rules/prometheus.rules: yaml: line 88: mapping values
are not allowed in this context.
This commit is contained in:
phaer 2021-01-14 12:38:49 +01:00
parent ea529cc8c3
commit 5f28c36313

View file

@ -85,7 +85,7 @@
severity: {{ rule.severity }} severity: {{ rule.severity }}
annotations: annotations:
summary: {{ rule.name }} (instance {% raw %}{{ $labels.instance }}{% endraw %}) summary: {{ rule.name }} (instance {% raw %}{{ $labels.instance }}{% endraw %})
description: {{ rule.description }}\n VALUE = {% raw %}{{ $value }}{% endraw %}\n LABELS: {% raw %}{{ $labels }}{% endraw %} description: "{{ rule.description | replace: '"', '\"' }}\n VALUE = {% raw %}{{ $value }}{% endraw %}\n LABELS: {% raw %}{{ $labels }}{% endraw %}"
{% endhighlight %} {% endhighlight %}