Skip to content

Commit

Permalink
feat(template): review PR 212
Browse files Browse the repository at this point in the history
* saltstack-formulas/template-formula#212

Use `:r! grep -riIn _mapdata_spec` to locate all of the lines to be
adjusted.
Then fix with `%s:_mapdata_spec.rb:_mapdata.rb:` (check changes
carefully afterwards).

Use `:r! find ssf/files/ -name _mapdata_spec.rb` to locate all of the
templates to rename and adjust.
  • Loading branch information
myii committed Feb 11, 2021
1 parent 4b828db commit 5b5d679
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pillar.example
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ ssf:
- formula/_mapdata/init.sls
- formula/libsaltcli.jinja
- formula/libtofs.jinja
- inspec/controls/_mapdata_spec.rb
- inspec/controls/_mapdata.rb
- inspec/libraries/system.rb
- inspec/inspec.yml
- inspec/README.md
Expand Down
4 changes: 2 additions & 2 deletions ssf/config/formulas.sls
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,10 @@ prepare-git-branch-for-{{ formula }}:
{#- Do not manage the file in the following situations: #}
{#- - If a matching test suite isn't found #}
{#- - Or if `libraries/system.rb` and is not the `share` suite #}
{#- - Or if `controls/_mapdata_spec.rb` and is the `share` suite #}
{#- - Or if `controls/_mapdata.rb` and is the `share` suite #}
{%- if (not matching_test_suite.found) or
(dest_file == 'libraries/system.rb' and suite.name != 'share') or
(dest_file == 'controls/_mapdata_spec.rb' and suite.name == 'share')
(dest_file == 'controls/_mapdata.rb' and suite.name == 'share')
%}
{%- set dest_file = '' %}
{%- else %}
Expand Down
2 changes: 1 addition & 1 deletion ssf/defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ ssf_node_anchors:
- '/*/_mapdata/': '@saltstack-formulas/ssf'
- '/*/libsaltcli.jinja': '@saltstack-formulas/ssf'
- '/*/libtofs.jinja': '@saltstack-formulas/ssf'
- '/test/integration/**/_mapdata_spec.rb': '@saltstack-formulas/ssf'
- '/test/integration/**/_mapdata.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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

require 'yaml'

control '`map.jinja` YAML dump' do
title 'should match the comparison file'
control '{{ semrel_formula }}._mapdata' do
title '`map.jinja` should match the reference file'

### Method
# The steps below for each file appear convoluted but they are both required
Expand Down
3 changes: 2 additions & 1 deletion ssf/formulas.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -745,8 +745,9 @@ ssf_node_anchors:
formula/_mapdata/init.sls: &file__formula___mapdata___init--sls
<<: *file_default
template: 'mako'
inspec/controls/_mapdata_spec.rb: &file__inspec__controls___mapdata_spec--rb
inspec/controls/_mapdata.rb: &file__inspec__controls___mapdata--rb
<<: *file_default
template: 'jinja'
inspec/libraries/system.rb: &file__inspec__libraries__system--rb
<<: *file_default

Expand Down

0 comments on commit 5b5d679

Please sign in to comment.