Commit Graph

12 Commits

Author SHA1 Message Date
Imran Iqbal
3f6c4a05ac
test(_mapdata): add verification file for fedora-34 [skip ci] 2021-04-23 08:28:35 +01:00
Imran Iqbal
018a47cdd8
test(freebsd): add map.jinja verification file (for 13.0) 2021-04-19 23:35:26 +01:00
Imran Iqbal
286856058a
fix(openbsd): fix dig_pkg, avoid UsePAM & add verification file 2021-03-26 12:44:01 +00:00
Imran Iqbal
4c857fe071
test(freebsd): add map.jinja verification files (for 11.4 & 12.2) 2021-03-26 12:43:21 +00:00
Imran Iqbal
748ededc7a
test(_mapdata): add verification files for new platforms
* `fedora-33`
* `opensuse-tumbleweed`
* `oraclelinux-7`
* `oraclelinux-8`
* `gentoo-2-sysd`
* `gentoo-2-sysv`
2021-02-14 11:41:33 +00:00
Daniel Dehennin
1be0d8725a feat(map): use targeting like syntax for configuration
The `config_get_lookup` and `config_get` sources lack flexibility.

It's not easy to query several pillars and/or grains keys with the
actual system. And the query method is forced to `config.get` without
being configurable by the user.

We define a mechanism to select `map.jinja` sources with similar
notation as the salt targeting system.

The `map.jinja` file uses several sources where to lookup parameter
values. The list of sources can be modified by two files:

1. a global salt://parameters/map_jinja.yaml
2. a per formula salt://{{ tplroot }}/parameters/map_jinja.yaml.

Each source definition has the form `<TYPE>:<OPTION>@<KEY>` where
`<TYPE>` can be one of:

- `Y` to load values from YAML files, this is the default when no type
  is defined
- `C` to lookup values with `config.get`
- `G` to lookup values with `grains.get`
- `I` to lookup values with `pillar.get`

The YAML type option can define the query method to lookup the key
value to build the file name:

- `C` to query with `config.get`, this is the default when to query
  method is defined
- `G` to query with `grains.get`
- `I` to query with `pillar.get`

The `C`, `G` or `I` types can define the `SUB` option to store values
in the sub key `mapdata.<key>` instead of directly in `mapdata`.

Finally, the `<KEY>` describe what to lookup to either build the YAML
filename or gather values using one of the query method.

BREAKING CHANGE: the configuration `map_jinja:sources` is only
                 configurable with `salt://parameters/map_jinja.yaml`
		 and `salt://{{ tplroot }}/parameters/map_jinja.yaml`

BREAKING CHANGE: the `map_jinja:config_get_roots` is replaced by
                 compound like `map_jinja:sources`

BREAKING CHANGE: the two `config_get_lookup` and `config_get` are
                 replaced by `C@<tplroot>:lookup` and `C@<tplroot>`
		 sources
2021-01-11 17:31:22 +01:00
Imran Iqbal
37597e5b12
refactor(map): use top-level values: key in map.jinja dumps
* Semi-automated using https://github.com/myii/ssf-formula/pull/284
2020-12-23 16:42:23 +00:00
Daniel Dehennin
5e9033f500 test(inspec): _mapdata files should have tofs configuration 2020-09-27 20:16:39 +02:00
Daniel Dehennin
8cb31c6967 test(inspec): no more need to mangle mapdata for hostname
We force the hostname in `kitchen` so the `_mapdata` files can be
static.
2020-09-08 21:23:21 +02:00
Daniel Dehennin
ad4385b077 feat(map): config.get lookups from configurable roots
We avoid compatibility break with user pillars by looking up
configuration values using `config.get` in configurable roots.

We provide a new parameter `map_jinja:config_get_roots` in the formula
`parameters/defaults.yaml`to retrives values not only from
`tplroot=openssh` but from `sshd_config` and `ssh_config` too.

We need to update the `_mapdata` reference files to include the new
`map_jinja:config_get_roots`.
2020-07-31 12:59:33 +02:00
Daniel Dehennin
14e843ec2b fix(inspec): use the name _mapdata everywhere for coherency 2020-07-31 08:01:27 +02:00
Daniel Dehennin
0eafbd945c test(inspec): verify map.jinja dump
We store validated `map.jinja` dump under the profile `files`
directory to access them with `inspec.profile.file('filename')` to
validate the content of the generated mapdata file.

The YAML files contain a value specific to each minion, its hostname,
so we use string format to expand `%{hostname}`.

The `default` inspec profile need to depends on `share` to access the
`system` and `salt_minion` libraries.
2020-07-30 22:00:18 +02:00