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

[BUG] Unable to use formula loaded via GitFS at mountpoint #58435

Closed
centromere opened this issue Sep 11, 2020 · 3 comments
Closed

[BUG] Unable to use formula loaded via GitFS at mountpoint #58435

centromere opened this issue Sep 11, 2020 · 3 comments
Labels
won't-fix legitimate issue, but won't fix
Milestone

Comments

@centromere
Copy link

Description
When attempting to use the consul-formula formula via GitFS, the following error occurs:

    Data failed to compile:
----------
    Rendering SLS 'staging:formulas.consul.consul' failed: Jinja error: formulas/map.jinja
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/salt/utils/templates.py", line 400, in render_jinja_tmpl
    output = template.render(**decoded_context)
  File "/usr/lib/python3/dist-packages/jinja2/asyncsupport.py", line 76, in render
    return original_render(self, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/jinja2/environment.py", line 1008, in render
    return self.environment.handle_exception(exc_info, True)
  File "/usr/lib/python3/dist-packages/jinja2/environment.py", line 780, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/lib/python3/dist-packages/jinja2/_compat.py", line 37, in reraise
    raise value.with_traceback(tb)
  File "<template>", line 3, in <module>
  File "/usr/lib/python3/dist-packages/salt/utils/jinja.py", line 204, in get_source
    raise TemplateNotFound(template)
jinja2.exceptions.TemplateNotFound: formulas/map.jinja

; line 3

---
{%- set tplroot = tpldir.split('/')[0] %}
{%- if pillar.get('consul', {}).get('enabled', True) %}
{% from tplroot+"/map.jinja" import consul with context %}    <======================

Setup

salt-master config:

gitfs_remotes:
  - https://github.com/saltstack-formulas/consul-formula.git:
    - mountpoint: salt://formulas/consul
    - saltenv:
      - staging:
        - ref: v0.12.0

top.sls:

---
staging:
  '*':
    - formulas.consul.consul

Steps to Reproduce the behavior

  1. Configure as described above
  2. Run state.apply.

Expected behavior
The state is applied successfully.

Versions Report

salt --versions-report (Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)
Salt Version:
           Salt: 3001.1

Dependency Versions:
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: 2.7.3
      docker-py: Not Installed
          gitdb: Not Installed
      gitpython: Not Installed
         Jinja2: 2.10.1
        libgit2: 0.28.3
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.6.2
   mysql-python: Not Installed
      pycparser: Not Installed
       pycrypto: Not Installed
   pycryptodome: 3.6.1
         pygit2: 1.0.3
         Python: 3.8.2 (default, Jul 16 2020, 14:00:26)
   python-gnupg: 0.4.5
         PyYAML: 5.3.1
          PyZMQ: 18.1.1
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.5.3
            ZMQ: 4.3.2

System Versions:
           dist: ubuntu 20.04 focal
         locale: utf-8
        machine: x86_64
        release: 5.4.0-42-generic
         system: Linux
        version: Ubuntu 20.04 focal
@centromere centromere added the Bug broken, incorrect, or confusing behavior label Sep 11, 2020
@Ch3LL Ch3LL added info-needed waiting for more info and removed needs-triage labels Sep 15, 2020
@Ch3LL Ch3LL removed their assignment Sep 15, 2020
@Ch3LL
Copy link
Contributor

Ch3LL commented Sep 15, 2020

im inclined to say there is an issue with how you are referencing the state files in your top.sls file. I believe you need to be able to reference the states as consul similar to this: https://github.com/saltstack-formulas/consul-formula#available-states

ping @myii any solid ideas here? if not i can try to replicate here.

@centromere
Copy link
Author

@Ch3LL My suspicion is that there is no way to accomplish what I desire: formulas mounted in arbitrary directories.

@myii
Copy link
Contributor

myii commented Sep 21, 2020

My suspicion is that there is no way to accomplish what I desire: formulas mounted in arbitrary directories.

@centromere Your suspicion is correct. We haven't figured out a single method to cater for all situations, to make formulas completely portable. This whole issue goes into more detail but I'm linking to my comment there which gives a summary of where we're up to:

In the meantime, the official documentation is the way to go:

@sagetherage sagetherage added this to the Blocked milestone Sep 22, 2020
@sagetherage sagetherage added won't-fix legitimate issue, but won't fix and removed Bug broken, incorrect, or confusing behavior info-needed waiting for more info labels Sep 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
won't-fix legitimate issue, but won't fix
Projects
None yet
Development

No branches or pull requests

4 participants