Commit Graph

424 Commits

Author SHA1 Message Date
Daniel Dehennin
568bb7ce40 refactor(map): load map.jinja configuration with libmapstack 2021-01-11 17:47:50 +01:00
Daniel Dehennin
d69556d5ae feat(matchers): add delimiter option for source definitions 2021-01-11 17:47:11 +01:00
Daniel Dehennin
925c86ea69 refactor(map): compound matchers like parsing with libmatchers 2021-01-11 17:41:20 +01:00
Daniel Dehennin
7ecb24bdc1 docs(map): document the new map.jinja with targeting like syntax 2021-01-11 17:33:25 +01: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
semantic-release-bot
b9b8eb7618 chore(release): 2.0.6 [skip ci]
## [2.0.6](https://github.com/saltstack-formulas/openssh-formula/compare/v2.0.5...v2.0.6) (2020-12-23)

### Code Refactoring

* **map:** use top-level `values:` key in `map.jinja` dumps ([37597e5](37597e5b12))
2020-12-23 18:51:37 +00:00
Imran Iqbal
e246937ebe
Merge pull request #197 from myii/refactor/use-top-level-values-in-map-jinja-dumps
refactor(map): use top-level `values:` key in `map.jinja` dumps
2020-12-23 18:46:05 +00: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
semantic-release-bot
f941871f0b chore(release): 2.0.5 [skip ci]
## [2.0.5](https://github.com/saltstack-formulas/openssh-formula/compare/v2.0.4...v2.0.5) (2020-12-22)

### Continuous Integration

* **commitlint:** ensure `upstream/master` uses main repo URL [skip ci] ([7af3bf2](7af3bf255d))
* **gitlab-ci:** add `rubocop` linter (with `allow_failure`) [skip ci] ([37b9f3a](37b9f3ac09))
* **gitlab-ci:** use GitLab CI as Travis CI replacement ([bccd5fd](bccd5fd3d8))
* **pre-commit:** add to formula [skip ci] ([4e13609](4e13609b99))
* **pre-commit:** enable/disable `rstcheck` as relevant [skip ci] ([094bef5](094bef5406))
* **pre-commit:** finalise `rstcheck` configuration [skip ci] ([75e843a](75e843a7bd))

### Tests

* **map:** standardise `map.jinja` verification ([2bab68f](2bab68f5ff))
2020-12-22 12:42:26 +00:00
Imran Iqbal
a7d9ae2dc1
Merge pull request #193 from myii/test/compare-mapdata-using-yaml
test(map): standardise `map.jinja` verification
2020-12-22 12:35:21 +00:00
Imran Iqbal
2bab68f5ff
test(map): standardise map.jinja verification
* Automated using https://github.com/myii/ssf-formula/pull/281
2020-12-22 00:43:03 +00:00
Imran Iqbal
7af3bf255d
ci(commitlint): ensure upstream/master uses main repo URL [skip ci]
* Automated using https://github.com/myii/ssf-formula/pull/278
2020-12-20 18:48:17 +00:00
Imran Iqbal
37b9f3ac09
ci(gitlab-ci): add rubocop linter (with allow_failure) [skip ci]
* Automated using https://github.com/myii/ssf-formula/pull/277
2020-12-19 14:33:53 +00:00
Imran Iqbal
bccd5fd3d8
ci(gitlab-ci): use GitLab CI as Travis CI replacement
* Automated using https://github.com/myii/ssf-formula/pull/275
2020-12-16 06:37:42 +00:00
Imran Iqbal
3f5dba1102
chore(gemfile+lock): update to latest gem versions (2020-W44) [skip ci]
* Automated using https://github.com/myii/ssf-formula/pull/274
2020-10-26 22:52:18 +00:00
Imran Iqbal
97c2ebf8f3
chore(gemfile+lock): update to latest gem versions (2020-W43) [skip ci]
* Automated using https://github.com/myii/ssf-formula/pull/273
2020-10-20 10:20:20 +01:00
Imran Iqbal
75e843a7bd
ci(pre-commit): finalise rstcheck configuration [skip ci]
* Automated using https://github.com/myii/ssf-formula/pull/267
2020-10-10 06:50:27 +01:00
Dafydd Jones
340cc0abe7
chore(commitlint): add {body,footer,header}-max(-line)-length [skip ci]
* Automated using https://github.com/myii/ssf-formula/pull/265
2020-10-07 09:08:31 +01:00
Imran Iqbal
4d49d24490
chore(gemfile+lock): update to latest gem versions (2020-W41) [skip ci]
* Automated using https://github.com/myii/ssf-formula/pull/263
2020-10-07 00:06:49 +01:00
Imran Iqbal
094bef5406
ci(pre-commit): enable/disable rstcheck as relevant [skip ci]
* Automated using https://github.com/myii/ssf-formula/pull/262
2020-10-05 00:22:59 +01:00
Dafydd Jones
4e13609b99
ci(pre-commit): add to formula [skip ci]
* Automated using https://github.com/myii/ssf-formula/pull/259
2020-10-03 10:51:35 +01:00
semantic-release-bot
1c3a6b8ab8 chore(release): 2.0.4 [skip ci]
## [2.0.4](https://github.com/saltstack-formulas/openssh-formula/compare/v2.0.3...v2.0.4) (2020-09-27)

### Bug Fixes

* **pillar:** `tofs` must not be under `mine_functions` ([c0d5052](c0d5052f6a))

### Tests

* **inspec:** `_mapdata` files should have `tofs` configuration ([5e9033f](5e9033f500))
2020-09-27 19:27:45 +00:00
Imran Iqbal
91bc8bebe4
Merge pull request #196 from baby-gnu/fix/tofs-pillars
fix(pillar): `tofs` must not be under `mine_functions`
2020-09-27 20:19:15 +01:00
Daniel Dehennin
c0d5052f6a fix(pillar): tofs must not be under mine_functions
The debug output of test jobs don't show the use of TOFS as it should
and the pillar.example show that `tofs` is under `mine_functions`
instead of `openssh`.

* pillar.example: move `tofs` under `openssh`.

* test/salt/pillar/default.sls: ditoo.
2020-09-27 20:17:05 +02:00
Daniel Dehennin
5e9033f500 test(inspec): _mapdata files should have tofs configuration 2020-09-27 20:16:39 +02:00
Imran Iqbal
9576b72eb2
chore(inspec): fix typo [skip ci]
* https://github.com/myii/ssf-formula/commit/839898aedb34
2020-09-10 01:31:20 +01:00
semantic-release-bot
91d4b0d6ea chore(release): 2.0.3 [skip ci]
## [2.0.3](https://github.com/saltstack-formulas/openssh-formula/compare/v2.0.2...v2.0.3) (2020-09-09)

### Continuous Integration

* **kitchen:** force the hostname of the containers ([208f873](208f87380c))

### Tests

* **inspec:** no more need to mangle mapdata for hostname ([8cb31c6](8cb31c6967))
* **share:** standardise structure ([15241d3](15241d39c5))
2020-09-09 11:49:58 +00:00
Imran Iqbal
cf9abf5e5a
Merge pull request #195 from baby-gnu/ci/force-hostname
test(inspec): use static hostname in mapdata
2020-09-09 12:41:22 +01:00
Imran Iqbal
15241d39c5
test(share): standardise structure
* Standardised using https://github.com/myii/ssf-formula/pull/251
2020-09-09 12:31:49 +01: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
208f87380c ci(kitchen): force the hostname of the containers 2020-09-08 18:25:35 +02:00
semantic-release-bot
b49824b343 chore(release): 2.0.2 [skip ci]
## [2.0.2](https://github.com/saltstack-formulas/openssh-formula/compare/v2.0.1...v2.0.2) (2020-08-26)

### Tests

* **inspec:** display proper diff when `_mapdata` mismatch ([1c99556](1c99556695))
2020-08-26 14:40:48 +00:00
Imran Iqbal
a472db6913
Merge pull request #192 from baby-gnu/test/mapdata-proper-inspec-diff
test(inspec): display proper diff when `_mapdata` mismatch
2020-08-26 15:29:50 +01:00
Daniel Dehennin
1c99556695 test(inspec): display proper diff when _mapdata mismatch
The use of `eq` instead of `include` premits to have a nice diff after
the `expected/got` oneliners.
2020-08-26 10:06:13 +02:00
semantic-release-bot
34a9c8f703 chore(release): 2.0.1 [skip ci]
## [2.0.1](https://github.com/saltstack-formulas/openssh-formula/compare/v2.0.0...v2.0.1) (2020-08-21)

### Bug Fixes

* **map:** `path_join` can be used only for local file access ([3845d5f](3845d5ff61))
2020-08-21 16:41:46 +00:00
Javier Bértoli
27c527a172
Merge pull request #190 from baby-gnu/fix/no-path_join-for-salt-url
fix(map): `path_join` can be used only for local file access
2020-08-21 13:34:11 -03:00
Daniel Dehennin
3845d5ff61 fix(map): path_join can be used only for local file access
On windows machines, the `path_join` build wrong URL by using
backslash as separator.

URL used for fileserver access must use only slashes `/`.
2020-08-21 16:00:56 +02:00
semantic-release-bot
b32ec9819c chore(release): 2.0.0 [skip ci]
# [2.0.0](https://github.com/saltstack-formulas/openssh-formula/compare/v1.3.1...v2.0.0) (2020-08-01)

### Features

* **map:** `config.get` lookups from configurable roots ([ad4385b](ad4385b077))
* **map:** update to v4 “map.jinja” ([df477b2](df477b25c2))
2020-08-01 13:59:26 +00:00
Imran Iqbal
db67ce6f42
Merge pull request #186 from baby-gnu/feature/v4-map.jinja
feat(map): update to v4 and add config.get lookup from multiple roots
2020-08-01 14:51:21 +01:00
Imran Iqbal
a0af21a996
chore: add breaking change message for new map.jinja
BREAKING CHANGE: `map.jinja` has been upgraded from using `pillar.get`
to `config.get`.
2020-08-01 14:26:07 +01: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
df477b25c2 feat(map): update to v4 “map.jinja”
The `map.jinja` now exports a single variable called `mapdata`.

We extract the `openssh`, `sshd_config` and `ssh_config` from it to
minimize the changes to `.sls` files.
2020-07-31 10:54:40 +02:00
semantic-release-bot
a8cd7370df chore(release): 1.3.1 [skip ci]
## [1.3.1](https://github.com/saltstack-formulas/openssh-formula/compare/v1.3.0...v1.3.1) (2020-07-31)

### Bug Fixes

* **inspec:** use the name `_mapdata` everywhere for coherency ([14e843e](14e843ec2b))
2020-07-31 06:19:53 +00:00
Imran Iqbal
94a12d86d9
Merge pull request #189 from baby-gnu/fix/rename-mapdata-test-directory
fix(inspec): use the name `_mapdata` everywhere for coherency
2020-07-31 07:11:50 +01:00
Daniel Dehennin
14e843ec2b fix(inspec): use the name _mapdata everywhere for coherency 2020-07-31 08:01:27 +02:00
semantic-release-bot
9f3c2f2686 chore(release): 1.3.0 [skip ci]
# [1.3.0](https://github.com/saltstack-formulas/openssh-formula/compare/v1.2.2...v1.3.0) (2020-07-30)

### Continuous Integration

* **kitchen:** execute `_mapdata` state ([70389b5](70389b5964))

### Features

* **map:** generate a YAML file to validate `map.jinja` ([e4ab335](e4ab335077))

### Tests

* **inspec:** share library to access some minion informations ([a8d61f4](a8d61f4307))
* **inspec:** verify `map.jinja` dump ([0eafbd9](0eafbd945c))
2020-07-30 23:39:55 +00:00
Imran Iqbal
5e2fa1a5e6
Merge pull request #187 from baby-gnu/ci/validate_map.jinja
Ci/validate map.jinja
2020-07-31 00:31:34 +01:00
Daniel Dehennin
e4ab335077 feat(map): generate a YAML file to validate map.jinja
We provide a new `_mapdata` state which generate a
`/tmp/salt_mapdata_dump.yaml` to be validated by `Inspec`.
2020-07-30 22:05:24 +02:00
Daniel Dehennin
70389b5964 ci(kitchen): execute _mapdata state 2020-07-30 22:02:10 +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