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 error for canary failures #1446

Closed
moshloop opened this issue Sep 24, 2024 · 0 comments · Fixed by #1449
Closed

Templating error for canary failures #1446

moshloop opened this issue Sep 24, 2024 · 0 comments · Fixed by #1449
Assignees
Labels
bug Something isn't working
Milestone

Comments

@moshloop
Copy link
Member

---
error:
  context:
    template: "<p>{{ if eq channel &ldquo;slack&rdquo;}}\n{</p>\n\n<pre><code>&quot;blocks&quot;:
      [\n\t{{slackSectionTextMD (printf `:red_circle: *%s* is _unhealthy_` .check.name)}},\n{&quot;type&quot;:
      &quot;divider&quot;},\n\t{{ if .status.error}}{{slackSectionTextMD status.error}},{{end}}\n\t{\n\t\t&quot;type&quot;:
      &quot;section&quot;,\n\t\t&quot;fields&quot;: [\n\t\t\t{{slackSectionTextFieldMD
      (printf `*Canary*: %s` .canary.name) }},\n\t\t\t{{slackSectionTextFieldMD (printf
      `*Namespace*: %s` .canary.namespace) }}\n\t\t\t{{if ne .agent.name &quot;local&quot;}}\n\t\t\t\t,{{slackSectionTextFieldMD
      (printf `*Agent*: %s` .agent.name) }}\n\t\t\t{{end}}\n\t\t]\n\t},\n\t{{ if .check.labels}}{{slackSectionLabels
      .check}},{{end}}\n\t{{ slackURLAction &quot;View Health Check&quot; .permalink
      &quot;\U0001F515 Silence&quot; .silenceURL}}\n]\n</code></pre>\n\n<p>}\n{{ else
      }}\nCanary: {{.canary.name}}\n{{if .agent}}Agent: {{.agent.name}}{{end}}\nError:
      {{.status.error}}\n{{labelsFormat .check.labels}}</p>\n\n<p><a href=\"{{.permalink}}\"
      target=\"_blank\">Reference</a>\n{{end}}</p>\n"
  error: 'template: :1: unexpected "&" in operand'
  stacktrace: |-
    Oops: template: :1: unexpected "&" in operand
      --- at /go/pkg/mod/github.com/flanksource/gomplate/[email protected]/template.go:295 goTemplate()
      --- at /go/pkg/mod/github.com/flanksource/gomplate/[email protected]/structtemplater.go:161 StructTemplater.Template()
      --- at /go/pkg/mod/github.com/flanksource/gomplate/[email protected]/structtemplater.go:51 StructTemplater.StructField()
      --- at /go/pkg/mod/github.com/mitchellh/[email protected]/reflectwalk.go:387 walkStruct()
      --- at /go/pkg/mod/github.com/mitchellh/[email protected]/reflectwalk.go:206 walk()
      --- at /go/pkg/mod/github.com/mitchellh/[email protected]/reflectwalk.go:99 Walk()
      --- at /go/pkg/mod/github.com/flanksource/gomplate/[email protected]/structtemplater.go:121 StructTemplater.Walk()
      --- at /app/notification/shoutrrr.go:81 shoutrrrSend()
      --- at /app/notification/send.go:173 SendNotification()
      --- at /app/notification/send.go:135 sendEventNotification()
  time: '2024-09-24T10:36:26.333634785Z'
  trace: 01J8HSN5AXZEPE5GKX4MWH0NC4
hint: ''
  • add tests
@moshloop moshloop added the bug Something isn't working label Sep 24, 2024
@moshloop moshloop added this to the v1.0.0 milestone Sep 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants