Skip to content

jinja_trim_blocks and jinja_lstrip_blocks Seem to Break Formulas #35398

@bnied

Description

@bnied

Description of Issue/Question

When using our in-house Salt tree, jinja_trim_blocks and jinja_lstrip_blocks both work without issue. However, if I then enable a GitFS-backed Saltstack formula, things start breaking spectacularly.

For example, when trying to use the users-formula, if you have jinja_trim_blocks enabled:

local:
    - Rendering SLS 'base:users' failed: sequence entries are not allowed here; line 2

      ---
      # vim: sts=2 ts=2 sw=2 et ai
      include:  - users.sudo    <======================

      users_new-user_adm_group:
        group.present:
          - name: new-group
      users_new-user_staff_group:
      [...]
      ---

(please note that the dash in the user and group aren't present in the actual user or group)

Alternatively, when jinja_lstrip_blocks is enabled:

local:
    - Rendering SLS 'base:users' failed: while parsing a block mapping
        in "<unicode string>", line 6, column 1:
          include:
          ^
      expected <block end>, but found '-'
        in "<unicode string>", line 51, column 1:
          - uid: 1111
          ^

Removing these two options allow the Salt Formulas to work normally.

Setup

  • Have the following present in /etc/salt/master:
jinja_trim_blocks: True
jinja_lstrip_blocks: True
  • Also include a Saltstack Formula via Git (I've seen this issue with users and hostsfile for sure):
gitfs_remotes:
  - https://github.com/saltstack-formulas/hostsfile-formula.git
  - https://github.com/saltstack-formulas/users-formula.git

Steps to Reproduce Issue

Run Salt after configuring as noted above.

Versions Report

Salt Version:
           Salt: 2016.3.2

Dependency Versions:
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: 1.5
          gitdb: 0.5.4
      gitpython: 0.3.2 RC1
          ioflo: Not Installed
         Jinja2: 2.7.2
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: 0.9.1
   msgpack-pure: Not Installed
 msgpack-python: 0.3.0
   mysql-python: 1.2.3
      pycparser: Not Installed
       pycrypto: 2.6.1
         pygit2: Not Installed
         Python: 2.7.6 (default, Jun 22 2015, 17:58:13)
   python-gnupg: 0.3.6
         PyYAML: 3.10
          PyZMQ: 14.0.1
           RAET: Not Installed
          smmap: 0.8.2
        timelib: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.0.5

System Versions:
           dist: Ubuntu 14.04 trusty
        machine: x86_64
        release: 3.13.0-91-generic
         system: Linux
        version: Ubuntu 14.04 trusty

Master and all minions are running the same version.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Featurenew functionality including changes to functionality and code refactors, etc.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions