Skip to content

Commit 55655d9

Browse files
refactor(variable): rename private vars to (pkgname, name)
1 parent 776df42 commit 55655d9

File tree

11 files changed

+90
-94
lines changed

11 files changed

+90
-94
lines changed

mongodb/bic/archive.sls

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@
33
# vim: ft=yaml
44
{% from 'mongodb/map.jinja' import mongodb with context %}
55

6-
mongodb bic archive {{ mongodb.bic.dirname }} download:
6+
mongodb bic archive {{ mongodb.bic.pkgname }} download:
77
file.directory:
88
- names:
99
- {{ mongodb.dl.tmpdir }}
10-
- {{ mongodb.system.prefix }}/{{ mongodb.bic.dirname }}
10+
- {{ mongodb.system.prefix }}/{{ mongodb.bic.pkgname }}
1111
- makedirs: True
1212
pkg.installed:
1313
- names: {{ mongodb.system.deps }}
1414
cmd.run:
15-
- name: curl -s -L -o {{ mongodb.dl.tmpdir }}/{{ mongodb.bic.arcname }} {{ mongodb.bic.url }}
16-
- unless: test -f {{ mongodb.dl.tmpdir }}/{{ mongodb.bic.arcname }}
15+
- name: curl -s -L -o {{ mongodb.dl.tmpdir }}/{{ mongodb.bic.name }} {{ mongodb.bic.url }}
16+
- unless: test -f {{ mongodb.dl.tmpdir }}/{{ mongodb.bic.name }}
1717
{% if grains['saltversioninfo'] >= [2017, 7, 0] %}
1818
- retry:
1919
attempts: {{ mongodb.dl.retries }}
@@ -22,26 +22,26 @@ mongodb bic archive {{ mongodb.bic.dirname }} download:
2222
splay: 10
2323
{% endif %}
2424

25-
mongodb bic archive {{ mongodb.bic.dirname }} install:
25+
mongodb bic archive {{ mongodb.bic.pkgname }} install:
2626
archive.extracted:
27-
- source: file://{{ mongodb.dl.tmpdir }}/{{ mongodb.bic.arcname }}
27+
- source: file://{{ mongodb.dl.tmpdir }}/{{ mongodb.bic.name }}
2828
- name: {{ mongodb.system.prefix }}
2929
- makedirs: True
3030
- trim_output: True
3131
- enforce_toplevel: True
3232
- skip_verify: True ## see https://jira.mongodb.org/browse/DOCS-12151
3333
# source_hash: {{ mongodb.bic.url ~ '.sha256' if "source_hash" not in mongodb.bic else mongodb.bic.source_hash }}
3434
- require:
35-
- cmd: mongodb bic archive {{ mongodb.bic.dirname }} download
35+
- cmd: mongodb bic archive {{ mongodb.bic.pkgname }} download
3636
- require_in:
37-
- file: mongodb bic archive {{ mongodb.bic.dirname }} install
38-
- file: mongodb bic archive {{ mongodb.bic.dirname }} profile
37+
- file: mongodb bic archive {{ mongodb.bic.pkgname }} install
38+
- file: mongodb bic archive {{ mongodb.bic.pkgname }} profile
3939
file.symlink:
4040
- name: {{ mongodb.bic.binpath }}
41-
- target: {{ mongodb.system.prefix }}/{{ mongodb.bic.dirname }}
41+
- target: {{ mongodb.system.prefix }}/{{ mongodb.bic.pkgname }}
4242
- unless: test -d {{ mongodb.bic.binpath }}
4343

44-
mongodb bic archive {{ mongodb.bic.dirname }} profile:
44+
mongodb bic archive {{ mongodb.bic.pkgname }} profile:
4545
file.managed:
4646
- name: /etc/profile.d/mongodb.sh
4747
- source: salt://mongodb/files/mongodb.profile.jinja

mongodb/bic/clean.sls

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ mongodb bic {{ svc }} cleanup:
2929
- {{ mongodb.bic[svc]['conf_path'] }}
3030
- /Library/LaunchAgents/org.mongo.{{ svc }}.plist
3131
- /Library/LaunchAgents/org.mongo.mongodb.{{ svc }}.plist
32-
- {{ salt['file.dirname'](mongodb.bic[svc]['conf']['systemLog']['path']) }}
32+
- {{ salt['file.pkgname'](mongodb.bic[svc]['conf']['systemLog']['path']) }}
3333
{%- if "storage" in mongodb.bic[svc]['conf'] and "dbPath" in mongodb.bic[svc]['conf']['storage'] %}
3434
- {{ mongodb.bic[svc]['conf']['storage']['dbPath'] }}
3535
{%- endif %}
3636
{%- if "schema" in mongodb.bic[svc]['conf'] and "path" in mongodb.bic[svc]['conf']['schema'] %}
37-
- {{ salt['file.dirname']( mongodb.bic[svc]['conf']['schema']['path']) }}
37+
- {{ salt['file.pkgname']( mongodb.bic[svc]['conf']['schema']['path']) }}
3838
{%- endif %}
3939
{%- if grains.os in ('MacOS',) %}
4040
- {{ mongodb.system.userhome }}/{{ mongodb.system.user }}/Desktop/MongoDB ({{ svc }})
@@ -54,9 +54,9 @@ mongodb bic {{ svc }} cleanup:
5454
mongodb bic cleanup:
5555
file.absent:
5656
- names:
57-
- {{ mongodb.system.prefix }}/{{ mongodb.bic.dirname }}
57+
- {{ mongodb.system.prefix }}/{{ mongodb.bic.pkgname }}
5858
- {{ mongodb.bic.binpath }}
59-
- {{ mongodb.dl.tmpdir }}/{{ mongodb.bic.arcname }}
59+
- {{ mongodb.dl.tmpdir }}/{{ mongodb.bic.name }}
6060
- /etc/logrotate.d/mongodb-bic
6161
- /tmp/mac_shortcut.sh
6262
user.absent:

mongodb/bic/config.sls

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,14 @@ mongodb bic tools pypip package:
4040
{%- for svc in ('mongosqld',) %}
4141

4242
{%- if "processManagement" in mongodb.bic[svc]['conf'] and mongodb.bic[svc]['conf']['processManagement']['pidFilePath'] %}
43-
{%- set pidpath = salt['file.dirname']( mongodb.bic[svc]['conf']['processManagement']['pidFilePath']) %}
43+
{%- set pidpath = salt['file.pkgname']( mongodb.bic[svc]['conf']['processManagement']['pidFilePath']) %}
4444
{%- else %}
4545
{%- set pidpath = mongodb.system.pidpath %}
4646
{%- endif %}
4747

4848
mongodb bic {{ svc }} logpath:
4949
file.directory:
50-
- name: {{ salt['file.dirname'](mongodb.bic[svc]['conf']['systemLog']['path']) }}
50+
- name: {{ salt['file.pkgname'](mongodb.bic[svc]['conf']['systemLog']['path']) }}
5151
- user: {{ mongodb.bic.user }}
5252
- group: {{ mongodb.bic.group }}
5353
- dir_mode: '0775'
@@ -59,7 +59,7 @@ mongodb bic {{ svc }} logpath:
5959
- user: mongodb bic user and group present
6060
{%- if mongodb.system.use_selinux %}
6161
selinux.fcontext_policy_present:
62-
- name: '{{ salt['file.dirname'](mongodb.bic[svc]['conf']['systemLog']['path']) }}(/.*)?'
62+
- name: '{{ salt['file.pkgname'](mongodb.bic[svc]['conf']['systemLog']['path']) }}(/.*)?'
6363
- sel_type: mongod_log_t
6464
- require_in:
6565
- selinux: mongodb bic {{ svc }} service running
@@ -110,7 +110,7 @@ mongodb bic {{ svc }} schema path:
110110
{%- if mongodb.system.use_selinux %}
111111

112112
selinux.fcontext_policy_present:
113-
- name: {{ salt['file.dirname']( mongodb.bic[svc]['conf']['schema']['path']) }}
113+
- name: {{ salt['file.pkgname']( mongodb.bic[svc]['conf']['schema']['path']) }}
114114
- sel_type: etc_t
115115
- require_in:
116116
- selinux: mongodb bic {{ svc }} service running
@@ -238,12 +238,12 @@ mongodb bic {{ svc }} service running:
238238
{%- if mongodb.system.use_selinux %}
239239
selinux.fcontext_policy_applied:
240240
- names:
241-
- {{ salt['file.dirname'](mongodb.bic[svc]['conf']['systemLog']['path']) }}
241+
- {{ salt['file.pkgname'](mongodb.bic[svc]['conf']['systemLog']['path']) }}
242242
- {{ mongodb.bic[svc]['conf_path'] }}
243243
- {{ pidpath }}
244244
- /etc/logrotate.d/mongodb_{{ svc }}
245245
{%- if mongodb.bic.use_schema and "schema" in mongodb.bic[svc]['conf'] and mongodb.bic[svc]['conf']['schema']['path'] %}
246-
- {{ salt['file.dirname']( mongodb.bic[svc]['conf']['schema']['path']) }}
246+
- {{ salt['file.pkgname']( mongodb.bic[svc]['conf']['schema']['path']) }}
247247
{%- endif %}
248248
- recursive: True
249249
- require:

mongodb/compass/archive.sls

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
# vim: ft=yaml
44
{% from 'mongodb/map.jinja' import mongodb with context %}
55

6-
mongodb compass archive {{ mongodb.compass.dirname }} download:
6+
mongodb compass archive {{ mongodb.compass.pkgname }} download:
77
file.directory:
88
- names:
99
- {{ mongodb.dl.tmpdir }}
10-
- {{ mongodb.system.prefix }}/{{ mongodb.compass.dirname }}/
10+
- {{ mongodb.system.prefix }}/{{ mongodb.compass.pkgname }}/
1111
- makedirs: True
1212
cmd.run:
13-
- name: curl -s -L -o {{ mongodb.dl.tmpdir }}/{{ mongodb.compass.arcname }} {{ mongodb.compass.url }}
14-
- unless: test -f {{ mongodb.dl.tmpdir }}/{{ mongodb.compass.arcname }}
13+
- name: curl -s -L -o {{ mongodb.dl.tmpdir }}/{{ mongodb.compass.name }} {{ mongodb.compass.url }}
14+
- unless: test -f {{ mongodb.dl.tmpdir }}/{{ mongodb.compass.name }}
1515
{% if grains['saltversioninfo'] >= [2017, 7, 0] %}
1616
- retry:
1717
attempts: {{ mongodb.dl.retries }}
@@ -22,43 +22,43 @@ mongodb compass archive {{ mongodb.compass.dirname }} download:
2222
{%- if mongodb.compass.source_hash and (grains['saltversioninfo'] <= [2016, 11, 6] or grains.os in ('MacOS',)) %}
2323
module.run:
2424
- name: file.check_hash
25-
- path: '{{ mongodb.dl.tmpdir }}/{{ mongodb.compass.arcname }}'
25+
- path: '{{ mongodb.dl.tmpdir }}/{{ mongodb.compass.name }}'
2626
- file_hash: {{ mongodb.compass.source_hash }}
2727
- onchanges:
28-
- cmd: mongodb compass archive {{ mongodb.compass.dirname }} download
28+
- cmd: mongodb compass archive {{ mongodb.compass.pkgname }} download
2929
- require_in:
3030
{% if grains.os == 'MacOS' %}
31-
- macpackge: mongodb compass archive {{ mongodb.compass.dirname }} install
31+
- macpackge: mongodb compass archive {{ mongodb.compass.pkgname }} install
3232
{%- else %}
33-
- archive: mongodb compass archive {{ mongodb.compass.dirname }} install
33+
- archive: mongodb compass archive {{ mongodb.compass.pkgname }} install
3434
{%- endif %}
3535
{%- endif %}
3636

37-
mongodb compass archive {{ mongodb.compass.dirname }} install:
37+
mongodb compass archive {{ mongodb.compass.pkgname }} install:
3838
{% if grains.os == 'MacOS' %}
3939
macpackage.installed:
40-
- name: '{{ mongodb.dl.tmpdir }}/{{ mongodb.compass.arcname }}'
40+
- name: '{{ mongodb.dl.tmpdir }}/{{ mongodb.compass.name }}'
4141
- store: True
4242
- dmg: True
4343
- app: True
4444
- force: True
4545
- allow_untrusted: True
4646
{% else %}
4747
archive.extracted:
48-
- source: file://{{ mongodb.dl.tmpdir }}/{{ mongodb.compass.arcname }}
48+
- source: file://{{ mongodb.dl.tmpdir }}/{{ mongodb.compass.name }}
4949
- name: {{ mongodb.system.prefix }}
5050
- makedirs: True
5151
- trim_output: True
5252
- enforce_toplevel: True
5353
- source_hash: {{ mongodb.compass.source_hash }}
5454
{%- endif %}
5555
- require:
56-
- mongodb compass archive {{ mongodb.compass.dirname }} download
56+
- mongodb compass archive {{ mongodb.compass.pkgname }} download
5757
- require_in:
58-
- file: mongodb compass archive {{ mongodb.compass.dirname }} install
58+
- file: mongodb compass archive {{ mongodb.compass.pkgname }} install
5959
{% if mongodb.compass.binpath and grains.os not in ('MacOS', 'Windows') %}
6060
file.symlink:
6161
- name: {{ mongodb.compass.binpath }}
62-
- target: {{ mongodb.system.prefix }}/{{ mongodb.compass.dirname }}
62+
- target: {{ mongodb.system.prefix }}/{{ mongodb.compass.pkgname }}
6363
- unless: test -d {{ mongodb.compass.binpath }}
6464
{%- endif %}

mongodb/compass/clean.sls

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ mongodb compass cleanup:
88
- names:
99
{%- if grains.os in ('MacOS',) %}
1010
- {{ mongodb.system.userhome }}/{{ mongodb.system.user }}/Desktop/MongoDB Compass Community
11+
- {{ mongodb.system.userhome }}/{{ mongodb.system.user }}/Desktop/MongoDB Compass
1112
{%- endif %}
12-
- {{ mongodb.system.prefix }}/{{ mongodb.compass.dirname }}
13-
- {{ mongodb.dl.tmpdir }}/{{ mongodb.compass.arcname }}
14-
{%- if grains.os in ('MacOS',) %}
15-
- {{ mongodb.system.userhome }}/{{ mongodb.system.user }}/Desktop/MongoDB Compass Community
16-
{%- endif %}
13+
- {{ mongodb.system.prefix }}/{{ mongodb.compass.pkgname }}
14+
- {{ mongodb.dl.tmpdir }}/{{ mongodb.compass.name }}

mongodb/map.jinja

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,24 +30,24 @@
3030
) %}
3131

3232
#### archives
33-
{%- set arcname = m.server.url.split('/')[-1]|string %}
34-
{%- do m.server.update({ 'arcname': arcname|replace('RELEASE', m.server.version),
35-
'dirname': arcname|replace('RELEASE', m.server.version)|replace('.tgz', '')|replace('-ssl', ''),
33+
{%- set name = m.server.url.split('/')[-1]|string %}
34+
{%- do m.server.update({ 'name': name|replace('RELEASE', m.server.version),
35+
'pkgname': name|replace('RELEASE', m.server.version)|replace('.tgz', '')|replace('-ssl', ''),
3636
'url' : m.server.url|replace('RELEASE', m.server.version)|string }) %}
3737

38-
{%- set arcname = m.bic.url.split('/')[-1]|string %}
39-
{%- do m.bic.update({ 'arcname': arcname|replace('RELEASE', m.bic.version),
40-
'dirname': arcname|replace('RELEASE', m.bic.version)|replace('.tgz', ''),
38+
{%- set name = m.bic.url.split('/')[-1]|string %}
39+
{%- do m.bic.update({ 'name': name|replace('RELEASE', m.bic.version),
40+
'pkgname': name|replace('RELEASE', m.bic.version)|replace('.tgz', ''),
4141
'url' : m.bic.url|replace('RELEASE', m.bic.version)|string }) %}
4242

43-
{%- set arcname = m.robo3t.url.split('/')[-1]|string %}
44-
{%- do m.robo3t.update({ 'arcname': arcname|replace('RELEASE', m.robo3t.version),
45-
'dirname': arcname|replace('RELEASE', m.robo3t.version)|replace('.tgz', ''),
43+
{%- set name = m.robo3t.url.split('/')[-1]|string %}
44+
{%- do m.robo3t.update({ 'name': name|replace('RELEASE', m.robo3t.version),
45+
'pkgname': name|replace('RELEASE', m.robo3t.version)|replace('.tgz', ''),
4646
'url' : m.robo3t.url|replace('RELEASE', m.robo3t.version)|string }) %}
4747

48-
{%- set arcname = m.compass.url.split('/')[-1]|string %}
49-
{%- do m.compass.update({ 'arcname': arcname|replace('RELEASE', m.compass.version),
50-
'dirname': arcname|replace('RELEASE', m.compass.version)|replace('.tgz', ''),
48+
{%- set name = m.compass.url.split('/')[-1]|string %}
49+
{%- do m.compass.update({ 'name': name|replace('RELEASE', m.compass.version),
50+
'pkgname': name|replace('RELEASE', m.compass.version)|replace('.tgz', ''),
5151
'url' : m.compass.url|replace('RELEASE', m.compass.version)|string }) %}
5252

5353

mongodb/robo3t/archive.sls

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
# vim: ft=yaml
44
{% from 'mongodb/map.jinja' import mongodb with context %}
55

6-
mongodb robo3t archive {{ mongodb.robo3t.dirname }} download:
6+
mongodb robo3t archive {{ mongodb.robo3t.pkgname }} download:
77
file.directory:
88
- names:
99
- {{ mongodb.dl.tmpdir }}
10-
- {{ mongodb.system.prefix }}/{{ mongodb.robo3t.dirname }}/
10+
- {{ mongodb.system.prefix }}/{{ mongodb.robo3t.pkgname }}/
1111
- makedirs: True
1212
cmd.run:
13-
- name: curl -s -L -o {{ mongodb.dl.tmpdir }}/{{ mongodb.robo3t.arcname }} {{ mongodb.robo3t.url }}
14-
- unless: test -f {{ mongodb.dl.tmpdir }}/{{ mongodb.robo3t.arcname }}
13+
- name: curl -s -L -o {{ mongodb.dl.tmpdir }}/{{ mongodb.robo3t.name }} {{ mongodb.robo3t.url }}
14+
- unless: test -f {{ mongodb.dl.tmpdir }}/{{ mongodb.robo3t.name }}
1515
{% if grains['saltversioninfo'] >= [2017, 7, 0] %}
1616
- retry:
1717
attempts: {{ mongodb.dl.retries }}
@@ -22,43 +22,43 @@ mongodb robo3t archive {{ mongodb.robo3t.dirname }} download:
2222
{%- if mongodb.robo3t.source_hash and (grains['saltversioninfo'] <= [2016, 11, 6] or grains.os in ('MacOS',)) %}
2323
module.run:
2424
- name: file.check_hash
25-
- path: '{{ mongodb.dl.tmpdir }}/{{ mongodb.robo3t.arcname }}'
25+
- path: '{{ mongodb.dl.tmpdir }}/{{ mongodb.robo3t.name }}'
2626
- file_hash: {{ mongodb.robo3t.source_hash }}
2727
- onchanges:
28-
- cmd: mongodb robo3t archive {{ mongodb.robo3t.dirname }} download
28+
- cmd: mongodb robo3t archive {{ mongodb.robo3t.pkgname }} download
2929
- require_in:
3030
{% if grains.os == 'MacOS' %}
31-
- macpackge: mongodb robo3t archive {{ mongodb.robo3t.dirname }} install
31+
- macpackge: mongodb robo3t archive {{ mongodb.robo3t.pkgname }} install
3232
{%- else %}
33-
- archive: mongodb robo3t archive {{ mongodb.robo3t.dirname }} install
33+
- archive: mongodb robo3t archive {{ mongodb.robo3t.pkgname }} install
3434
{%- endif %}
3535
{%- endif %}
3636

37-
mongodb robo3t archive {{ mongodb.robo3t.dirname }} install:
37+
mongodb robo3t archive {{ mongodb.robo3t.pkgname }} install:
3838
{% if grains.os == 'MacOS' %}
3939
macpackage.installed:
40-
- name: '{{ mongodb.dl.tmpdir }}/{{ mongodb.robo3t.arcname }}'
40+
- name: '{{ mongodb.dl.tmpdir }}/{{ mongodb.robo3t.name }}'
4141
- store: True
4242
- dmg: True
4343
- app: True
4444
- force: True
4545
- allow_untrusted: True
4646
{% else %}
4747
archive.extracted:
48-
- source: file://{{ mongodb.dl.tmpdir }}/{{ mongodb.robo3t.arcname }}
48+
- source: file://{{ mongodb.dl.tmpdir }}/{{ mongodb.robo3t.name }}
4949
- name: {{ mongodb.system.prefix }}
5050
- makedirs: True
5151
- trim_output: True
5252
- enforce_toplevel: True
5353
- source_hash: {{ mongodb.robo3t.source_hash }}
5454
{%- endif %}
5555
- require:
56-
- mongodb robo3t archive {{ mongodb.robo3t.dirname }} download
56+
- mongodb robo3t archive {{ mongodb.robo3t.pkgname }} download
5757
- require_in:
58-
- file: mongodb robo3t archive {{ mongodb.robo3t.dirname }} install
58+
- file: mongodb robo3t archive {{ mongodb.robo3t.pkgname }} install
5959
{% if mongodb.robo3t.binpath and grains.os not in ('MacOS', 'Windows') %}
6060
file.symlink:
6161
- name: {{ mongodb.robo3t.binpath }}
62-
- target: {{ mongodb.system.prefix }}/{{ mongodb.robo3t.dirname }}
62+
- target: {{ mongodb.system.prefix }}/{{ mongodb.robo3t.pkgname }}
6363
- unless: test -d {{ mongodb.robo3t.binpath }}
6464
{%- endif %}

mongodb/robo3t/clean.sls

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,8 @@ mongodb robo3t cleanup:
77
file.absent:
88
- names:
99
{%- if grains.os in ('MacOS',) %}
10+
- {{ mongodb.system.userhome }}/{{ mongodb.system.user }}/Desktop/Robo 3T Community
1011
- {{ mongodb.system.userhome }}/{{ mongodb.system.user }}/Desktop/Robo 3T
1112
{%- endif %}
12-
- {{ mongodb.system.prefix }}/{{ mongodb.robo3t.dirname }}
13-
- {{ mongodb.dl.tmpdir }}/{{ mongodb.robo3t.arcname }}
14-
{%- if grains.os in ('MacOS',) %}
15-
- {{ mongodb.system.userhome }}/{{ mongodb.system.user }}/Desktop/Robo 3T
16-
{%- endif %}
13+
- {{ mongodb.system.prefix }}/{{ mongodb.robo3t.pkgname }}
14+
- {{ mongodb.dl.tmpdir }}/{{ mongodb.robo3t.name }}

0 commit comments

Comments
 (0)