portainer / portainer

Making Docker and Kubernetes management easy.
https://www.portainer.io
zlib License
31.01k stars 2.48k forks source link

Trying to add a stack template with a repository with URL `ssh://` is failing #2124

Closed vboufleur closed 6 years ago

vboufleur commented 6 years ago

Bug description

Trying to add a stack template with a repository with URL ssh:// is failing with:

2018/08/02 23:30:44 Unable to parse templates file. Please review your template definition file.
2018/08/02 23:30:44 json: cannot unmarshal string into Go struct field Template.type of type portainer.TemplateType

Expected behavior Correct loadout of the template file. On portainer before last release version it was working with a repository url of https://. Then I changed the URL to a ssh:// one and updated portainer to latest and the error described above starts happening.

Steps to reproduce the issue:

Steps to reproduce the behavior:

  1. Start portainer with templates pointing to this: https://raw.githubusercontent.com/ipburger/portainer-apptemplate/master/portainer-app-template.json
  2. Check this error:
    2018/08/02 23:30:44 Unable to parse templates file. Please review your template definition file.
    2018/08/02 23:30:44 json: cannot unmarshal string into Go struct field Template.type of type portainer.TemplateType

Technical details:

deviantony commented 6 years ago

Hi @vboufleur

Please update your templates to the latest definition format: http://portainer.readthedocs.io/en/stable/templates.html

2018/08/02 23:30:44 Unable to parse templates file. Please review your template definition file.
2018/08/02 23:30:44 json: cannot unmarshal string into Go struct field Template.type of type portainer.TemplateType

This error is due to the fact that you need to use an integer for the type property. Note that external templates are not really supported at the moment in the 1.19.1, you might be interested in https://github.com/portainer/portainer/pull/2119 (which can be tested via portainer/portainer:pr2119).