Skip to content

Commit

Permalink
fix(matchers): no delimiter option of config.get with salt-ssh
Browse files Browse the repository at this point in the history
  • Loading branch information
baby-gnu committed Jan 6, 2021
1 parent ec790e4 commit 9129a23
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions openssh/libmatchers.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -151,19 +151,23 @@

{#- Add `merge:` option to `salt["config.get"]` if configured #}
{%- if cli in ["minion", "local"] and parsed.query_method == "config.get" and config_get_strategy %}
{%- set merge_opt = {"merge": config_get_strategy} %}
{%- set merge_msg = ", merge: strategy='" ~ config_get_strategy ~ "'" %}
{%- set query_opts = {"merge": config_get_strategy,
"delimiter": parsed.query_delimiter,
} %}
{%- set query_opts_msg = ", delimiter='" ~ parsed.query_delimiter ~ "'"
~ ", merge: strategy='" ~ config_get_strategy ~ "'"
%}
{%- else %}
{%- if cli not in ["minion", "local"] %}
{%- do salt["log.error"](
log_prefix
~ "the 'merge' option of 'config.get' is skipped when the salt command type is '"
~ "the 'delimiter' and 'merge' options of 'config.get' are skipped when the salt command type is '"
~ cli
~ "'"
) %}
{%- endif %}
{%- set merge_opt = {} %}
{%- set merge_msg = "" %}
{%- set query_opts = {} %}
{%- set query_opts_msg = "" %}
{%- endif %}

{%- do salt["log.debug"](
Expand All @@ -172,14 +176,13 @@
~ "'" ~ parsed.query ~ "'"
~ " with "
~ "'" ~ parsed.query_method ~ "'"
~ ", delimiter='" ~ parsed.query_delimiter ~ "'"
~ merge_msg
~ query_opts_msg
) %}
{%- set values = salt[parsed.query_method](
parsed.query,
delimiter=parsed.query_delimiter,
default=[],
**merge_opt
**query_opts
) %}
{%- do parsed.update(
{
Expand Down

0 comments on commit 9129a23

Please sign in to comment.