Skip to content

Commit 2f07675

Browse files
refactor(jinja): depreciate/replacer two variable names
1 parent 25a6883 commit 2f07675

File tree

13 files changed

+29
-22
lines changed

13 files changed

+29
-22
lines changed

mongodb/clean.sls

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ include:
2424
- sls: {{ sls_service_clean }}
2525
- sls: {{ sls_config_clean }}
2626
27-
{%- for comp in d.software_component_matrix %}
27+
{%- for comp in d.components %}
2828
{%- if comp in d.wanted and d.wanted is iterable and comp in d.pkg and d.pkg[comp] is mapping %}
2929
{%- for name,v in d.pkg[comp].items() %}
3030
{%- if name in d.wanted[comp] %}
3131
{%- set software = d.pkg[comp][name] %}
3232
{%- set package = software.package_format %}
33-
{%- if package in d.software_package_matrix %}
33+
{%- if package in d.use_upstream %}
3434
3535
{#- PACKAGE CLEAN #}
3636
{%- if package in software and software[package] is mapping %}
@@ -42,7 +42,7 @@ include:
4242
- file: {{ formula }}-clean-prerequisites
4343
file.absent:
4444
- name: {{ software['path'] }}
45-
{%- if d.wanted.upstream_repo %}
45+
{%- if d.use_upstream == 'repo' %}
4646
pkgrepo.absent:
4747
- name: {{ d.pkg['repo']['name'] }}
4848
{%- endif %}

mongodb/config/alternatives/clean.sls

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
{%- set formula = d.formula %}
77
88
{%- if grains.kernel|lower == 'linux' and d.linux.altpriority|int > 0 and grains.os_family != 'Arch' %}
9-
{%- for comp in d.software_component_matrix %}
9+
{%- for comp in d.components %}
1010
{%- if comp in d.wanted and d.wanted is iterable and comp in d.pkg and d.pkg[comp] is mapping %}
1111
{%- for name,v in d.pkg[comp].items() %}
1212
{%- if name in d.wanted[comp] %}

mongodb/config/alternatives/install.sls

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ include:
1010
- {{ sls_software_install }}
1111
1212
{%- if grains.kernel|lower == 'linux' and d.linux.altpriority|int > 0 and grains.os_family != 'Arch' %}
13-
{%- for comp in d.software_component_matrix %}
13+
{%- for comp in d.components %}
1414
{%- if comp in d.wanted and d.wanted is iterable and comp in d.pkg and d.pkg[comp] is mapping %}
1515
{%- for name,v in d.pkg[comp].items() %}
1616
{%- if name in d.wanted[comp] %}

mongodb/config/clean.sls

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ include:
1111
- {{ sls_service_clean }}
1212
- {{ sls_alternatives_clean }}
1313
14-
{%- for comp in d.software_component_matrix %}
14+
{%- for comp in d.components %}
1515
{%- if comp in d.wanted and d.wanted is iterable and comp in d.pkg and d.pkg[comp] is mapping %}
1616
{%- for name,v in d.pkg[comp].items() %}
1717
{%- if name in d.wanted[comp] %}

mongodb/config/environ.sls

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
include:
1111
- {{ sls_software_install }}
1212
13-
{%- for comp in d.software_component_matrix %}
13+
{%- for comp in d.components %}
1414
{%- if comp in d.wanted and d.wanted is iterable and comp in d.pkg and d.pkg[comp] is mapping %}
1515
{%- for name,v in d.pkg[comp].items() %}
1616
{%- if name in d.wanted[comp] %}

mongodb/config/file.sls

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ include:
2222
- require:
2323
- sls: {{ sls_software_install }}
2424
25-
{%- for comp in d.software_component_matrix %}
25+
{%- for comp in d.components %}
2626
{%- if comp in d.wanted and d.wanted is iterable and comp in d.pkg and d.pkg[comp] is mapping %}
2727
{%- for name,v in d.pkg[comp].items() %}
2828
{%- if name in d.wanted[comp] %}

mongodb/config/users.sls

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
{%- from tplroot ~ "/map.jinja" import data as d with context %}
66
{%- set formula = d.formula %}
77
8-
{%- for comp in d.software_component_matrix %}
8+
{%- for comp in d.components %}
99
{%- if comp in d.wanted and d.wanted is iterable and comp in d.pkg and d.pkg[comp] is mapping %}
1010
{%- for name,v in d.pkg[comp].items() %}
1111
{%- if name in d.wanted[comp] %}

mongodb/defaults.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
# vim: ft=yaml
33
---
44
mongodb:
5-
software_component_matrix: ['database', 'gui', 'connectors']
6-
software_package_matrix: ['archive', 'macapp', 'native']
5+
components: ['database', 'gui', 'connectors'] # depreciate software_component_matrix
6+
use_upstream: ['archive', 'macapp', 'repo'] # depreciate software_package_matrix
77
wanted:
88
database:
99
- mongod
@@ -12,7 +12,6 @@ mongodb:
1212
firewall: false
1313
selinux: false
1414
disable_transparent_hugepages: true
15-
upstream_repo: false
1615
default:
1716
user: mongodb
1817
group: mongodb

mongodb/install.sls

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ include:
3131
- pkg: {{ formula }}-install-prerequisites
3232
- pip: {{ formula }}-install-prerequisites
3333
34-
{%- for comp in d.software_component_matrix %}
34+
{%- for comp in d.components %}
3535
{%- if comp in d.wanted and d.wanted is iterable and comp in d.pkg and d.pkg[comp] is mapping %}
3636
{%- for name,v in d.pkg[comp].items() %}
3737
{%- if name in d.wanted[comp] %}
3838
{%- set software = d.pkg[comp][name] %}
3939
{%- set package = software.package_format %}
40-
{%- if package in d.software_package_matrix %}
40+
{%- if package in d.use_upstream %}
4141
4242
{# DOWNLOAD NATIVE PACKAGE #}
4343
@@ -76,7 +76,7 @@ include:
7676
{#- NATIVE PACKAGE INSTALL #}
7777
7878
{%- if package == 'native' %}
79-
{%- if d.wanted.upstream_repo and 'repo' in d.pkg and d.pkg.repo %}
79+
{%- if d.use_upstream = 'repo' and 'repo' in d.pkg and d.pkg.repo %}
8080
pkgrepo.managed:
8181
{{- format_kwargs(d.pkg['repo']) }}
8282
{%- endif %}

mongodb/map.jinja

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,18 @@
2222
)
2323
%}
2424

25+
# depreciate two params
26+
{%- if 'software_component_matrix' in d %}
27+
{%- do d.update({ 'components': d.software_component_matrix %}
28+
{%- endif %}
29+
{%- if 'software_package_matrix' in d %}
30+
{%- do d.update({ 'use_upstream': d.software_package_matrix %}
31+
{%- endif %}
32+
33+
# build dict
2534
{%- set d = salt['grains.filter_by']( {'defaults': defaults}, default='defaults', merge=_config) %}
2635

27-
{%- for comp in d.software_component_matrix %}
36+
{%- for comp in d.components %}
2837
{%- if comp in d.pkg and d.pkg[comp] is mapping %}
2938
{%- for name,v in d.pkg[comp].items() %}
3039
{%- set software = d.pkg[comp][name] %}
@@ -34,7 +43,7 @@
3443
{%- set release = v.version.split('.')[0] ~ '.' ~ v.version.split('.')[1] %}
3544
{%- set dir = '%s-%s'|format(name, v.version) %}
3645
{%- set path = d.dir.archive ~ '/' ~ dir %}
37-
{%- for package in d.software_package_matrix %}
46+
{%- for package in d.use_upstream %}
3847
{%- if package in v and v[package] %}
3948
{%- set path = d.dir[package] if package == 'macapp' else path %}
4049
{%- do software[package].update({'name': path}) %}

0 commit comments

Comments
 (0)