-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(pillar): use static test/salt/pillar/top.sls
The kitchen-salt provisionner have the `pillars_from_directories` option to recusively copy directories under target pillar root. This has 3 advantages: - simplify `kitchen.yml` - manage pillar assignment with standard salt targetting mechanism, this avoid the dedicated `gentoo` suite (it could have been done from `kitchen.yml` itself by the way) - ease the test outside kitchen by running `salt-call` directly with `--pillar-root` like: ``` salt-call --local --id test-minion.example.net \ --file-root=template-formula/ \ --pillar-root=template-formula/test/salt/pillar/ \ state.show_sls TEMPLATE ``` * pillar.example: remove settings for testing purpose. * test/salt/pillar/top.sls: limit `gentoo` pillars based on `os_family` grain. * test/salt/pillar/defaults.sls: base pillar dedicated to tests. * kitchen.yml (suites): remove the now useless `gentoo` suite. Define `pillars_from_directories` to copy them under `pillar_root`. Remove useless `pillars_from_files`. * .gitlab-ci.yml: fix gentoo suite name * .gitignore: do not ignore test pillar `top.sls`
- Loading branch information
Showing
5 changed files
with
83 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# -*- coding: utf-8 -*- | ||
# vim: ft=yaml | ||
--- | ||
TEMPLATE: | ||
lookup: | ||
master: template-master | ||
# Just for testing purposes | ||
winner: lookup | ||
added_in_lookup: lookup_value | ||
|
||
# Using bash package and udev service as an example. This allows us to | ||
# test the template formula itself. You should set these parameters to | ||
# examples that make sense in the contexto of the formula you're writing. | ||
pkg: | ||
name: bash | ||
service: | ||
name: systemd-journald | ||
config: /etc/template-formula.conf | ||
|
||
tofs: | ||
# The files_switch key serves as a selector for alternative | ||
# directories under the formula files directory. See TOFS pattern | ||
# doc for more info. | ||
# Note: Any value not evaluated by `config.get` will be used literally. | ||
# This can be used to set custom paths, as many levels deep as required. | ||
files_switch: | ||
- any/path/can/be/used/here | ||
- id | ||
- roles | ||
- osfinger | ||
- os | ||
- os_family | ||
# All aspects of path/file resolution are customisable using the options below. | ||
# This is unnecessary in most cases; there are sensible defaults. | ||
# Default path: salt://< path_prefix >/< dirs.files >/< dirs.default > | ||
# I.e.: salt://TEMPLATE/files/default | ||
# path_prefix: template_alt | ||
# dirs: | ||
# files: files_alt | ||
# default: default_alt | ||
# The entries under `source_files` are prepended to the default source files | ||
# given for the state | ||
# source_files: | ||
# TEMPLATE-config-file-file-managed: | ||
# - 'example_alt.tmpl' | ||
# - 'example_alt.tmpl.jinja' | ||
|
||
# For testing purposes | ||
source_files: | ||
TEMPLATE-config-file-file-managed: | ||
- 'example.tmpl.jinja' | ||
TEMPLATE-subcomponent-config-file-file-managed: | ||
- 'subcomponent-example.tmpl.jinja' | ||
|
||
# Just for testing purposes | ||
winner: pillar | ||
added_in_pillar: pillar_value |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# -*- coding: utf-8 -*- | ||
# vim: ft=yaml | ||
--- | ||
base: | ||
'*': | ||
- defaults | ||
'os_family:Gentoo': | ||
- match: grain | ||
- gentoo | ||
'os:*': | ||
- define_roles | ||
... |