|
3 | 3 |
|
4 | 4 | {#- Get the `tplroot` from `tpldir` #} |
5 | 5 | {%- set tplroot = tpldir.split('/')[0] %} |
| 6 | +{%- from tplroot ~ "/libsaltcli.jinja" import cli with context %} |
6 | 7 |
|
7 | 8 | {#- Where to lookup parameters source files #} |
8 | 9 | {%- set map_sources_dir = tplroot | path_join('parameters') %} |
|
31 | 32 | {#- load configuration values used in `config.get` merging strategies #} |
32 | 33 | {%- set _config = {'stack': default_settings.get('values', {}), |
33 | 34 | 'merge_strategy': salt['config.get'](tplroot ~ ':strategy', None), |
34 | | - 'merge_lists': salt['config.get'](tplroot ~ ':merge_lists', False), |
35 | | - 'cli': salt['config.get']('__cli'), |
36 | | - 'root_dir': salt['config.get']('root_dir') |
| 35 | + 'merge_lists': salt['config.get'](tplroot ~ ':merge_lists', False) |
37 | 36 | } %} |
38 | 37 |
|
39 | | -{#- `config.get` merge option works only for `minion` or local `salt-call` #} |
40 | | -{%- if _config['cli'] == 'salt-minion' |
41 | | - or (_config['cli'] == 'salt-call' and not _config['root_dir'].endswith('/running_data')) %} |
| 38 | +{#- the `config.get` merge option only works for `minion` or `local` salt command types #} |
| 39 | +{%- if cli in ['minion', 'local'] %} |
42 | 40 | {%- do _config.update({'merge_opt': {'merge': _config['merge_strategy']}, |
43 | 41 | 'merge_msg': ", merge: strategy='" ~ _config['merge_strategy'] ~ "'"}) %} |
| 42 | +{#- the `config.get` merge option is not available for `ssh` or `unknown` salt command types #} |
44 | 43 | {%- else %} |
45 | | - {#- no `config.get` merge option for `salt-ssh` or `unknown` cli #} |
46 | 44 | {%- if _config['merge_strategy'] %} |
47 | | - {%- do salt['log.error']("map.jinja: the 'merge' option of 'config.get' is skipped with salt cli '" |
48 | | - ~ _config['cli'] | replace('call', 'ssh') | default('unknown', True) ~ "'") |
49 | | - %} |
| 45 | + {%- do salt['log.error']("map.jinja: the 'merge' option of 'config.get' is skipped when the salt command type is '" ~ cli ~ "'") %} |
50 | 46 | {%- endif %} |
51 | 47 | {%- do _config.update({'merge_opt': {}, |
52 | 48 | 'merge_msg': ''}) %} |
|
0 commit comments