salt icon indicating copy to clipboard operation
salt copied to clipboard

Import map.jinja from gitfs_remotes (TemplateNotFound: salt://nginx/conf/map.jinja)

Open kislik opened this issue 8 years ago • 1 comments

Description of Issue/Question

Can i import variable inside state from map.jinja? If it store map.jinja in "salt://" path? BUT:

I use gitfs_remotes

gitfs_remotes:
    - ssh://[email protected]:8080/my-project/nginx.git:
      - base: master
      - mountpoint: salt://nginx

Setup

and i try execute in init.sls

{% from "salt://nginx/conf/map.jinja" import nginx %}

And i get

  File "/usr/lib/python2.7/dist-packages/salt/utils/jinja.py", line 135, in get_source
    raise TemplateNotFound(template)
TemplateNotFound: salt://nginxi/conf/map.jinja

Versions Report

2016.11.3+ds-1

kislik avatar Feb 07 '18 18:02 kislik

imports in jinja need to be full paths, they cannot be salt://paths.

If you want to use salt:// you will need to use cp.cache_file for that.

{% from salt.cp.cache_file('salt://nginx/conf/map.jinja') import nginx %}

gtmanfred avatar Feb 07 '18 18:02 gtmanfred