Skip to content

Commit

Permalink
test(map): verify map.jinja dump using _mapdata state [skip ci]
Browse files Browse the repository at this point in the history
* Automated using myii/ssf-formula#275
  • Loading branch information
myii committed Dec 21, 2020
1 parent a0fdc61 commit 1897259
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
5 changes: 5 additions & 0 deletions CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@
/docs/TOFS_pattern.rst @saltstack-formulas/ssf
/*/libsaltcli.jinja @saltstack-formulas/ssf
/*/libtofs.jinja @saltstack-formulas/ssf
/openvpn/_mapdata/ @saltstack-formulas/ssf
/openvpn/libsaltcli.jinja @saltstack-formulas/ssf
/openvpn/libtofs.jinja @saltstack-formulas/ssf
/test/integration/**/_mapdata_spec.rb @saltstack-formulas/ssf
/test/integration/**/libraries/system.rb @saltstack-formulas/ssf
/test/integration/**/inspec.yml @saltstack-formulas/ssf
/test/integration/**/README.md @saltstack-formulas/ssf
/.gitignore @saltstack-formulas/ssf
Expand Down
8 changes: 5 additions & 3 deletions test/integration/share/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ Its goal is to share the libraries between all profiles.
The `system` library provides easy access to system dependent information:

- `system.platform`: based on `inspec.platform`, modify to values that are more consistent from a SaltStack perspective
- `system.platform[:family]` provide a family name for Arch
- `system.platform[:name]` modify `amazon` to `amazonlinux`
- `system.platform[:release]` tweak Arch and Amazon Linux:
- `system.platform[:family]` provide a family name for Arch and Gentoo
- `system.platform[:name]` append `linux` to both `amazon` and `oracle`; ensure Windows platforms are resolved as simply `windows`
- `system.platform[:release]` tweak Arch, Amazon Linux, Gentoo and Windows:
- `Arch` is always `base-latest`
- `Amazon Linux` release `2018` is resolved as `1`
- `Gentoo` release is trimmed to its major version number and then the init system is appended (i.e. `sysv` or `sysd`)
- `Windows` uses the widely-used release number (e.g. `8.1` or `2019-server`) in place of the actual system release version
- `system.platform[:finger]` is the concatenation of the name and the major release number (except for Ubuntu, which gives `ubuntu-20.04` for example)
12 changes: 6 additions & 6 deletions test/integration/share/libraries/system.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,19 @@ def build_platform_family
case inspec.platform[:name]
when 'arch'
'arch'
when 'gentoo'
'gentoo'
else
inspec.platform[:family]
end
end

def build_platform_name
case inspec.platform[:name]
when 'amazon'
'amazonlinux'
when 'windows_8.1_pro'
when 'amazon', 'oracle'
"#{inspec.platform[:name]}linux"
when 'windows_8.1_pro', 'windows_server_2019_datacenter'
'windows'
when 'windows_server_2019_datacenter'
'windows-server'
else
inspec.platform[:name]
end
Expand All @@ -60,7 +60,7 @@ def build_platform_release
when 'windows_8.1_pro'
'8.1'
when 'windows_server_2019_datacenter'
'2019'
'2019-server'
else
inspec.platform[:release]
end
Expand Down

0 comments on commit 1897259

Please sign in to comment.