2

I am using Salt 2019.2.0 version and below is my state file where I am using if condition to check the values and run states if it's a match. Even if I have provided endif, it says Jinja looking for missing endif tag. Any help please?

CODE:

{% if salt['pillar.get']('spade:Corename') == 'FI' and salt['pillar.get']('spade:NodeType') == 'master' %}
dataimport-script:
  file.managed:
    - name: /opt/bin/DataImport.py
    - source: salt://files/DataImport.py

dataimport-crontab:
  file.managed:
    - name: /etc/cron.d/solr-dataimport
    - contents: |
                # # set up data import for FI every 2 minutes
                */2 * * * * root /usr/bin/python /opt/bin/DataImport.py
{% elif salt['pillar.get']('spade:NodeType') in ['slave','ds'] and salt['pillar.get']('spade:Corename') == 'FI' %}
update-fi-solrconfig:
  file.replace:
    - name: {{ salt['pillar.get']('solr:home_dir') }}/data/{{ salt['pillar.get']('spade:Corename') }}/conf/solrconfig.xml
    - pattern: '"autoDeletePeriodSeconds">30'
    - repl: '"autoDeletePeriodSeconds">-1'
{% endif %}

ERROR:

local:

Data failed to compile:
----------
Rendering SLS 'base:solr.install-solr' failed: Jinja syntax error: Unexpected end of template. Jinja was looking for the following tags: 'endif'. The innermost block that needs to be closed is 'if'.; line 205
---

[...]

update-fi-solrconfig:
file.replace:
- name: {{ salt['pillar.get']('solr:home_dir') }}/data/{{ salt['pillar.get']('spade:Corename') }}/conf/solrconfig.xml
- pattern: '"autoDeletePeriodSeconds">30'
- repl: '"autoDeletePeriodSeconds">-1'
{% endif %} <======================
  • The mismatch might have started in solr.install-solr as indicated in the error. – seshadri_c Sep 28 at 14:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.