Skip to content

Commit

Permalink
style(mapstack): variables in macro can't be exported
Browse files Browse the repository at this point in the history
No need to prefix some of them with underscore `_`.
  • Loading branch information
baby-gnu committed Jan 8, 2021
1 parent e512853 commit a85ecb2
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions openssh/libmapstack.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
{#- 1. the `value` #}
{#- 3. the `defaults` #}
{#- 4. the built-in #}
{%- set _strategy = matcher.value
{%- set strategy = matcher.value
| traverse(
"strategy",
defaults
Expand All @@ -125,7 +125,7 @@
"smart"
)
) %}
{%- set _merge_lists = matcher.value
{%- set merge_lists = matcher.value
| traverse(
"merge_lists",
defaults
Expand Down Expand Up @@ -158,9 +158,9 @@
~ "' retrieved with '"
~ matcher.query_method ~ "'"
~ ", merge: strategy='"
~ _strategy
~ strategy
~ "', lists='"
~ _merge_lists
~ merge_lists
~ "'"
~ ":\n"
~ value | yaml(False)
Expand All @@ -171,8 +171,8 @@
"values": salt["slsutil.merge"](
stack["values"],
value,
strategy=_strategy,
merge_lists=_merge_lists,
strategy=strategy,
merge_lists=merge_lists,
)
}
) %}
Expand Down Expand Up @@ -238,12 +238,16 @@
| yaml(False)
) %}

{%- set _strategy = yaml_values
{#- `slsutil.merge` options from #}
{#- 1. the `value` #}
{#- 3. the `defaults` #}
{#- 4. the built-in #}
{%- set strategy = yaml_values
| traverse(
"strategy",
defaults | traverse("strategy", "smart")
) %}
{%- set _merge_lists = yaml_values
{%- set merge_lists = yaml_values
| traverse(
"merge_lists",
defaults | traverse("merge_lists", False) | to_bool
Expand All @@ -254,8 +258,8 @@
stack["values"],
yaml_values
| traverse("values", {}),
strategy=_strategy,
merge_lists=_merge_lists,
strategy=strategy,
merge_lists=merge_lists,
)
}
) %}
Expand All @@ -264,9 +268,9 @@
~ "merged configuration values from "
~ yaml_name
~ ", merge: strategy='"
~ _strategy
~ strategy
~ "', merge_lists='"
~ _merge_lists
~ merge_lists
~ "':\n"
~ {"values": stack["values"]}
| yaml(False)
Expand Down

0 comments on commit a85ecb2

Please sign in to comment.