Browse Source

Merge "Introduce template option for linux.system.file"

pull/173/head
mcp-jenkins 6 years ago
parent
commit
dd80ea394b
5 changed files with 28 additions and 1 deletions
  1. +8
    -0
      .kitchen.yml
  2. +8
    -0
      README.rst
  3. +4
    -0
      linux/system/file.sls
  4. +1
    -0
      tests/example/file_template.jinja
  5. +7
    -1
      tests/pillar/system_file.sls

+ 8
- 0
.kitchen.yml View File

pillars-from-files: pillars-from-files:
linux.sls: tests/pillar/system.sls linux.sls: tests/pillar/system.sls


- name: system_file
provisioner:
pillars-from-files:
linux.sls: tests/pillar/system_file.sls
pillars_from_directories:
- source: tests/example
dest: srv/salt/linux/files/test

# vim: ft=yaml sw=2 ts=2 sts=2 tw=125 # vim: ft=yaml sw=2 ts=2 sts=2 tw=125

+ 8
- 0
README.rst View File

name: /tmp/test.txt name: /tmp/test.txt
source: http://example.com/test.txt source: http://example.com/test.txt


linux:
system:
file:
test2:
name: /tmp/test2.txt
source: http://example.com/test2.jinja
template: jinja

Ensure presence of file by specifying its contents: Ensure presence of file by specifying its contents:


.. code-block:: yaml .. code-block:: yaml

+ 4
- 0
linux/system/file.sls View File

{%- else %} {%- else %}
- skip_verify: True - skip_verify: True
{%- endif %} {%- endif %}
{%- if file.template is defined %}
- template: {{ file.template }}
{%- endif %}
{%- elif file.contents is defined %} {%- elif file.contents is defined %}
- contents: {{ file.contents|yaml }} - contents: {{ file.contents|yaml }}
{%- elif file.contents_pillar is defined %} {%- elif file.contents_pillar is defined %}
{%- elif file.contents_grains is defined %} {%- elif file.contents_grains is defined %}
- contents_grains: {{ file.contents_grains }} - contents_grains: {{ file.contents_grains }}
{%- endif %} {%- endif %}

{%- endif %} {%- endif %}
{%- if file.name is defined %} {%- if file.name is defined %}
- name: {{ file.name }} - name: {{ file.name }}

+ 1
- 0
tests/example/file_template.jinja View File

foo{{ pillar["test"]["example"] }}

+ 7
- 1
tests/pillar/system_file.sls View File

mode: 700 mode: 700
dir_mode: 700 dir_mode: 700
encoding: utf-8 encoding: utf-8
makedirs: true
makedirs: true
test3:
name: /tmp/test3.txt
source: salt://linux/files/test/file_template.jinja
template: jinja
test:
example: "bar"

Loading…
Cancel
Save