fix "copy" button by quoting description fields... (#182)

...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:
Paul Haerle 2021-05-01 22:04:09 +02:00 committed by GitHub
parent af30d0f06c
commit e090fd1569
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -88,7 +88,7 @@
severity: {{ rule.severity }}
annotations:
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 %}