Bladeren bron

fix(libmatchers): python client API can use `config.get` options

Only `salt-ssh` can't use them actually.

* openssh/libsaltcli.jinja: detect non empty `opts['__cli']` as `api`.

* openssh/libmatchers.jinja: only `ssh` and `unknown` can't use
  `config.get` options `merge` and `delimiter`.
tags/v3.0.2
Daniel Dehennin 2 jaren geleden
bovenliggende
commit
560a5ccbbc
2 gewijzigde bestanden met toevoegingen van 5 en 3 verwijderingen
  1. +3
    -3
      openssh/libmatchers.jinja
  2. +2
    -0
      openssh/libsaltcli.jinja

+ 3
- 3
openssh/libmatchers.jinja Bestand weergeven

{%- endif %} {%- endif %}


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

+ 2
- 0
openssh/libsaltcli.jinja Bestand weergeven

{%- set cli = 'minion' %} {%- set cli = 'minion' %}
{%- elif opts_cli == 'salt-call' %} {%- elif opts_cli == 'salt-call' %}
{%- set cli = 'ssh' if opts_masteropts_cli in ('salt-ssh', 'salt-master') else 'local' %} {%- set cli = 'ssh' if opts_masteropts_cli in ('salt-ssh', 'salt-master') else 'local' %}
{%- elif opts_cli %}
{%- set cli = 'api' %}
{%- else %} {%- else %}
{%- set cli = 'unknown' %} {%- set cli = 'unknown' %}
{%- endif %} {%- endif %}

Laden…
Annuleren
Opslaan