From 41d222e30c0da10fabeea23a7ab2886f02ea6479 Mon Sep 17 00:00:00 2001 From: Daniel Dehennin Date: Mon, 15 Feb 2021 16:28:47 +0100 Subject: [PATCH 1/2] fix(inspec): validate `map.jinja` configuration Update `_mapdata` reference files to include the `map.jinja` configuration sources. --- .../default/files/_mapdata/amazonlinux-1.yaml | 9 +++++++++ .../default/files/_mapdata/amazonlinux-2.yaml | 9 +++++++++ .../default/files/_mapdata/arch-base-latest.yaml | 9 +++++++++ test/integration/default/files/_mapdata/centos-6.yaml | 9 +++++++++ test/integration/default/files/_mapdata/centos-7.yaml | 9 +++++++++ test/integration/default/files/_mapdata/centos-8.yaml | 9 +++++++++ test/integration/default/files/_mapdata/debian-10.yaml | 9 +++++++++ test/integration/default/files/_mapdata/debian-9.yaml | 9 +++++++++ test/integration/default/files/_mapdata/fedora-31.yaml | 9 +++++++++ test/integration/default/files/_mapdata/fedora-32.yaml | 9 +++++++++ test/integration/default/files/_mapdata/fedora-33.yaml | 9 +++++++++ .../default/files/_mapdata/gentoo-2-sysd.yaml | 9 +++++++++ .../default/files/_mapdata/gentoo-2-sysv.yaml | 9 +++++++++ test/integration/default/files/_mapdata/opensuse-15.yaml | 9 +++++++++ .../default/files/_mapdata/opensuse-tumbleweed.yaml | 9 +++++++++ .../default/files/_mapdata/oraclelinux-7.yaml | 9 +++++++++ .../default/files/_mapdata/oraclelinux-8.yaml | 9 +++++++++ test/integration/default/files/_mapdata/ubuntu-16.yaml | 9 +++++++++ test/integration/default/files/_mapdata/ubuntu-18.yaml | 9 +++++++++ test/integration/default/files/_mapdata/ubuntu-20.yaml | 9 +++++++++ 20 files changed, 180 insertions(+) diff --git a/test/integration/default/files/_mapdata/amazonlinux-1.yaml b/test/integration/default/files/_mapdata/amazonlinux-1.yaml index 75b27495..5e9a51da 100644 --- a/test/integration/default/files/_mapdata/amazonlinux-1.yaml +++ b/test/integration/default/files/_mapdata/amazonlinux-1.yaml @@ -11,6 +11,15 @@ values: added_in_lookup: lookup_value master: template-master winner: lookup + map_jinja: + sources: + - Y:G@osarch + - Y:G@os_family + - Y:G@os + - Y:G@osfinger + - C@TEMPLATE:lookup + - C@TEMPLATE + - Y:G@id master: template-master pkg: name: cronie diff --git a/test/integration/default/files/_mapdata/amazonlinux-2.yaml b/test/integration/default/files/_mapdata/amazonlinux-2.yaml index d5bc0e28..72cc0795 100644 --- a/test/integration/default/files/_mapdata/amazonlinux-2.yaml +++ b/test/integration/default/files/_mapdata/amazonlinux-2.yaml @@ -11,6 +11,15 @@ values: added_in_lookup: lookup_value master: template-master winner: lookup + map_jinja: + sources: + - Y:G@osarch + - Y:G@os_family + - Y:G@os + - Y:G@osfinger + - C@TEMPLATE:lookup + - C@TEMPLATE + - Y:G@id master: template-master pkg: name: bash diff --git a/test/integration/default/files/_mapdata/arch-base-latest.yaml b/test/integration/default/files/_mapdata/arch-base-latest.yaml index 433b490e..f229d778 100644 --- a/test/integration/default/files/_mapdata/arch-base-latest.yaml +++ b/test/integration/default/files/_mapdata/arch-base-latest.yaml @@ -11,6 +11,15 @@ values: added_in_lookup: lookup_value master: template-master winner: lookup + map_jinja: + sources: + - Y:G@osarch + - Y:G@os_family + - Y:G@os + - Y:G@osfinger + - C@TEMPLATE:lookup + - C@TEMPLATE + - Y:G@id master: template-master pkg: name: bash diff --git a/test/integration/default/files/_mapdata/centos-6.yaml b/test/integration/default/files/_mapdata/centos-6.yaml index 7fa6f170..e483d0de 100644 --- a/test/integration/default/files/_mapdata/centos-6.yaml +++ b/test/integration/default/files/_mapdata/centos-6.yaml @@ -11,6 +11,15 @@ values: added_in_lookup: lookup_value master: template-master winner: lookup + map_jinja: + sources: + - Y:G@osarch + - Y:G@os_family + - Y:G@os + - Y:G@osfinger + - C@TEMPLATE:lookup + - C@TEMPLATE + - Y:G@id master: template-master pkg: name: cronie diff --git a/test/integration/default/files/_mapdata/centos-7.yaml b/test/integration/default/files/_mapdata/centos-7.yaml index 4857fa5c..cbb0b4f1 100644 --- a/test/integration/default/files/_mapdata/centos-7.yaml +++ b/test/integration/default/files/_mapdata/centos-7.yaml @@ -11,6 +11,15 @@ values: added_in_lookup: lookup_value master: template-master winner: lookup + map_jinja: + sources: + - Y:G@osarch + - Y:G@os_family + - Y:G@os + - Y:G@osfinger + - C@TEMPLATE:lookup + - C@TEMPLATE + - Y:G@id master: template-master pkg: name: bash diff --git a/test/integration/default/files/_mapdata/centos-8.yaml b/test/integration/default/files/_mapdata/centos-8.yaml index 2ca293e1..b964150f 100644 --- a/test/integration/default/files/_mapdata/centos-8.yaml +++ b/test/integration/default/files/_mapdata/centos-8.yaml @@ -11,6 +11,15 @@ values: added_in_lookup: lookup_value master: template-master winner: lookup + map_jinja: + sources: + - Y:G@osarch + - Y:G@os_family + - Y:G@os + - Y:G@osfinger + - C@TEMPLATE:lookup + - C@TEMPLATE + - Y:G@id master: template-master pkg: name: bash diff --git a/test/integration/default/files/_mapdata/debian-10.yaml b/test/integration/default/files/_mapdata/debian-10.yaml index 53672d90..cde07705 100644 --- a/test/integration/default/files/_mapdata/debian-10.yaml +++ b/test/integration/default/files/_mapdata/debian-10.yaml @@ -11,6 +11,15 @@ values: added_in_lookup: lookup_value master: template-master winner: lookup + map_jinja: + sources: + - Y:G@osarch + - Y:G@os_family + - Y:G@os + - Y:G@osfinger + - C@TEMPLATE:lookup + - C@TEMPLATE + - Y:G@id master: template-master pkg: name: bash diff --git a/test/integration/default/files/_mapdata/debian-9.yaml b/test/integration/default/files/_mapdata/debian-9.yaml index 0e5b7b6a..bf5aae93 100644 --- a/test/integration/default/files/_mapdata/debian-9.yaml +++ b/test/integration/default/files/_mapdata/debian-9.yaml @@ -11,6 +11,15 @@ values: added_in_lookup: lookup_value master: template-master winner: lookup + map_jinja: + sources: + - Y:G@osarch + - Y:G@os_family + - Y:G@os + - Y:G@osfinger + - C@TEMPLATE:lookup + - C@TEMPLATE + - Y:G@id master: template-master pkg: name: bash diff --git a/test/integration/default/files/_mapdata/fedora-31.yaml b/test/integration/default/files/_mapdata/fedora-31.yaml index 39967350..a36a2fad 100644 --- a/test/integration/default/files/_mapdata/fedora-31.yaml +++ b/test/integration/default/files/_mapdata/fedora-31.yaml @@ -11,6 +11,15 @@ values: added_in_lookup: lookup_value master: template-master winner: lookup + map_jinja: + sources: + - Y:G@osarch + - Y:G@os_family + - Y:G@os + - Y:G@osfinger + - C@TEMPLATE:lookup + - C@TEMPLATE + - Y:G@id master: template-master pkg: name: bash diff --git a/test/integration/default/files/_mapdata/fedora-32.yaml b/test/integration/default/files/_mapdata/fedora-32.yaml index 6c353a4d..4aac6c12 100644 --- a/test/integration/default/files/_mapdata/fedora-32.yaml +++ b/test/integration/default/files/_mapdata/fedora-32.yaml @@ -11,6 +11,15 @@ values: added_in_lookup: lookup_value master: template-master winner: lookup + map_jinja: + sources: + - Y:G@osarch + - Y:G@os_family + - Y:G@os + - Y:G@osfinger + - C@TEMPLATE:lookup + - C@TEMPLATE + - Y:G@id master: template-master pkg: name: bash diff --git a/test/integration/default/files/_mapdata/fedora-33.yaml b/test/integration/default/files/_mapdata/fedora-33.yaml index fc032398..9508dd33 100644 --- a/test/integration/default/files/_mapdata/fedora-33.yaml +++ b/test/integration/default/files/_mapdata/fedora-33.yaml @@ -11,6 +11,15 @@ values: added_in_lookup: lookup_value master: template-master winner: lookup + map_jinja: + sources: + - Y:G@osarch + - Y:G@os_family + - Y:G@os + - Y:G@osfinger + - C@TEMPLATE:lookup + - C@TEMPLATE + - Y:G@id master: template-master pkg: name: bash diff --git a/test/integration/default/files/_mapdata/gentoo-2-sysd.yaml b/test/integration/default/files/_mapdata/gentoo-2-sysd.yaml index cc3703d2..05e6ed59 100644 --- a/test/integration/default/files/_mapdata/gentoo-2-sysd.yaml +++ b/test/integration/default/files/_mapdata/gentoo-2-sysd.yaml @@ -11,6 +11,15 @@ values: added_in_lookup: lookup_value master: template-master winner: lookup + map_jinja: + sources: + - Y:G@osarch + - Y:G@os_family + - Y:G@os + - Y:G@osfinger + - C@TEMPLATE:lookup + - C@TEMPLATE + - Y:G@id master: template-master pkg: name: app-shells/bash diff --git a/test/integration/default/files/_mapdata/gentoo-2-sysv.yaml b/test/integration/default/files/_mapdata/gentoo-2-sysv.yaml index 46596ef9..84b4fb9b 100644 --- a/test/integration/default/files/_mapdata/gentoo-2-sysv.yaml +++ b/test/integration/default/files/_mapdata/gentoo-2-sysv.yaml @@ -11,6 +11,15 @@ values: added_in_lookup: lookup_value master: template-master winner: lookup + map_jinja: + sources: + - Y:G@osarch + - Y:G@os_family + - Y:G@os + - Y:G@osfinger + - C@TEMPLATE:lookup + - C@TEMPLATE + - Y:G@id master: template-master pkg: name: app-shells/bash diff --git a/test/integration/default/files/_mapdata/opensuse-15.yaml b/test/integration/default/files/_mapdata/opensuse-15.yaml index 1a17ade5..7a52c398 100644 --- a/test/integration/default/files/_mapdata/opensuse-15.yaml +++ b/test/integration/default/files/_mapdata/opensuse-15.yaml @@ -11,6 +11,15 @@ values: added_in_lookup: lookup_value master: template-master winner: lookup + map_jinja: + sources: + - Y:G@osarch + - Y:G@os_family + - Y:G@os + - Y:G@osfinger + - C@TEMPLATE:lookup + - C@TEMPLATE + - Y:G@id master: template-master pkg: name: bash diff --git a/test/integration/default/files/_mapdata/opensuse-tumbleweed.yaml b/test/integration/default/files/_mapdata/opensuse-tumbleweed.yaml index a693bbf9..dffde67f 100644 --- a/test/integration/default/files/_mapdata/opensuse-tumbleweed.yaml +++ b/test/integration/default/files/_mapdata/opensuse-tumbleweed.yaml @@ -11,6 +11,15 @@ values: added_in_lookup: lookup_value master: template-master winner: lookup + map_jinja: + sources: + - Y:G@osarch + - Y:G@os_family + - Y:G@os + - Y:G@osfinger + - C@TEMPLATE:lookup + - C@TEMPLATE + - Y:G@id master: template-master pkg: name: bash diff --git a/test/integration/default/files/_mapdata/oraclelinux-7.yaml b/test/integration/default/files/_mapdata/oraclelinux-7.yaml index 7890d25a..4eae50df 100644 --- a/test/integration/default/files/_mapdata/oraclelinux-7.yaml +++ b/test/integration/default/files/_mapdata/oraclelinux-7.yaml @@ -11,6 +11,15 @@ values: added_in_lookup: lookup_value master: template-master winner: lookup + map_jinja: + sources: + - Y:G@osarch + - Y:G@os_family + - Y:G@os + - Y:G@osfinger + - C@TEMPLATE:lookup + - C@TEMPLATE + - Y:G@id master: template-master pkg: name: bash diff --git a/test/integration/default/files/_mapdata/oraclelinux-8.yaml b/test/integration/default/files/_mapdata/oraclelinux-8.yaml index 7096b63e..40f09bbb 100644 --- a/test/integration/default/files/_mapdata/oraclelinux-8.yaml +++ b/test/integration/default/files/_mapdata/oraclelinux-8.yaml @@ -11,6 +11,15 @@ values: added_in_lookup: lookup_value master: template-master winner: lookup + map_jinja: + sources: + - Y:G@osarch + - Y:G@os_family + - Y:G@os + - Y:G@osfinger + - C@TEMPLATE:lookup + - C@TEMPLATE + - Y:G@id master: template-master pkg: name: bash diff --git a/test/integration/default/files/_mapdata/ubuntu-16.yaml b/test/integration/default/files/_mapdata/ubuntu-16.yaml index 309d67f2..83c9f8bf 100644 --- a/test/integration/default/files/_mapdata/ubuntu-16.yaml +++ b/test/integration/default/files/_mapdata/ubuntu-16.yaml @@ -11,6 +11,15 @@ values: added_in_lookup: lookup_value master: template-master winner: lookup + map_jinja: + sources: + - Y:G@osarch + - Y:G@os_family + - Y:G@os + - Y:G@osfinger + - C@TEMPLATE:lookup + - C@TEMPLATE + - Y:G@id master: template-master pkg: name: bash diff --git a/test/integration/default/files/_mapdata/ubuntu-18.yaml b/test/integration/default/files/_mapdata/ubuntu-18.yaml index 0de12bcc..86a231b5 100644 --- a/test/integration/default/files/_mapdata/ubuntu-18.yaml +++ b/test/integration/default/files/_mapdata/ubuntu-18.yaml @@ -11,6 +11,15 @@ values: added_in_lookup: lookup_value master: template-master winner: lookup + map_jinja: + sources: + - Y:G@osarch + - Y:G@os_family + - Y:G@os + - Y:G@osfinger + - C@TEMPLATE:lookup + - C@TEMPLATE + - Y:G@id master: template-master pkg: name: bash diff --git a/test/integration/default/files/_mapdata/ubuntu-20.yaml b/test/integration/default/files/_mapdata/ubuntu-20.yaml index 5c570ca9..cc565823 100644 --- a/test/integration/default/files/_mapdata/ubuntu-20.yaml +++ b/test/integration/default/files/_mapdata/ubuntu-20.yaml @@ -11,6 +11,15 @@ values: added_in_lookup: lookup_value master: template-master winner: lookup + map_jinja: + sources: + - Y:G@osarch + - Y:G@os_family + - Y:G@os + - Y:G@osfinger + - C@TEMPLATE:lookup + - C@TEMPLATE + - Y:G@id master: template-master pkg: name: bash From 42e19322c9c4d91a6cfa1e406723b5a799f33f80 Mon Sep 17 00:00:00 2001 From: Daniel Dehennin Date: Tue, 16 Feb 2021 11:10:09 +0100 Subject: [PATCH 2/2] feat(map): update to v5 `map.jinja` The v5 `map.jinja` is a generic and configurable system to load configuration values, exposed as the `mapdata` variable, from different places: - YAML files and templates from the fileserver for non-secret data - pillars or SDB are preferred for secret data - grains or `config.get` The `map.jinja` optional sources are configured with compound targeting like syntax `[[: