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

Maybe a bug for jinja render? #21217

Closed
Colstuwjx opened this issue Mar 2, 2015 · 2 comments
Closed

Maybe a bug for jinja render? #21217

Colstuwjx opened this issue Mar 2, 2015 · 2 comments

Comments

@Colstuwjx
Copy link

Hi, I met a issue about jinja render problem, just like:

# sls content
{% set pool_name = pillar.get('pool') %}

zabbix-agentd_service:
    service.running:
      - name: {{ salt['cmd.run']('ls /etc/init.d/zabbix*agent* |cut -d"/" -f4') }}

#{% set pool_name = "test" %}
serverinfo:
  file.managed:
    - source: salt://basic/{{ pillar['pool'] }}_and_{{ pool_name }}/file/1.sh
    - mkdirs: True
    - name: /opt/1.sh
    - user: root
    - group: root
    - mode: 755
    - watch_in:
      - service: zabbix-agentd_service

You see, I just add '#' to the set block, but it still rendered, and finally it throw:

Comment: Source file salt://basic/Zabbix_and_test/file/1.sh not found

Pillar pool definitely is Zabbix, but jinja rendered it as test....
Thanks.

@tbaker57
Copy link
Contributor

tbaker57 commented Mar 2, 2015

The hash symbol '#' doesn't stop jinja rendering. For that you need

{# ... #}

cheers
Tim

@Colstuwjx
Copy link
Author

Ok, thanks

HowardMei added a commit to HowardMei/saltstack that referenced this issue Jun 14, 2015
…ream_develop

* 'develop' of https://github.com/saltstack/salt: (38161 commits)
  Add prefixable argument `state' for module.run
  Add names of prefixable module arguments in doc
  undo the memoization of contrived locale
  changed 'reload_modules' argument to 'refresh' in sync_all function
  changed 'reload_modules' argument to 'refresh' in sync_modules function Refs saltstack#24056
  2015.5.2 release changes Refs saltstack#24250 Refs saltstack#24457
  Fix doc example test that is failing on develop
  adding states/redismod unit test case.
  Add extra clarification why jinja comments are needed.
  Fix typo
  Add some documentation surrounding Jinja comments - refs saltstack#24492, saltstack#21217, saltstack#23359
  Fixed Mine example for jinja code block
  Move documentation into docstring instead of comments
  Assign 'return' to 'ret' if necessary in saltmod.function
  Convert keyword args to key=value strings in salt-ssh
  prefer shutdown timeout value in minutes on windows
  add purge option to aptpkg.autoremove
  Derp
  Fix unit test warnings
  MIssed a blank newline
  ...
HowardMei added a commit to HowardMei/saltstack that referenced this issue Jun 14, 2015
…ream_develop

* 'develop' of https://github.com/saltstack/salt: (23 commits)
  Fix docstrings
  Version added for show_pricing for GCE too
  Add versionadded to show_pricing function for digital ocean
  Linting
  Adding pricing information for GCE
  Add pricing data to digital_ocean
  Revert "fix target rule, remove unneeded quotation mark"
  Linting
  Deprecate the aws driver for Salt Cloud, in favor of ec2
  Fix virtualname
  Move GoGrid to a direct REST driver
  Add extra clarification why jinja comments are needed.
  Fix typo
  Add some documentation surrounding Jinja comments - refs saltstack#24492, saltstack#21217, saltstack#23359
  adding states/reg unit test case.
  fix target rule, remove unneeded quotation mark
  Adding some logging statement to give feedback when states, including highstate, are disabled.  Useful when running from scheduler.
  Add support for presence change of a locally connected minion
  fix pkg module integration tests on CentOS 5
  Normalize salt-ssh flat roster minion IDs to strings
  ...
HowardMei added a commit to HowardMei/saltstack that referenced this issue Jun 14, 2015
* release: (26 commits)
  develop: update .travis.yml to add notifications to slack devnotice channel
  develop: add skip_verify option to file.managed states module with a simple presetting trick
  develop: replace all saltstack bootstrap-salt.sh with github mubiic/saltstrap/master/bootstrap-salt.sh
  Fix docstrings
  Version added for show_pricing for GCE too
  Add versionadded to show_pricing function for digital ocean
  Linting
  Adding pricing information for GCE
  Add pricing data to digital_ocean
  Revert "fix target rule, remove unneeded quotation mark"
  Linting
  Deprecate the aws driver for Salt Cloud, in favor of ec2
  Fix virtualname
  Move GoGrid to a direct REST driver
  Add extra clarification why jinja comments are needed.
  Fix typo
  Add some documentation surrounding Jinja comments - refs saltstack#24492, saltstack#21217, saltstack#23359
  adding states/reg unit test case.
  fix target rule, remove unneeded quotation mark
  Adding some logging statement to give feedback when states, including highstate, are disabled.  Useful when running from scheduler.
  ...
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

2 participants