0
0
mirror of https://github.com/saltstack-formulas/openssh-formula.git synced 2024-11-28 01:18:12 +01:00
openssh-formula/openssh/libsaltcli.jinja
Daniel Dehennin 560a5ccbbc 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`.
2022-02-03 14:08:37 +01:00

19 lines
660 B
Django/Jinja

# -*- coding: utf-8 -*-
# vim: ft=jinja
{#- Get the relevant values from the `opts` dict #}
{%- set opts_cli = opts.get('__cli', '') %}
{%- set opts_masteropts_cli = opts | traverse('__master_opts__:__cli', '') %}
{#- Determine the type of salt command being run #}
{%- if opts_cli == 'salt-minion' %}
{%- set cli = 'minion' %}
{%- elif opts_cli == 'salt-call' %}
{%- set cli = 'ssh' if opts_masteropts_cli in ('salt-ssh', 'salt-master') else 'local' %}
{%- elif opts_cli %}
{%- set cli = 'api' %}
{%- else %}
{%- set cli = 'unknown' %}
{%- endif %}
{%- do salt['log.debug']('[libsaltcli] the salt command type has been identified to be: ' ~ cli) %}