Skip to content

Jinjia problems #5

@AlexYangYu

Description

@AlexYangYu

Hi,
When I using the mysql.sls, the salt report an error.

the following code is the result from pillar.items command:
secrets:
----------
cinder:
----------
db_password:
stack
glance:
----------
db_password:
stack
keystone:
----------
db_password:
stack
nova:
----------
db_password:
stack

following code is the error meessage

vagrant@salt:~$ sudo salt '*' state.highstate
salt:

Data failed to compile:

Rendering SLS "base:mysql-server" failed: Jinja syntax error: expected token ':', got '}'; line 42

[...]
{% set accounts = ['keystone', 'nova', 'glance', 'cinder' ] %}
{% for user in accounts %}
{{ user }}:
mysql_user.present:
- host: "%"
- password: {{ pillar['secrets'][{{ user }}]['db_password'] } <======================
- require:
- pkg: mysql-server
- file.sed: /etc/mysql/my.cnf
- watch:
- service.restart: mysql

[...]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions