question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

State in SLS is not formed as a list

See original GitHub issue

What can be wrong here? It work ok, when i try to hardcode state

State:

{% for service, args in pillar.get('xml',{}).items() %}
{{ service }}:
  ensure_value_true:
    xml.value_present:
        - name: {{ args['name'] }}
        - xpath: {{ args['xpath'] }}
        - value: {{ args['value'] }}

{% endfor %}

Pillar:

xml:
  MqHostName:
    value: 'mq.ext'
    xpath: './/MqHostName'
    name: 'C:\\PFEI\ExternalMqService\Configs\MqSettings.Ext.xml'

  MqPort:
    value: '2911'
    xpath: 'MqPort'
    name: 'C:\\PFEI\ExternalMqService\Configs\MqSettings.Ext.xml'

Error:

Data failed to compile:
----------
    State 'MqHostName' in SLS 'xml' is not formed as a list

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
noelmcloughlincommented, Jul 26, 2020

Good @Morozzko so this new error is just minor. Use state name ensure_value_true_{{ service }}: to avoid ID name collisions inside for loop. This is not salt issue just Jinja convention.

1reaction
max-arnoldcommented, Jul 26, 2020

Try the following command to troubleshoot just the Jinja statements without evaluating the resulting Yaml:

salt MINION slsutil.renderer default_renderer=jinja path=salt://xml.sls

Read more comments on GitHub >

github_iconTop Results From Across the Web

State in SLS file is not formed as a list - Stack Overflow
The salt-master is running on an Ubuntu box and the key is accepted. I'm new to salt! I've just put it through an...
Read more >
Getting state in sls is not formed as a list · Issue #21802 - GitHub
The reason being that your /var/www/kibana line, the way you have it, isn't formed as a list like the archive.extracted state is. If...
Read more >
The state "apache" in sls user-fix is not formed as a list
The state "apache" in sls user-fix is not formed as a list here is my init.sls file apache: pkg.installed: {% if grains['os'] ==...
Read more >
Cannot figure out how to use a formula without receiving 'The ...
Cannot figure out how to use a formula without receiving 'The state "formula" in sls formula is not formed as a list'. 775...
Read more >
How Do I Use Salt States? - Salt Project Documentation
The core of the Salt State system is the SLS, or SaLt State file. ... SLS files are therefore, in reality, just dictionaries,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found