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

Feature Request: improve error messages when parsing snippets #55

Open
lgo opened this issue Jul 9, 2024 · 0 comments
Open

Feature Request: improve error messages when parsing snippets #55

lgo opened this issue Jul 9, 2024 · 0 comments

Comments

@lgo
Copy link

lgo commented Jul 9, 2024

I've sort of hit two problems.

  1. I was getting an error which doesn't have any logs for the snippet or context making it hard to pin down.
WARN [kuma_client::util] Error while parsing snippet arguments: expected value at line 1 column 27
  1. I had a snippet argument that wasn't valid JSON but was expected to be correct.
- 'kuma.__internal_web_app={ "port": 32400, "path": /web }'

Which had a mistake with /web not wrapped in quotes, so it's not valid JSON.

For posterity, this was my snippet

      AUTOKUMA__SNIPPETS__INTERNAL_WEB_APP: |-
        {% set args = args[0] %}
        {% if args.path %}
          {% set path = args.path %}
        {% else %}
          {% set path = '/' %}
        {% endif %}
        {{ container_name }}.group.name: {{ container_name }} App
        {{ container_name }}-http.http.name: {{ container_name }} Internal
        {{ container_name }}-http.http.parent_name: {{ container_name }}
        {{ container_name }}-http.http.url: http://{{ container_name }}:{{ args.port }}{{ path }}
        {% if args.status_code %}
          {{ container_name }}-http.http.status_code: {{ args.status_code }}
        {% endif %}
        {{ container_name }}-docker.docker.name: {{ container_name }} Docker
        {{ container_name }}-docker.docker.parent_name: {{ container_name }}
        {{ container_name }}-docker.docker.docker_container: {{ container_name }}
        {{ container_name }}-docker.docker.docker_host: 1
        {{ container_name }}-https.http.name: {{ container_name }} Web
        {{ container_name }}-https.http.parent_name: {{ container_name }}
        {{ container_name }}-https.http.url: https://{{ container_name }}.<x>.<y>{{ path }}
        {% if args.status_code %}
          {{ container_name }}-https.http.status_code: {{ args.status_code }}
        {% endif %}

btw, I absolutely love autokuma! It's helped me really shore up 50+ homelab containers while I migrated everything to a template with container-oriented definitions.

@BigBoot BigBoot changed the title Snippet error without provenance; unclear error for bad value Feature Request: improve error messages when parsing snippets Jul 13, 2024
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