Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(map): enable import of mapdata from outside the formula #230

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

baby-gnu
Copy link
Contributor

@baby-gnu baby-gnu commented Mar 31, 2021

PR progress checklist (to be filled in by reviewers)

  • Changes to documentation are appropriate (or tick if not required)
  • Changes to tests are appropriate (or tick if not required)
  • Reviews completed

What type of PR is this?

Primary type

  • [build] Changes related to the build system
  • [chore] Changes to the build process or auxiliary tools and libraries such as documentation generation
  • [ci] Changes to the continuous integration configuration
  • [feat] A new feature
  • [fix] A bug fix
  • [perf] A code change that improves performance
  • [refactor] A code change that neither fixes a bug nor adds a feature
  • [revert] A change used to revert a previous commit
  • [style] Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc.)

Secondary type

  • [docs] Documentation changes
  • [test] Adding missing or correcting existing tests

Does this PR introduce a BREAKING CHANGE?

Yes.

BREAKING CHANGE: map.jinja import must use without context

BREAKING CHANGE: libmapstack.jinja import must use without context

BREAKING CHANGE: libmatchers.jinja import must use without context

Related issues and/or pull requests

saltstack-formulas/apache-formula#295
saltstack-formulas/cert-formula#37

Describe the changes you're proposing

tplroot can't be set correctly when the import:

  • is done from another top directory than the formula directory
  • the import is done with context

In this case, the tpldir is set to the directory of the importer .sls file instead of the .jinja imported one.

We force the without context which permits to directly use tpldir as the tplroot which is the directory of the imported file.

Pillar / config required to test the proposed changes

Debug log showing how the proposed changes work

Documentation checklist

  • Updated the README (e.g. Available states).
  • Updated pillar.example.

Testing checklist

  • Included in Kitchen (i.e. under state_top).
  • Covered by new/existing tests (e.g. InSpec, Serverspec, etc.).
  • Updated the relevant test pillar.

Additional context

@baby-gnu baby-gnu requested review from a team as code owners March 31, 2021 11:09
@baby-gnu baby-gnu force-pushed the feature/import-mapdata-from-outside-formula branch from b10cada to 8797eba Compare March 31, 2021 11:11
@baby-gnu baby-gnu changed the title fix(map): enable import of mapdata from outside the formula feat(map): enable import of mapdata from outside the formula Mar 31, 2021
@baby-gnu baby-gnu force-pushed the feature/import-mapdata-from-outside-formula branch from 8797eba to 985b2b7 Compare March 31, 2021 11:17
@baby-gnu
Copy link
Contributor Author

baby-gnu commented Apr 9, 2021

I see only 2 differences between with context and without context:

  • the variable tplroot defined in the .sls is visble in the imported file
  • the variable tplfile is different
    • with context set tplfile to the .sls file doing the import
    • without context set tplfile to the imported file

As an example, here is my setup:

/srv/salt/foo/test.sls
# -*- mode: salt; coding: utf-8 -*-
# vim: ft=sls

{#- Get the `tplroot` from `tpldir` #}
{%- set tplroot = tpldir.split('/')[0] %}
{%- from tplroot ~ "/test-context.jinja" import context as context_with_context_import with context %}
{%- from tplroot ~ "/test-context.jinja" import context as context_without_context_import without context %}

test-context-content-with-context-import:
  file.managed:
    - name: /tmp/context-with-context.txt
    - source: salt://foo/serialize_yaml.jinja
    - template: jinja
    - context:
        value: {{ context_with_context_import | json }}

test-context-content-without-context-import:
  file.managed:
    - name: /tmp/context-without-context.txt
    - source: salt://foo/serialize_yaml.jinja
    - template: jinja
    - context:
        value: {{ context_without_context_import | json }}

test-context-diff-between-with-context-and-without:
  cmd.run:
    - name: 'diff -u /tmp/context-with-context.txt /tmp/context-without-context.txt'
/srv/salt/foo/test-context.jinja
{%- set context = show_full_context() %}
/srv/salt/foo/serialize_yaml.jinja
---
{#- use salt.slsutil.serialize to avoid encoding errors on some platforms #}
{{ salt["slsutil.serialize"](
     "yaml",
     value,
     default_flow_style=False,
     allow_unicode=True,
   )
   | regex_replace("^\s+'$", "'", multiline=True)
   | trim
}}
...
Log of salt-call -l debug state.apply foo.test
[DEBUG   ] Including configuration from '/etc/salt/minion.d/_schedule.conf'
[DEBUG   ] Reading configuration from /etc/salt/minion.d/_schedule.conf
[DEBUG   ] Using cached minion ID from /etc/salt/minion_id: testmachine1.example.net
[DEBUG   ] Configuration file path: /etc/salt/minion
[WARNING ] Insecure logging configuration detected! Sensitive data may be logged.
[DEBUG   ] Grains refresh requested. Refreshing grains.
[DEBUG   ] Reading configuration from /etc/salt/minion
[DEBUG   ] Including configuration from '/etc/salt/minion.d/_schedule.conf'
[DEBUG   ] Reading configuration from /etc/salt/minion.d/_schedule.conf
[DEBUG   ] Unable to resolve address fe80::c0ff:fea8:65: [Errno 1] Unknown host
[DEBUG   ] Elapsed time getting FQDNs: 0.11185741424560547 seconds
[DEBUG   ] LazyLoaded zfs.is_supported
[DEBUG   ] Connecting to master. Attempt 1 of 1
[DEBUG   ] "salt" Not an IP address? Assuming it is a hostname.
[DEBUG   ] Master URI: tcp://192.168.0.101:4506
[DEBUG   ] Initializing new AsyncAuth for ('/etc/salt/pki/minion', 'testmachine1.example.net', 'tcp://192.168.0.101:4506')
[DEBUG   ] Generated random reconnect delay between '1000ms' and '11000ms' (9344)
[DEBUG   ] Setting zmq_reconnect_ivl to '9344ms'
[DEBUG   ] Setting zmq_reconnect_ivl_max to '11000ms'
[DEBUG   ] Initializing new AsyncZeroMQReqChannel for ('/etc/salt/pki/minion', 'testmachine1.example.net', 'tcp://192.168.0.101:4506', 'clear')
[DEBUG   ] Connecting the Minion to the Master URI (for the return server): tcp://192.168.0.101:4506
[DEBUG   ] Trying to connect to: tcp://192.168.0.101:4506
[DEBUG   ] salt.crypt.get_rsa_pub_key: Loading public key
[DEBUG   ] Decrypting the current master AES key
[DEBUG   ] salt.crypt.get_rsa_key: Loading private key
[DEBUG   ] salt.crypt._get_key_with_evict: Loading private key
[DEBUG   ] Loaded minion key: /etc/salt/pki/minion/minion.pem
[DEBUG   ] salt.crypt.get_rsa_pub_key: Loading public key
[DEBUG   ] Closing AsyncZeroMQReqChannel instance
[DEBUG   ] Connecting the Minion to the Master publish port, using the URI: tcp://192.168.0.101:4505
[DEBUG   ] salt.crypt.get_rsa_key: Loading private key
[DEBUG   ] Loaded minion key: /etc/salt/pki/minion/minion.pem
[DEBUG   ] Determining pillar cache
[DEBUG   ] Initializing new AsyncZeroMQReqChannel for ('/etc/salt/pki/minion', 'testmachine1.example.net', 'tcp://192.168.0.101:4506', 'aes')
[DEBUG   ] Initializing new AsyncAuth for ('/etc/salt/pki/minion', 'testmachine1.example.net', 'tcp://192.168.0.101:4506')
[DEBUG   ] Connecting the Minion to the Master URI (for the return server): tcp://192.168.0.101:4506
[DEBUG   ] Trying to connect to: tcp://192.168.0.101:4506
[DEBUG   ] salt.crypt.get_rsa_key: Loading private key
[DEBUG   ] Loaded minion key: /etc/salt/pki/minion/minion.pem
[DEBUG   ] Closing AsyncZeroMQReqChannel instance
[DEBUG   ] LazyLoaded jinja.render
[DEBUG   ] LazyLoaded yaml.render
[DEBUG   ] LazyLoaded state.apply
[DEBUG   ] LazyLoaded direct_call.execute
[DEBUG   ] LazyLoaded saltutil.is_running
[DEBUG   ] LazyLoaded grains.get
[DEBUG   ] LazyLoaded config.get
[DEBUG   ] Initializing new AsyncZeroMQReqChannel for ('/etc/salt/pki/minion', 'testmachine1.example.net', 'tcp://192.168.0.101:4506', 'aes')
[DEBUG   ] Initializing new AsyncAuth for ('/etc/salt/pki/minion', 'testmachine1.example.net', 'tcp://192.168.0.101:4506')
[DEBUG   ] Connecting the Minion to the Master URI (for the return server): tcp://192.168.0.101:4506
[DEBUG   ] Trying to connect to: tcp://192.168.0.101:4506
[DEBUG   ] Gathering pillar data for state run
[DEBUG   ] Finished gathering pillar data for state run
[INFO    ] Loading fresh modules for state activity
[DEBUG   ] LazyLoaded jinja.render
[DEBUG   ] LazyLoaded yaml.render
[DEBUG   ] In saltenv 'base', looking at rel_path 'foo/test.sls' to resolve 'salt://foo/test.sls'
[DEBUG   ] In saltenv 'base', ** considering ** path '/var/cache/salt/minion/files/base/foo/test.sls' to resolve 'salt://foo/test.sls'
[DEBUG   ] compile template: /var/cache/salt/minion/files/base/foo/test.sls
[DEBUG   ] Jinja search path: ['/var/cache/salt/minion/files/base']
[DEBUG   ] Initializing new AsyncZeroMQReqChannel for ('/etc/salt/pki/minion', 'testmachine1.example.net', 'tcp://192.168.0.101:4506', 'aes')
[DEBUG   ] Initializing new AsyncAuth for ('/etc/salt/pki/minion', 'testmachine1.example.net', 'tcp://192.168.0.101:4506')
[DEBUG   ] Connecting the Minion to the Master URI (for the return server): tcp://192.168.0.101:4506
[DEBUG   ] Trying to connect to: tcp://192.168.0.101:4506
[DEBUG   ] In saltenv 'base', looking at rel_path 'foo/test-context.jinja' to resolve 'salt://foo/test-context.jinja'
[DEBUG   ] In saltenv 'base', ** considering ** path '/var/cache/salt/minion/files/base/foo/test-context.jinja' to resolve 'salt://foo/test-context.jinja'
[PROFILE ] Time (in seconds) to render '/var/cache/salt/minion/files/base/foo/test.sls' using 'jinja' renderer: 0.021892070770263672
[DEBUG   ] Rendered data from file: /var/cache/salt/minion/files/base/foo/test.sls:
# -*- mode: salt; coding: utf-8 -*-
# vim: ft=sls

test-context-content-with-context-import:
  file.managed:
    - name: /tmp/context-with-context.txt
    - source: salt://foo/serialize_yaml.jinja
    - template: jinja
    - context:
        value: {"cycler": "<class 'jinja2.utils.Cycler'>", "dict": "<class 'dict'>", "grains": {"biosreleasedate": "04/01/2014", "biosversion": "1.12.0-1", "cpu_flags": ["fpu", "de", "pse", "tsc", "msr", "pae", "mce", "cx8", "apic", "sep", "mtrr", "pge", "mca", "cmov", "pse36", "clflush", "mmx", "fxsr", "sse", "sse2", "syscall", "nx", "lm", "rep_good", "nopl", "xtopology", "cpuid", "tsc_known_freq", "pni", "cx16", "x2apic", "hypervisor", "lahf_lm", "cpuid_fault", "pti"], "cpu_model": "QEMU Virtual CPU version 2.5+", "cpuarch": "x86_64", "cwd": "/root", "disks": ["sr0", "sda"], "dns": {"domain": "example.net", "ip4_nameservers": ["192.168.232.2"], "ip6_nameservers": [], "nameservers": ["192.168.232.2"], "options": [], "search": [], "sortlist": []}, "domain": "example.net", "fqdn": "testmachine1.example.net", "fqdn_ip4": ["127.0.1.1", "127.0.1.1", "127.0.1.1"], "fqdn_ip6": [], "fqdns": ["git.example.net"], "gid": 0, "gpus": [{"model": "GD 5446", "vendor": "unknown"}], "groupname": "root", "host": "testmachine1", "hwaddr_interfaces": {"ens3": "02:00:c0:a8:00:65", "lo": "00:00:00:00:00:00"}, "id": "testmachine1.example.net", "init": "systemd", "ip4_gw": "192.168.0.1", "ip4_interfaces": {"ens3": ["192.168.0.101"], "lo": ["127.0.0.1"]}, "ip6_gw": false, "ip6_interfaces": {"ens3": ["fe80::c0ff:fea8:65"], "lo": ["::1"]}, "ip_gw": true, "ip_interfaces": {"ens3": ["192.168.0.101", "fe80::c0ff:fea8:65"], "lo": ["127.0.0.1", "::1"]}, "ipv4": ["127.0.0.1", "192.168.0.101"], "ipv6": ["::1", "fe80::c0ff:fea8:65"], "kernel": "Linux", "kernelparams": [["BOOT_IMAGE", "/vmlinuz-4.19.0-13-amd64"], ["root", "/dev/mapper/buster--vg-root"], ["ro", null], ["quiet", null]], "kernelrelease": "4.19.0-13-amd64", "kernelversion": "#1 SMP Debian 4.19.160-2 (2020-11-28)", "locale_info": {"defaultencoding": "UTF-8", "defaultlanguage": "fr_FR", "detectedencoding": "UTF-8", "timezone": "CEST"}, "localhost": "testmachine1", "lsb_distrib_codename": "buster", "lsb_distrib_description": "Debian GNU/Linux 10 (buster)", "lsb_distrib_id": "Debian", "lsb_distrib_release": "10", "lvm": {"buster-vg": ["boot", "home", "root", "swap_1", "var"]}, "machine_id": "e585542c6fd5435d9476a899ff954d2f", "manufacturer": "QEMU", "master": "salt", "mem_total": 987, "nodename": "testmachine1", "num_cpus": 2, "num_gpus": 1, "os": "Debian", "os_family": "Debian", "osarch": "amd64", "oscodename": "buster", "osfinger": "Debian-10", "osfullname": "Debian", "osmajorrelease": 10, "osrelease": "10", "osrelease_info": [10], "path": "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", "pid": 15048, "productname": "Standard PC (i440FX + PIIX, 1996)", "ps": "ps -efHww", "pythonexecutable": "/usr/bin/python3", "pythonpath": ["/usr/bin", "/usr/lib/python37.zip", "/usr/lib/python3.7", "/usr/lib/python3.7/lib-dynload", "/usr/local/lib/python3.7/dist-packages", "/usr/lib/python3/dist-packages"], "pythonversion": [3, 7, 3, "final", 0], "saltpath": "/usr/lib/python3/dist-packages/salt", "saltversion": "3002.2", "saltversioninfo": [3002, 2], "serialnumber": "", "server_id": 1210026740, "shell": "/bin/bash", "ssds": [], "swap_total": 1275, "systemd": {"features": "+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD -IDN2 +IDN -PCRE2 default-hierarchy=hybrid", "version": "241"}, "systempath": ["/usr/local/sbin", "/usr/local/bin", "/usr/sbin", "/usr/bin", "/sbin", "/bin"], "uid": 0, "username": "root", "uuid": "360dd003-33fd-4730-a314-135bb3385c56", "virtual": "kvm", "zfs_feature_flags": false, "zfs_support": false, "zmqversion": "4.3.1"}, "joiner": "<class 'jinja2.utils.Joiner'>", "lipsum": "<function generate_lorem_ipsum at 0x7fbc9e0e5620>", "namespace": "<class 'jinja2.utils.Namespace'>", "odict": "<class 'salt.utils.odict.OrderedDict'>", "opts": {"__cli": "salt-call", "__role": "minion", "acceptance_wait_time": 10, "acceptance_wait_time_max": 0, "always_verify_signature": false, "append_minionid_config_dirs": [], "arg": ["foo.test"], "args_stdin": false, "auth_safemode": false, "auth_timeout": 5, "auth_tries": 7, "auto_accept": true, "autoload_dynamic_modules": true, "autosign_timeout": 120, "azurefs_update_interval": 60, "backup_mode": "", "beacons": {}, "beacons_before_connect": false, "cache": "localfs", "cache_jobs": false, "cache_sreqs": true, "cachedir": "/var/cache/salt/minion", "caller": true, "clean_dynamic_modules": true, "cluster_mode": false, "cmd_safe": true, "conf_file": "/etc/salt/minion", "config_dir": "/etc/salt", "cython_enable": false, "decrypt_pillar": [], "decrypt_pillar_default": "gpg", "decrypt_pillar_delimiter": ":", "decrypt_pillar_renderers": ["gpg"], "default_include": "minion.d/*.conf", "default_top": "base", "disable_modules": [], "disable_returners": [], "disabled_requisites": [], "discovery": false, "doc": false, "enable_fqdns_grains": true, "enable_gpu_grains": true, "enable_legacy_startup_events": true, "enable_zip_modules": false, "engines": [], "env_order": [], "event_match_type": "startswith", "ext_job_cache": "", "extension_modules": "/var/cache/salt/minion/extmods", "extmod_blacklist": {}, "extmod_whitelist": {}, "failhard": false, "file_buffer_size": 262144, "file_client": "remote", "file_ignore_glob": [], "file_ignore_regex": [], "file_recv": false, "file_recv_max_size": 100, "file_roots": {"base": []}, "fileserver_backend": ["roots"], "fileserver_followsymlinks": true, "fileserver_ignoresymlinks": false, "fileserver_limit_traversal": false, "force_color": false, "fun": "state.apply", "git_pillar_base": "master", "git_pillar_branch": "master", "git_pillar_env": "", "git_pillar_fallback": "", "git_pillar_global_lock": true, "git_pillar_includes": true, "git_pillar_insecure_auth": false, "git_pillar_passphrase": "", "git_pillar_password": "", "git_pillar_privkey": "", "git_pillar_pubkey": "", "git_pillar_refspecs": ["+refs/heads/*:refs/remotes/origin/*", "+refs/tags/*:refs/tags/*"], "git_pillar_root": "", "git_pillar_ssl_verify": true, "git_pillar_update_interval": 60, "git_pillar_user": "", "gitfs_base": "master", "gitfs_disable_saltenv_mapping": false, "gitfs_fallback": "", "gitfs_global_lock": true, "gitfs_insecure_auth": false, "gitfs_mountpoint": "", "gitfs_passphrase": "", "gitfs_password": "", "gitfs_privkey": "", "gitfs_pubkey": "", "gitfs_ref_types": ["branch", "tag", "sha"], "gitfs_refspecs": ["+refs/heads/*:refs/remotes/origin/*", "+refs/tags/*:refs/tags/*"], "gitfs_remotes": [], "gitfs_root": "", "gitfs_saltenv": [], "gitfs_saltenv_blacklist": [], "gitfs_saltenv_whitelist": [], "gitfs_ssl_verify": true, "gitfs_update_interval": 60, "gitfs_user": "", "gpg_cache": false, "gpg_cache_backend": "disk", "gpg_cache_ttl": 86400, "grains": {"biosreleasedate": "04/01/2014", "biosversion": "1.12.0-1", "cpu_flags": ["fpu", "de", "pse", "tsc", "msr", "pae", "mce", "cx8", "apic", "sep", "mtrr", "pge", "mca", "cmov", "pse36", "clflush", "mmx", "fxsr", "sse", "sse2", "syscall", "nx", "lm", "rep_good", "nopl", "xtopology", "cpuid", "tsc_known_freq", "pni", "cx16", "x2apic", "hypervisor", "lahf_lm", "cpuid_fault", "pti"], "cpu_model": "QEMU Virtual CPU version 2.5+", "cpuarch": "x86_64", "cwd": "/root", "disks": ["sr0", "sda"], "dns": {"domain": "example.net", "ip4_nameservers": ["192.168.232.2"], "ip6_nameservers": [], "nameservers": ["192.168.232.2"], "options": [], "search": [], "sortlist": []}, "domain": "example.net", "fqdn": "testmachine1.example.net", "fqdn_ip4": ["127.0.1.1", "127.0.1.1", "127.0.1.1"], "fqdn_ip6": [], "fqdns": ["git.example.net"], "gid": 0, "gpus": [{"model": "GD 5446", "vendor": "unknown"}], "groupname": "root", "host": "testmachine1", "hwaddr_interfaces": {"ens3": "02:00:c0:a8:00:65", "lo": "00:00:00:00:00:00"}, "id": "testmachine1.example.net", "init": "systemd", "ip4_gw": "192.168.0.1", "ip4_interfaces": {"ens3": ["192.168.0.101"], "lo": ["127.0.0.1"]}, "ip6_gw": false, "ip6_interfaces": {"ens3": ["fe80::c0ff:fea8:65"], "lo": ["::1"]}, "ip_gw": true, "ip_interfaces": {"ens3": ["192.168.0.101", "fe80::c0ff:fea8:65"], "lo": ["127.0.0.1", "::1"]}, "ipv4": ["127.0.0.1", "192.168.0.101"], "ipv6": ["::1", "fe80::c0ff:fea8:65"], "kernel": "Linux", "kernelparams": [["BOOT_IMAGE", "/vmlinuz-4.19.0-13-amd64"], ["root", "/dev/mapper/buster--vg-root"], ["ro", null], ["quiet", null]], "kernelrelease": "4.19.0-13-amd64", "kernelversion": "#1 SMP Debian 4.19.160-2 (2020-11-28)", "locale_info": {"defaultencoding": "UTF-8", "defaultlanguage": "fr_FR", "detectedencoding": "UTF-8", "timezone": "CEST"}, "localhost": "testmachine1", "lsb_distrib_codename": "buster", "lsb_distrib_description": "Debian GNU/Linux 10 (buster)", "lsb_distrib_id": "Debian", "lsb_distrib_release": "10", "lvm": {"buster-vg": ["boot", "home", "root", "swap_1", "var"]}, "machine_id": "e585542c6fd5435d9476a899ff954d2f", "manufacturer": "QEMU", "master": "salt", "mem_total": 987, "nodename": "testmachine1", "num_cpus": 2, "num_gpus": 1, "os": "Debian", "os_family": "Debian", "osarch": "amd64", "oscodename": "buster", "osfinger": "Debian-10", "osfullname": "Debian", "osmajorrelease": 10, "osrelease": "10", "osrelease_info": [10], "path": "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", "pid": 15048, "productname": "Standard PC (i440FX + PIIX, 1996)", "ps": "ps -efHww", "pythonexecutable": "/usr/bin/python3", "pythonpath": ["/usr/bin", "/usr/lib/python37.zip", "/usr/lib/python3.7", "/usr/lib/python3.7/lib-dynload", "/usr/local/lib/python3.7/dist-packages", "/usr/lib/python3/dist-packages"], "pythonversion": [3, 7, 3, "final", 0], "saltpath": "/usr/lib/python3/dist-packages/salt", "saltversion": "3002.2", "saltversioninfo": [3002, 2], "serialnumber": "", "server_id": 1210026740, "shell": "/bin/bash", "ssds": [], "swap_total": 1275, "systemd": {"features": "+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD -IDN2 +IDN -PCRE2 default-hierarchy=hybrid", "version": "241"}, "systempath": ["/usr/local/sbin", "/usr/local/bin", "/usr/sbin", "/usr/bin", "/sbin", "/bin"], "uid": 0, "username": "root", "uuid": "360dd003-33fd-4730-a314-135bb3385c56", "virtual": "kvm", "zfs_feature_flags": false, "zfs_support": false, "zmqversion": "4.3.1"}, "grains_blacklist": [], "grains_cache": false, "grains_cache_expiration": 300, "grains_deep_merge": false, "grains_dirs": [], "grains_refresh_every": 0, "grains_run": false, "hard_crash": false, "hash_type": "sha256", "hgfs_update_interval": 60, "http_connect_timeout": 20.0, "http_max_body": 107374182400, "http_request_timeout": 3600.0, "id": "testmachine1.example.net", "id_function": {}, "interface": "0.0.0.0", "ipc_mode": "ipc", "ipc_write_buffer": 0, "ipv6": null, "jinja_env": {}, "jinja_lstrip_blocks": false, "jinja_sls_env": {}, "jinja_trim_blocks": false, "keysize": 2048, "local": false, "lock_saltenv": false, "log_datefmt": "%H:%M:%S", "log_datefmt_console": "%H:%M:%S", "log_datefmt_logfile": "%Y-%m-%d %H:%M:%S", "log_file": "/var/log/salt/minion", "log_fmt_console": "[%(levelname)-8s] %(message)s", "log_fmt_jid": "[JID: %(jid)s]", "log_fmt_logfile": "%(asctime)s,%(msecs)03d [%(name)-17s:%(lineno)-4d][%(levelname)-8s][%(process)d] %(message)s", "log_granular_levels": {}, "log_level": "debug", "log_level_logfile": "warning", "log_rotate_backup_count": 0, "log_rotate_max_bytes": 0, "loop_interval": 1, "master": "salt", "master_alive_interval": 0, "master_failback": false, "master_failback_interval": 0, "master_finger": "", "master_ip": "192.168.0.101", "master_port": 4506, "master_shuffle": false, "master_sign_key_name": "master_sign", "master_tops_first": false, "master_tries": 1, "master_type": "str", "master_uri": "tcp://192.168.0.101:4506", "master_uri_format": "default", "max_event_size": 1048576, "mine_enabled": true, "mine_interval": 60, "mine_return_job": false, "minion_id_caching": true, "minion_id_lowercase": false, "minion_id_remove_domain": false, "minion_jid_queue_hwm": 100, "minion_restart_command": [], "minion_sign_messages": false, "minionfs_update_interval": 60, "module_dirs": [], "modules_max_memory": -1, "multifunc_ordered": false, "multiprocessing": true, "no_color": false, "no_parse": [], "nodegroups": {}, "on_demand_ext_pillar": ["libvirt", "virtkey"], "open_mode": false, "optimization_order": [0, 1, 2], "output_file_append": false, "outputter_dirs": [], "password": null, "permissive_pki_access": false, "pidfile": "/var/run/salt-minion.pid", "pillar": {"sshd_config": {"PubkeyAuthentication": "yes"}}, "pillar_cache": false, "pillar_cache_backend": "disk", "pillar_cache_ttl": 3600, "pillar_includes_override_sls": false, "pillar_merge_lists": false, "pillar_opts": false, "pillar_roots": {"base": ["/srv/pillar", "/srv/spm/pillar"]}, "pillar_source_merging_strategy": "smart", "pillarenv": null, "pillarenv_from_saltenv": false, "ping_interval": 0, "pki_dir": "/etc/salt/pki/minion", "print_metadata": false, "process_count_max": -1, "profiling_enabled": false, "profiling_path": "/tmp/stats", "providers": {}, "proxy_host": "", "proxy_password": "", "proxy_port": 0, "proxy_username": "", "pub_ret": true, "publisher_acl": {}, "publisher_acl_blacklist": {}, "random_master": false, "random_reauth_delay": 10, "random_startup_delay": 0, "range_server": "range:80", "reactor_refresh_interval": 60, "reactor_worker_hwm": 10000, "reactor_worker_threads": 10, "recon_default": 1000, "recon_max": 10000, "recon_randomize": true, "refresh_grains_cache": false, "rejected_retry": false, "render_dirs": [], "renderer": "jinja|yaml", "renderer_blacklist": [], "renderer_whitelist": [], "resolve_dns_fallback": true, "restart_on_error": false, "retcode_passthrough": false, "retry_dns": 30, "retry_dns_count": null, "return": "", "return_retry_timer": 5, "return_retry_timer_max": 10, "returner_dirs": [], "root_dir": "/", "roots_update_interval": 60, "s3fs_update_interval": 60, "salt_cp_chunk_size": 65536, "saltenv": "base", "schedule": {"__mine_interval": {"enabled": true, "function": "mine.update", "jid_include": true, "maxrunning": 2, "minutes": 60, "return_job": false, "run_on_start": true}}, "scheduler_before_connect": false, "selected_output_option": "state_output", "sign_pub_messages": false, "skip_grains": false, "sls_list": [], "snapper_states": false, "snapper_states_config": "root", "sock_dir": "/var/run/salt/minion", "sock_pool_size": 1, "source_address": "", "source_interface_name": "", "source_publish_port": 0, "source_ret_port": 0, "ssh_merge_pillar": true, "ssl": null, "start_event_grains": [], "startup_states": "", "state_aggregate": false, "state_auto_order": true, "state_events": false, "state_output": "full", "state_output_diff": false, "state_top": "salt://top.sls", "state_top_saltenv": null, "state_verbose": true, "states_dirs": [], "sudo_user": "", "svnfs_update_interval": 60, "syndic_finger": "", "tcp_authentication_retries": 5, "tcp_keepalive": true, "tcp_keepalive_cnt": -1, "tcp_keepalive_idle": 300, "tcp_keepalive_intvl": -1, "tcp_pub_port": 4510, "tcp_pull_port": 4511, "test": false, "thorium_interval": 0.5, "thorium_roots": {"base": ["/srv/thorium"]}, "thorium_top": "top.sls", "thoriumenv": null, "top_file": "", "top_file_merging_strategy": "merge", "transport": "zeromq", "unique_jid": false, "update_restart_services": [], "update_url": false, "use_master_when_local": false, "user": "root", "username": null, "utils_dirs": ["/var/cache/salt/minion/extmods/utils"], "verify_env": true, "verify_master_pubkey_sign": false, "whitelist_modules": [], "winrepo_branch": "master", "winrepo_cache_expire_max": 604800, "winrepo_cache_expire_min": 1800, "winrepo_cachefile": "winrepo.p", "winrepo_dir": "/srv/salt/win/repo", "winrepo_dir_ng": "/srv/salt/win/repo-ng", "winrepo_fallback": "", "winrepo_insecure_auth": false, "winrepo_passphrase": "", "winrepo_password": "", "winrepo_privkey": "", "winrepo_pubkey": "", "winrepo_refspecs": ["+refs/heads/*:refs/remotes/origin/*", "+refs/tags/*:refs/tags/*"], "winrepo_remotes": ["https://github.com/saltstack/salt-winrepo.git"], "winrepo_remotes_ng": ["https://github.com/saltstack/salt-winrepo-ng.git"], "winrepo_source_dir": "salt://win/repo-ng/", "winrepo_ssl_verify": true, "winrepo_user": "", "zmq_filtering": false, "zmq_monitor": false}, "pillar": {"sshd_config": {"PubkeyAuthentication": "yes"}}, "proxy": {}, "raise": "<function jinja_raise at 0x7fbc9b166378>", "range": "<class 'range'>", "rendered_sls": "set()", "renderers": "<salt.loader.FilterDictWrapper object at 0x7fbc99585d30>", "salt": "<salt.utils.templates.AliasedLoader object at 0x7fbc9957e390>", "saltenv": "base", "show_full_context": "<function show_full_context at 0x7fbc9b0d1268>", "sls": "foo.test", "sls_path": "foo", "slscolonpath": "foo", "slsdotpath": "foo", "slspath": "foo", "tpldir": "foo", "tpldot": "foo", "tplfile": "foo/test.sls", "tplpath": "/var/cache/salt/minion/files/base/foo/test.sls", "tplroot": "foo"}

test-context-content-without-context-import:
  file.managed:
    - name: /tmp/context-without-context.txt
    - source: salt://foo/serialize_yaml.jinja
    - template: jinja
    - context:
        value: {"cycler": "<class 'jinja2.utils.Cycler'>", "dict": "<class 'dict'>", "grains": {"biosreleasedate": "04/01/2014", "biosversion": "1.12.0-1", "cpu_flags": ["fpu", "de", "pse", "tsc", "msr", "pae", "mce", "cx8", "apic", "sep", "mtrr", "pge", "mca", "cmov", "pse36", "clflush", "mmx", "fxsr", "sse", "sse2", "syscall", "nx", "lm", "rep_good", "nopl", "xtopology", "cpuid", "tsc_known_freq", "pni", "cx16", "x2apic", "hypervisor", "lahf_lm", "cpuid_fault", "pti"], "cpu_model": "QEMU Virtual CPU version 2.5+", "cpuarch": "x86_64", "cwd": "/root", "disks": ["sr0", "sda"], "dns": {"domain": "example.net", "ip4_nameservers": ["192.168.232.2"], "ip6_nameservers": [], "nameservers": ["192.168.232.2"], "options": [], "search": [], "sortlist": []}, "domain": "example.net", "fqdn": "testmachine1.example.net", "fqdn_ip4": ["127.0.1.1", "127.0.1.1", "127.0.1.1"], "fqdn_ip6": [], "fqdns": ["git.example.net"], "gid": 0, "gpus": [{"model": "GD 5446", "vendor": "unknown"}], "groupname": "root", "host": "testmachine1", "hwaddr_interfaces": {"ens3": "02:00:c0:a8:00:65", "lo": "00:00:00:00:00:00"}, "id": "testmachine1.example.net", "init": "systemd", "ip4_gw": "192.168.0.1", "ip4_interfaces": {"ens3": ["192.168.0.101"], "lo": ["127.0.0.1"]}, "ip6_gw": false, "ip6_interfaces": {"ens3": ["fe80::c0ff:fea8:65"], "lo": ["::1"]}, "ip_gw": true, "ip_interfaces": {"ens3": ["192.168.0.101", "fe80::c0ff:fea8:65"], "lo": ["127.0.0.1", "::1"]}, "ipv4": ["127.0.0.1", "192.168.0.101"], "ipv6": ["::1", "fe80::c0ff:fea8:65"], "kernel": "Linux", "kernelparams": [["BOOT_IMAGE", "/vmlinuz-4.19.0-13-amd64"], ["root", "/dev/mapper/buster--vg-root"], ["ro", null], ["quiet", null]], "kernelrelease": "4.19.0-13-amd64", "kernelversion": "#1 SMP Debian 4.19.160-2 (2020-11-28)", "locale_info": {"defaultencoding": "UTF-8", "defaultlanguage": "fr_FR", "detectedencoding": "UTF-8", "timezone": "CEST"}, "localhost": "testmachine1", "lsb_distrib_codename": "buster", "lsb_distrib_description": "Debian GNU/Linux 10 (buster)", "lsb_distrib_id": "Debian", "lsb_distrib_release": "10", "lvm": {"buster-vg": ["boot", "home", "root", "swap_1", "var"]}, "machine_id": "e585542c6fd5435d9476a899ff954d2f", "manufacturer": "QEMU", "master": "salt", "mem_total": 987, "nodename": "testmachine1", "num_cpus": 2, "num_gpus": 1, "os": "Debian", "os_family": "Debian", "osarch": "amd64", "oscodename": "buster", "osfinger": "Debian-10", "osfullname": "Debian", "osmajorrelease": 10, "osrelease": "10", "osrelease_info": [10], "path": "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", "pid": 15048, "productname": "Standard PC (i440FX + PIIX, 1996)", "ps": "ps -efHww", "pythonexecutable": "/usr/bin/python3", "pythonpath": ["/usr/bin", "/usr/lib/python37.zip", "/usr/lib/python3.7", "/usr/lib/python3.7/lib-dynload", "/usr/local/lib/python3.7/dist-packages", "/usr/lib/python3/dist-packages"], "pythonversion": [3, 7, 3, "final", 0], "saltpath": "/usr/lib/python3/dist-packages/salt", "saltversion": "3002.2", "saltversioninfo": [3002, 2], "serialnumber": "", "server_id": 1210026740, "shell": "/bin/bash", "ssds": [], "swap_total": 1275, "systemd": {"features": "+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD -IDN2 +IDN -PCRE2 default-hierarchy=hybrid", "version": "241"}, "systempath": ["/usr/local/sbin", "/usr/local/bin", "/usr/sbin", "/usr/bin", "/sbin", "/bin"], "uid": 0, "username": "root", "uuid": "360dd003-33fd-4730-a314-135bb3385c56", "virtual": "kvm", "zfs_feature_flags": false, "zfs_support": false, "zmqversion": "4.3.1"}, "joiner": "<class 'jinja2.utils.Joiner'>", "lipsum": "<function generate_lorem_ipsum at 0x7fbc9e0e5620>", "namespace": "<class 'jinja2.utils.Namespace'>", "odict": "<class 'salt.utils.odict.OrderedDict'>", "opts": {"__cli": "salt-call", "__role": "minion", "acceptance_wait_time": 10, "acceptance_wait_time_max": 0, "always_verify_signature": false, "append_minionid_config_dirs": [], "arg": ["foo.test"], "args_stdin": false, "auth_safemode": false, "auth_timeout": 5, "auth_tries": 7, "auto_accept": true, "autoload_dynamic_modules": true, "autosign_timeout": 120, "azurefs_update_interval": 60, "backup_mode": "", "beacons": {}, "beacons_before_connect": false, "cache": "localfs", "cache_jobs": false, "cache_sreqs": true, "cachedir": "/var/cache/salt/minion", "caller": true, "clean_dynamic_modules": true, "cluster_mode": false, "cmd_safe": true, "conf_file": "/etc/salt/minion", "config_dir": "/etc/salt", "cython_enable": false, "decrypt_pillar": [], "decrypt_pillar_default": "gpg", "decrypt_pillar_delimiter": ":", "decrypt_pillar_renderers": ["gpg"], "default_include": "minion.d/*.conf", "default_top": "base", "disable_modules": [], "disable_returners": [], "disabled_requisites": [], "discovery": false, "doc": false, "enable_fqdns_grains": true, "enable_gpu_grains": true, "enable_legacy_startup_events": true, "enable_zip_modules": false, "engines": [], "env_order": [], "event_match_type": "startswith", "ext_job_cache": "", "extension_modules": "/var/cache/salt/minion/extmods", "extmod_blacklist": {}, "extmod_whitelist": {}, "failhard": false, "file_buffer_size": 262144, "file_client": "remote", "file_ignore_glob": [], "file_ignore_regex": [], "file_recv": false, "file_recv_max_size": 100, "file_roots": {"base": []}, "fileserver_backend": ["roots"], "fileserver_followsymlinks": true, "fileserver_ignoresymlinks": false, "fileserver_limit_traversal": false, "force_color": false, "fun": "state.apply", "git_pillar_base": "master", "git_pillar_branch": "master", "git_pillar_env": "", "git_pillar_fallback": "", "git_pillar_global_lock": true, "git_pillar_includes": true, "git_pillar_insecure_auth": false, "git_pillar_passphrase": "", "git_pillar_password": "", "git_pillar_privkey": "", "git_pillar_pubkey": "", "git_pillar_refspecs": ["+refs/heads/*:refs/remotes/origin/*", "+refs/tags/*:refs/tags/*"], "git_pillar_root": "", "git_pillar_ssl_verify": true, "git_pillar_update_interval": 60, "git_pillar_user": "", "gitfs_base": "master", "gitfs_disable_saltenv_mapping": false, "gitfs_fallback": "", "gitfs_global_lock": true, "gitfs_insecure_auth": false, "gitfs_mountpoint": "", "gitfs_passphrase": "", "gitfs_password": "", "gitfs_privkey": "", "gitfs_pubkey": "", "gitfs_ref_types": ["branch", "tag", "sha"], "gitfs_refspecs": ["+refs/heads/*:refs/remotes/origin/*", "+refs/tags/*:refs/tags/*"], "gitfs_remotes": [], "gitfs_root": "", "gitfs_saltenv": [], "gitfs_saltenv_blacklist": [], "gitfs_saltenv_whitelist": [], "gitfs_ssl_verify": true, "gitfs_update_interval": 60, "gitfs_user": "", "gpg_cache": false, "gpg_cache_backend": "disk", "gpg_cache_ttl": 86400, "grains": {"biosreleasedate": "04/01/2014", "biosversion": "1.12.0-1", "cpu_flags": ["fpu", "de", "pse", "tsc", "msr", "pae", "mce", "cx8", "apic", "sep", "mtrr", "pge", "mca", "cmov", "pse36", "clflush", "mmx", "fxsr", "sse", "sse2", "syscall", "nx", "lm", "rep_good", "nopl", "xtopology", "cpuid", "tsc_known_freq", "pni", "cx16", "x2apic", "hypervisor", "lahf_lm", "cpuid_fault", "pti"], "cpu_model": "QEMU Virtual CPU version 2.5+", "cpuarch": "x86_64", "cwd": "/root", "disks": ["sr0", "sda"], "dns": {"domain": "example.net", "ip4_nameservers": ["192.168.232.2"], "ip6_nameservers": [], "nameservers": ["192.168.232.2"], "options": [], "search": [], "sortlist": []}, "domain": "example.net", "fqdn": "testmachine1.example.net", "fqdn_ip4": ["127.0.1.1", "127.0.1.1", "127.0.1.1"], "fqdn_ip6": [], "fqdns": ["git.example.net"], "gid": 0, "gpus": [{"model": "GD 5446", "vendor": "unknown"}], "groupname": "root", "host": "testmachine1", "hwaddr_interfaces": {"ens3": "02:00:c0:a8:00:65", "lo": "00:00:00:00:00:00"}, "id": "testmachine1.example.net", "init": "systemd", "ip4_gw": "192.168.0.1", "ip4_interfaces": {"ens3": ["192.168.0.101"], "lo": ["127.0.0.1"]}, "ip6_gw": false, "ip6_interfaces": {"ens3": ["fe80::c0ff:fea8:65"], "lo": ["::1"]}, "ip_gw": true, "ip_interfaces": {"ens3": ["192.168.0.101", "fe80::c0ff:fea8:65"], "lo": ["127.0.0.1", "::1"]}, "ipv4": ["127.0.0.1", "192.168.0.101"], "ipv6": ["::1", "fe80::c0ff:fea8:65"], "kernel": "Linux", "kernelparams": [["BOOT_IMAGE", "/vmlinuz-4.19.0-13-amd64"], ["root", "/dev/mapper/buster--vg-root"], ["ro", null], ["quiet", null]], "kernelrelease": "4.19.0-13-amd64", "kernelversion": "#1 SMP Debian 4.19.160-2 (2020-11-28)", "locale_info": {"defaultencoding": "UTF-8", "defaultlanguage": "fr_FR", "detectedencoding": "UTF-8", "timezone": "CEST"}, "localhost": "testmachine1", "lsb_distrib_codename": "buster", "lsb_distrib_description": "Debian GNU/Linux 10 (buster)", "lsb_distrib_id": "Debian", "lsb_distrib_release": "10", "lvm": {"buster-vg": ["boot", "home", "root", "swap_1", "var"]}, "machine_id": "e585542c6fd5435d9476a899ff954d2f", "manufacturer": "QEMU", "master": "salt", "mem_total": 987, "nodename": "testmachine1", "num_cpus": 2, "num_gpus": 1, "os": "Debian", "os_family": "Debian", "osarch": "amd64", "oscodename": "buster", "osfinger": "Debian-10", "osfullname": "Debian", "osmajorrelease": 10, "osrelease": "10", "osrelease_info": [10], "path": "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", "pid": 15048, "productname": "Standard PC (i440FX + PIIX, 1996)", "ps": "ps -efHww", "pythonexecutable": "/usr/bin/python3", "pythonpath": ["/usr/bin", "/usr/lib/python37.zip", "/usr/lib/python3.7", "/usr/lib/python3.7/lib-dynload", "/usr/local/lib/python3.7/dist-packages", "/usr/lib/python3/dist-packages"], "pythonversion": [3, 7, 3, "final", 0], "saltpath": "/usr/lib/python3/dist-packages/salt", "saltversion": "3002.2", "saltversioninfo": [3002, 2], "serialnumber": "", "server_id": 1210026740, "shell": "/bin/bash", "ssds": [], "swap_total": 1275, "systemd": {"features": "+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD -IDN2 +IDN -PCRE2 default-hierarchy=hybrid", "version": "241"}, "systempath": ["/usr/local/sbin", "/usr/local/bin", "/usr/sbin", "/usr/bin", "/sbin", "/bin"], "uid": 0, "username": "root", "uuid": "360dd003-33fd-4730-a314-135bb3385c56", "virtual": "kvm", "zfs_feature_flags": false, "zfs_support": false, "zmqversion": "4.3.1"}, "grains_blacklist": [], "grains_cache": false, "grains_cache_expiration": 300, "grains_deep_merge": false, "grains_dirs": [], "grains_refresh_every": 0, "grains_run": false, "hard_crash": false, "hash_type": "sha256", "hgfs_update_interval": 60, "http_connect_timeout": 20.0, "http_max_body": 107374182400, "http_request_timeout": 3600.0, "id": "testmachine1.example.net", "id_function": {}, "interface": "0.0.0.0", "ipc_mode": "ipc", "ipc_write_buffer": 0, "ipv6": null, "jinja_env": {}, "jinja_lstrip_blocks": false, "jinja_sls_env": {}, "jinja_trim_blocks": false, "keysize": 2048, "local": false, "lock_saltenv": false, "log_datefmt": "%H:%M:%S", "log_datefmt_console": "%H:%M:%S", "log_datefmt_logfile": "%Y-%m-%d %H:%M:%S", "log_file": "/var/log/salt/minion", "log_fmt_console": "[%(levelname)-8s] %(message)s", "log_fmt_jid": "[JID: %(jid)s]", "log_fmt_logfile": "%(asctime)s,%(msecs)03d [%(name)-17s:%(lineno)-4d][%(levelname)-8s][%(process)d] %(message)s", "log_granular_levels": {}, "log_level": "debug", "log_level_logfile": "warning", "log_rotate_backup_count": 0, "log_rotate_max_bytes": 0, "loop_interval": 1, "master": "salt", "master_alive_interval": 0, "master_failback": false, "master_failback_interval": 0, "master_finger": "", "master_ip": "192.168.0.101", "master_port": 4506, "master_shuffle": false, "master_sign_key_name": "master_sign", "master_tops_first": false, "master_tries": 1, "master_type": "str", "master_uri": "tcp://192.168.0.101:4506", "master_uri_format": "default", "max_event_size": 1048576, "mine_enabled": true, "mine_interval": 60, "mine_return_job": false, "minion_id_caching": true, "minion_id_lowercase": false, "minion_id_remove_domain": false, "minion_jid_queue_hwm": 100, "minion_restart_command": [], "minion_sign_messages": false, "minionfs_update_interval": 60, "module_dirs": [], "modules_max_memory": -1, "multifunc_ordered": false, "multiprocessing": true, "no_color": false, "no_parse": [], "nodegroups": {}, "on_demand_ext_pillar": ["libvirt", "virtkey"], "open_mode": false, "optimization_order": [0, 1, 2], "output_file_append": false, "outputter_dirs": [], "password": null, "permissive_pki_access": false, "pidfile": "/var/run/salt-minion.pid", "pillar": {"sshd_config": {"PubkeyAuthentication": "yes"}}, "pillar_cache": false, "pillar_cache_backend": "disk", "pillar_cache_ttl": 3600, "pillar_includes_override_sls": false, "pillar_merge_lists": false, "pillar_opts": false, "pillar_roots": {"base": ["/srv/pillar", "/srv/spm/pillar"]}, "pillar_source_merging_strategy": "smart", "pillarenv": null, "pillarenv_from_saltenv": false, "ping_interval": 0, "pki_dir": "/etc/salt/pki/minion", "print_metadata": false, "process_count_max": -1, "profiling_enabled": false, "profiling_path": "/tmp/stats", "providers": {}, "proxy_host": "", "proxy_password": "", "proxy_port": 0, "proxy_username": "", "pub_ret": true, "publisher_acl": {}, "publisher_acl_blacklist": {}, "random_master": false, "random_reauth_delay": 10, "random_startup_delay": 0, "range_server": "range:80", "reactor_refresh_interval": 60, "reactor_worker_hwm": 10000, "reactor_worker_threads": 10, "recon_default": 1000, "recon_max": 10000, "recon_randomize": true, "refresh_grains_cache": false, "rejected_retry": false, "render_dirs": [], "renderer": "jinja|yaml", "renderer_blacklist": [], "renderer_whitelist": [], "resolve_dns_fallback": true, "restart_on_error": false, "retcode_passthrough": false, "retry_dns": 30, "retry_dns_count": null, "return": "", "return_retry_timer": 5, "return_retry_timer_max": 10, "returner_dirs": [], "root_dir": "/", "roots_update_interval": 60, "s3fs_update_interval": 60, "salt_cp_chunk_size": 65536, "saltenv": "base", "schedule": {"__mine_interval": {"enabled": true, "function": "mine.update", "jid_include": true, "maxrunning": 2, "minutes": 60, "return_job": false, "run_on_start": true}}, "scheduler_before_connect": false, "selected_output_option": "state_output", "sign_pub_messages": false, "skip_grains": false, "sls_list": [], "snapper_states": false, "snapper_states_config": "root", "sock_dir": "/var/run/salt/minion", "sock_pool_size": 1, "source_address": "", "source_interface_name": "", "source_publish_port": 0, "source_ret_port": 0, "ssh_merge_pillar": true, "ssl": null, "start_event_grains": [], "startup_states": "", "state_aggregate": false, "state_auto_order": true, "state_events": false, "state_output": "full", "state_output_diff": false, "state_top": "salt://top.sls", "state_top_saltenv": null, "state_verbose": true, "states_dirs": [], "sudo_user": "", "svnfs_update_interval": 60, "syndic_finger": "", "tcp_authentication_retries": 5, "tcp_keepalive": true, "tcp_keepalive_cnt": -1, "tcp_keepalive_idle": 300, "tcp_keepalive_intvl": -1, "tcp_pub_port": 4510, "tcp_pull_port": 4511, "test": false, "thorium_interval": 0.5, "thorium_roots": {"base": ["/srv/thorium"]}, "thorium_top": "top.sls", "thoriumenv": null, "top_file": "", "top_file_merging_strategy": "merge", "transport": "zeromq", "unique_jid": false, "update_restart_services": [], "update_url": false, "use_master_when_local": false, "user": "root", "username": null, "utils_dirs": ["/var/cache/salt/minion/extmods/utils"], "verify_env": true, "verify_master_pubkey_sign": false, "whitelist_modules": [], "winrepo_branch": "master", "winrepo_cache_expire_max": 604800, "winrepo_cache_expire_min": 1800, "winrepo_cachefile": "winrepo.p", "winrepo_dir": "/srv/salt/win/repo", "winrepo_dir_ng": "/srv/salt/win/repo-ng", "winrepo_fallback": "", "winrepo_insecure_auth": false, "winrepo_passphrase": "", "winrepo_password": "", "winrepo_privkey": "", "winrepo_pubkey": "", "winrepo_refspecs": ["+refs/heads/*:refs/remotes/origin/*", "+refs/tags/*:refs/tags/*"], "winrepo_remotes": ["https://github.com/saltstack/salt-winrepo.git"], "winrepo_remotes_ng": ["https://github.com/saltstack/salt-winrepo-ng.git"], "winrepo_source_dir": "salt://win/repo-ng/", "winrepo_ssl_verify": true, "winrepo_user": "", "zmq_filtering": false, "zmq_monitor": false}, "pillar": {"sshd_config": {"PubkeyAuthentication": "yes"}}, "proxy": {}, "raise": "<function jinja_raise at 0x7fbc9b166378>", "range": "<class 'range'>", "rendered_sls": "set()", "renderers": "<salt.loader.FilterDictWrapper object at 0x7fbc99585d30>", "salt": "<salt.utils.templates.AliasedLoader object at 0x7fbc9957e390>", "saltenv": "base", "show_full_context": "<function show_full_context at 0x7fbc9b0d1268>", "sls": "foo.test", "sls_path": "foo", "slscolonpath": "foo", "slsdotpath": "foo", "slspath": "foo", "tpldir": "foo", "tpldot": "foo", "tplfile": "foo/test-context.jinja", "tplpath": "/var/cache/salt/minion/files/base/foo/test.sls"}

test-context-diff-between-with-context-and-without:
  cmd.run:
    - name: 'diff -u /tmp/context-with-context.txt /tmp/context-without-context.txt'

[DEBUG   ] Results of YAML rendering: 
OrderedDict([('test-context-content-with-context-import', OrderedDict([('file.managed', [OrderedDict([('name', '/tmp/context-with-context.txt')]), OrderedDict([('source', 'salt://foo/serialize_yaml.jinja')]), OrderedDict([('template', 'jinja')]), OrderedDict([('context', OrderedDict([('value', OrderedDict([('cycler', "<class 'jinja2.utils.Cycler'>"), ('dict', "<class 'dict'>"), ('grains', OrderedDict([('biosreleasedate', '04/01/2014'), ('biosversion', '1.12.0-1'), ('cpu_flags', ['fpu', 'de', 'pse', 'tsc', 'msr', 'pae', 'mce', 'cx8', 'apic', 'sep', 'mtrr', 'pge', 'mca', 'cmov', 'pse36', 'clflush', 'mmx', 'fxsr', 'sse', 'sse2', 'syscall', 'nx', 'lm', 'rep_good', 'nopl', 'xtopology', 'cpuid', 'tsc_known_freq', 'pni', 'cx16', 'x2apic', 'hypervisor', 'lahf_lm', 'cpuid_fault', 'pti']), ('cpu_model', 'QEMU Virtual CPU version 2.5+'), ('cpuarch', 'x86_64'), ('cwd', '/root'), ('disks', ['sr0', 'sda']), ('dns', OrderedDict([('domain', 'example.net'), ('ip4_nameservers', ['192.168.232.2']), ('ip6_nameservers', []), ('nameservers', ['192.168.232.2']), ('options', []), ('search', []), ('sortlist', [])])), ('domain', 'example.net'), ('fqdn', 'testmachine1.example.net'), ('fqdn_ip4', ['127.0.1.1', '127.0.1.1', '127.0.1.1']), ('fqdn_ip6', []), ('fqdns', ['git.example.net']), ('gid', 0), ('gpus', [OrderedDict([('model', 'GD 5446'), ('vendor', 'unknown')])]), ('groupname', 'root'), ('host', 'testmachine1'), ('hwaddr_interfaces', OrderedDict([('ens3', '02:00:c0:a8:00:65'), ('lo', '00:00:00:00:00:00')])), ('id', 'testmachine1.example.net'), ('init', 'systemd'), ('ip4_gw', '192.168.0.1'), ('ip4_interfaces', OrderedDict([('ens3', ['192.168.0.101']), ('lo', ['127.0.0.1'])])), ('ip6_gw', False), ('ip6_interfaces', OrderedDict([('ens3', ['fe80::c0ff:fea8:65']), ('lo', ['::1'])])), ('ip_gw', True), ('ip_interfaces', OrderedDict([('ens3', ['192.168.0.101', 'fe80::c0ff:fea8:65']), ('lo', ['127.0.0.1', '::1'])])), ('ipv4', ['127.0.0.1', '192.168.0.101']), ('ipv6', ['::1', 'fe80::c0ff:fea8:65']), ('kernel', 'Linux'), ('kernelparams', [['BOOT_IMAGE', '/vmlinuz-4.19.0-13-amd64'], ['root', '/dev/mapper/buster--vg-root'], ['ro', None], ['quiet', None]]), ('kernelrelease', '4.19.0-13-amd64'), ('kernelversion', '#1 SMP Debian 4.19.160-2 (2020-11-28)'), ('locale_info', OrderedDict([('defaultencoding', 'UTF-8'), ('defaultlanguage', 'fr_FR'), ('detectedencoding', 'UTF-8'), ('timezone', 'CEST')])), ('localhost', 'testmachine1'), ('lsb_distrib_codename', 'buster'), ('lsb_distrib_description', 'Debian GNU/Linux 10 (buster)'), ('lsb_distrib_id', 'Debian'), ('lsb_distrib_release', '10'), ('lvm', OrderedDict([('buster-vg', ['boot', 'home', 'root', 'swap_1', 'var'])])), ('machine_id', 'e585542c6fd5435d9476a899ff954d2f'), ('manufacturer', 'QEMU'), ('master', 'salt'), ('mem_total', 987), ('nodename', 'testmachine1'), ('num_cpus', 2), ('num_gpus', 1), ('os', 'Debian'), ('os_family', 'Debian'), ('osarch', 'amd64'), ('oscodename', 'buster'), ('osfinger', 'Debian-10'), ('osfullname', 'Debian'), ('osmajorrelease', 10), ('osrelease', '10'), ('osrelease_info', [10]), ('path', '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'), ('pid', 15048), ('productname', 'Standard PC (i440FX + PIIX, 1996)'), ('ps', 'ps -efHww'), ('pythonexecutable', '/usr/bin/python3'), ('pythonpath', ['/usr/bin', '/usr/lib/python37.zip', '/usr/lib/python3.7', '/usr/lib/python3.7/lib-dynload', '/usr/local/lib/python3.7/dist-packages', '/usr/lib/python3/dist-packages']), ('pythonversion', [3, 7, 3, 'final', 0]), ('saltpath', '/usr/lib/python3/dist-packages/salt'), ('saltversion', '3002.2'), ('saltversioninfo', [3002, 2]), ('serialnumber', ''), ('server_id', 1210026740), ('shell', '/bin/bash'), ('ssds', []), ('swap_total', 1275), ('systemd', OrderedDict([('features', '+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD -IDN2 +IDN -PCRE2 default-hierarchy=hybrid'), ('version', '241')])), ('systempath', ['/usr/local/sbin', '/usr/local/bin', '/usr/sbin', '/usr/bin', '/sbin', '/bin']), ('uid', 0), ('username', 'root'), ('uuid', '360dd003-33fd-4730-a314-135bb3385c56'), ('virtual', 'kvm'), ('zfs_feature_flags', False), ('zfs_support', False), ('zmqversion', '4.3.1')])), ('joiner', "<class 'jinja2.utils.Joiner'>"), ('lipsum', '<function generate_lorem_ipsum at 0x7fbc9e0e5620>'), ('namespace', "<class 'jinja2.utils.Namespace'>"), ('odict', "<class 'salt.utils.odict.OrderedDict'>"), ('opts', OrderedDict([('__cli', 'salt-call'), ('__role', 'minion'), ('acceptance_wait_time', 10), ('acceptance_wait_time_max', 0), ('always_verify_signature', False), ('append_minionid_config_dirs', []), ('arg', ['foo.test']), ('args_stdin', False), ('auth_safemode', False), ('auth_timeout', 5), ('auth_tries', 7), ('auto_accept', True), ('autoload_dynamic_modules', True), ('autosign_timeout', 120), ('azurefs_update_interval', 60), ('backup_mode', ''), ('beacons', OrderedDict()), ('beacons_before_connect', False), ('cache', 'localfs'), ('cache_jobs', False), ('cache_sreqs', True), ('cachedir', '/var/cache/salt/minion'), ('caller', True), ('clean_dynamic_modules', True), ('cluster_mode', False), ('cmd_safe', True), ('conf_file', '/etc/salt/minion'), ('config_dir', '/etc/salt'), ('cython_enable', False), ('decrypt_pillar', []), ('decrypt_pillar_default', 'gpg'), ('decrypt_pillar_delimiter', ':'), ('decrypt_pillar_renderers', ['gpg']), ('default_include', 'minion.d/*.conf'), ('default_top', 'base'), ('disable_modules', []), ('disable_returners', []), ('disabled_requisites', []), ('discovery', False), ('doc', False), ('enable_fqdns_grains', True), ('enable_gpu_grains', True), ('enable_legacy_startup_events', True), ('enable_zip_modules', False), ('engines', []), ('env_order', []), ('event_match_type', 'startswith'), ('ext_job_cache', ''), ('extension_modules', '/var/cache/salt/minion/extmods'), ('extmod_blacklist', OrderedDict()), ('extmod_whitelist', OrderedDict()), ('failhard', False), ('file_buffer_size', 262144), ('file_client', 'remote'), ('file_ignore_glob', []), ('file_ignore_regex', []), ('file_recv', False), ('file_recv_max_size', 100), ('file_roots', OrderedDict([('base', [])])), ('fileserver_backend', ['roots']), ('fileserver_followsymlinks', True), ('fileserver_ignoresymlinks', False), ('fileserver_limit_traversal', False), ('force_color', False), ('fun', 'state.apply'), ('git_pillar_base', 'master'), ('git_pillar_branch', 'master'), ('git_pillar_env', ''), ('git_pillar_fallback', ''), ('git_pillar_global_lock', True), ('git_pillar_includes', True), ('git_pillar_insecure_auth', False), ('git_pillar_passphrase', ''), ('git_pillar_password', ''), ('git_pillar_privkey', ''), ('git_pillar_pubkey', ''), ('git_pillar_refspecs', ['+refs/heads/*:refs/remotes/origin/*', '+refs/tags/*:refs/tags/*']), ('git_pillar_root', ''), ('git_pillar_ssl_verify', True), ('git_pillar_update_interval', 60), ('git_pillar_user', ''), ('gitfs_base', 'master'), ('gitfs_disable_saltenv_mapping', False), ('gitfs_fallback', ''), ('gitfs_global_lock', True), ('gitfs_insecure_auth', False), ('gitfs_mountpoint', ''), ('gitfs_passphrase', ''), ('gitfs_password', ''), ('gitfs_privkey', ''), ('gitfs_pubkey', ''), ('gitfs_ref_types', ['branch', 'tag', 'sha']), ('gitfs_refspecs', ['+refs/heads/*:refs/remotes/origin/*', '+refs/tags/*:refs/tags/*']), ('gitfs_remotes', []), ('gitfs_root', ''), ('gitfs_saltenv', []), ('gitfs_saltenv_blacklist', []), ('gitfs_saltenv_whitelist', []), ('gitfs_ssl_verify', True), ('gitfs_update_interval', 60), ('gitfs_user', ''), ('gpg_cache', False), ('gpg_cache_backend', 'disk'), ('gpg_cache_ttl', 86400), ('grains', OrderedDict([('biosreleasedate', '04/01/2014'), ('biosversion', '1.12.0-1'), ('cpu_flags', ['fpu', 'de', 'pse', 'tsc', 'msr', 'pae', 'mce', 'cx8', 'apic', 'sep', 'mtrr', 'pge', 'mca', 'cmov', 'pse36', 'clflush', 'mmx', 'fxsr', 'sse', 'sse2', 'syscall', 'nx', 'lm', 'rep_good', 'nopl', 'xtopology', 'cpuid', 'tsc_known_freq', 'pni', 'cx16', 'x2apic', 'hypervisor', 'lahf_lm', 'cpuid_fault', 'pti']), ('cpu_model', 'QEMU Virtual CPU version 2.5+'), ('cpuarch', 'x86_64'), ('cwd', '/root'), ('disks', ['sr0', 'sda']), ('dns', OrderedDict([('domain', 'example.net'), ('ip4_nameservers', ['192.168.232.2']), ('ip6_nameservers', []), ('nameservers', ['192.168.232.2']), ('options', []), ('search', []), ('sortlist', [])])), ('domain', 'example.net'), ('fqdn', 'testmachine1.example.net'), ('fqdn_ip4', ['127.0.1.1', '127.0.1.1', '127.0.1.1']), ('fqdn_ip6', []), ('fqdns', ['git.example.net']), ('gid', 0), ('gpus', [OrderedDict([('model', 'GD 5446'), ('vendor', 'unknown')])]), ('groupname', 'root'), ('host', 'testmachine1'), ('hwaddr_interfaces', OrderedDict([('ens3', '02:00:c0:a8:00:65'), ('lo', '00:00:00:00:00:00')])), ('id', 'testmachine1.example.net'), ('init', 'systemd'), ('ip4_gw', '192.168.0.1'), ('ip4_interfaces', OrderedDict([('ens3', ['192.168.0.101']), ('lo', ['127.0.0.1'])])), ('ip6_gw', False), ('ip6_interfaces', OrderedDict([('ens3', ['fe80::c0ff:fea8:65']), ('lo', ['::1'])])), ('ip_gw', True), ('ip_interfaces', OrderedDict([('ens3', ['192.168.0.101', 'fe80::c0ff:fea8:65']), ('lo', ['127.0.0.1', '::1'])])), ('ipv4', ['127.0.0.1', '192.168.0.101']), ('ipv6', ['::1', 'fe80::c0ff:fea8:65']), ('kernel', 'Linux'), ('kernelparams', [['BOOT_IMAGE', '/vmlinuz-4.19.0-13-amd64'], ['root', '/dev/mapper/buster--vg-root'], ['ro', None], ['quiet', None]]), ('kernelrelease', '4.19.0-13-amd64'), ('kernelversion', '#1 SMP Debian 4.19.160-2 (2020-11-28)'), ('locale_info', OrderedDict([('defaultencoding', 'UTF-8'), ('defaultlanguage', 'fr_FR'), ('detectedencoding', 'UTF-8'), ('timezone', 'CEST')])), ('localhost', 'testmachine1'), ('lsb_distrib_codename', 'buster'), ('lsb_distrib_description', 'Debian GNU/Linux 10 (buster)'), ('lsb_distrib_id', 'Debian'), ('lsb_distrib_release', '10'), ('lvm', OrderedDict([('buster-vg', ['boot', 'home', 'root', 'swap_1', 'var'])])), ('machine_id', 'e585542c6fd5435d9476a899ff954d2f'), ('manufacturer', 'QEMU'), ('master', 'salt'), ('mem_total', 987), ('nodename', 'testmachine1'), ('num_cpus', 2), ('num_gpus', 1), ('os', 'Debian'), ('os_family', 'Debian'), ('osarch', 'amd64'), ('oscodename', 'buster'), ('osfinger', 'Debian-10'), ('osfullname', 'Debian'), ('osmajorrelease', 10), ('osrelease', '10'), ('osrelease_info', [10]), ('path', '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'), ('pid', 15048), ('productname', 'Standard PC (i440FX + PIIX, 1996)'), ('ps', 'ps -efHww'), ('pythonexecutable', '/usr/bin/python3'), ('pythonpath', ['/usr/bin', '/usr/lib/python37.zip', '/usr/lib/python3.7', '/usr/lib/python3.7/lib-dynload', '/usr/local/lib/python3.7/dist-packages', '/usr/lib/python3/dist-packages']), ('pythonversion', [3, 7, 3, 'final', 0]), ('saltpath', '/usr/lib/python3/dist-packages/salt'), ('saltversion', '3002.2'), ('saltversioninfo', [3002, 2]), ('serialnumber', ''), ('server_id', 1210026740), ('shell', '/bin/bash'), ('ssds', []), ('swap_total', 1275), ('systemd', OrderedDict([('features', '+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD -IDN2 +IDN -PCRE2 default-hierarchy=hybrid'), ('version', '241')])), ('systempath', ['/usr/local/sbin', '/usr/local/bin', '/usr/sbin', '/usr/bin', '/sbin', '/bin']), ('uid', 0), ('username', 'root'), ('uuid', '360dd003-33fd-4730-a314-135bb3385c56'), ('virtual', 'kvm'), ('zfs_feature_flags', False), ('zfs_support', False), ('zmqversion', '4.3.1')])), ('grains_blacklist', []), ('grains_cache', False), ('grains_cache_expiration', 300), ('grains_deep_merge', False), ('grains_dirs', []), ('grains_refresh_every', 0), ('grains_run', False), ('hard_crash', False), ('hash_type', 'sha256'), ('hgfs_update_interval', 60), ('http_connect_timeout', 20.0), ('http_max_body', 107374182400), ('http_request_timeout', 3600.0), ('id', 'testmachine1.example.net'), ('id_function', OrderedDict()), ('interface', '0.0.0.0'), ('ipc_mode', 'ipc'), ('ipc_write_buffer', 0), ('ipv6', None), ('jinja_env', OrderedDict()), ('jinja_lstrip_blocks', False), ('jinja_sls_env', OrderedDict()), ('jinja_trim_blocks', False), ('keysize', 2048), ('local', False), ('lock_saltenv', False), ('log_datefmt', '%H:%M:%S'), ('log_datefmt_console', '%H:%M:%S'), ('log_datefmt_logfile', '%Y-%m-%d %H:%M:%S'), ('log_file', '/var/log/salt/minion'), ('log_fmt_console', '[%(levelname)-8s] %(message)s'), ('log_fmt_jid', '[JID: %(jid)s]'), ('log_fmt_logfile', '%(asctime)s,%(msecs)03d [%(name)-17s:%(lineno)-4d][%(levelname)-8s][%(process)d] %(message)s'), ('log_granular_levels', OrderedDict()), ('log_level', 'debug'), ('log_level_logfile', 'warning'), ('log_rotate_backup_count', 0), ('log_rotate_max_bytes', 0), ('loop_interval', 1), ('master', 'salt'), ('master_alive_interval', 0), ('master_failback', False), ('master_failback_interval', 0), ('master_finger', ''), ('master_ip', '192.168.0.101'), ('master_port', 4506), ('master_shuffle', False), ('master_sign_key_name', 'master_sign'), ('master_tops_first', False), ('master_tries', 1), ('master_type', 'str'), ('master_uri', 'tcp://192.168.0.101:4506'), ('master_uri_format', 'default'), ('max_event_size', 1048576), ('mine_enabled', True), ('mine_interval', 60), ('mine_return_job', False), ('minion_id_caching', True), ('minion_id_lowercase', False), ('minion_id_remove_domain', False), ('minion_jid_queue_hwm', 100), ('minion_restart_command', []), ('minion_sign_messages', False), ('minionfs_update_interval', 60), ('module_dirs', []), ('modules_max_memory', -1), ('multifunc_ordered', False), ('multiprocessing', True), ('no_color', False), ('no_parse', []), ('nodegroups', OrderedDict()), ('on_demand_ext_pillar', ['libvirt', 'virtkey']), ('open_mode', False), ('optimization_order', [0, 1, 2]), ('output_file_append', False), ('outputter_dirs', []), ('password', None), ('permissive_pki_access', False), ('pidfile', '/var/run/salt-minion.pid'), ('pillar', OrderedDict([('sshd_config', OrderedDict([('PubkeyAuthentication', 'yes')]))])), ('pillar_cache', False), ('pillar_cache_backend', 'disk'), ('pillar_cache_ttl', 3600), ('pillar_includes_override_sls', False), ('pillar_merge_lists', False), ('pillar_opts', False), ('pillar_roots', OrderedDict([('base', ['/srv/pillar', '/srv/spm/pillar'])])), ('pillar_source_merging_strategy', 'smart'), ('pillarenv', None), ('pillarenv_from_saltenv', False), ('ping_interval', 0), ('pki_dir', '/etc/salt/pki/minion'), ('print_metadata', False), ('process_count_max', -1), ('profiling_enabled', False), ('profiling_path', '/tmp/stats'), ('providers', OrderedDict()), ('proxy_host', ''), ('proxy_password', ''), ('proxy_port', 0), ('proxy_username', ''), ('pub_ret', True), ('publisher_acl', OrderedDict()), ('publisher_acl_blacklist', OrderedDict()), ('random_master', False), ('random_reauth_delay', 10), ('random_startup_delay', 0), ('range_server', 'range:80'), ('reactor_refresh_interval', 60), ('reactor_worker_hwm', 10000), ('reactor_worker_threads', 10), ('recon_default', 1000), ('recon_max', 10000), ('recon_randomize', True), ('refresh_grains_cache', False), ('rejected_retry', False), ('render_dirs', []), ('renderer', 'jinja|yaml'), ('renderer_blacklist', []), ('renderer_whitelist', []), ('resolve_dns_fallback', True), ('restart_on_error', False), ('retcode_passthrough', False), ('retry_dns', 30), ('retry_dns_count', None), ('return', ''), ('return_retry_timer', 5), ('return_retry_timer_max', 10), ('returner_dirs', []), ('root_dir', '/'), ('roots_update_interval', 60), ('s3fs_update_interval', 60), ('salt_cp_chunk_size', 65536), ('saltenv', 'base'), ('schedule', OrderedDict([('__mine_interval', OrderedDict([('enabled', True), ('function', 'mine.update'), ('jid_include', True), ('maxrunning', 2), ('minutes', 60), ('return_job', False), ('run_on_start', True)]))])), ('scheduler_before_connect', False), ('selected_output_option', 'state_output'), ('sign_pub_messages', False), ('skip_grains', False), ('sls_list', []), ('snapper_states', False), ('snapper_states_config', 'root'), ('sock_dir', '/var/run/salt/minion'), ('sock_pool_size', 1), ('source_address', ''), ('source_interface_name', ''), ('source_publish_port', 0), ('source_ret_port', 0), ('ssh_merge_pillar', True), ('ssl', None), ('start_event_grains', []), ('startup_states', ''), ('state_aggregate', False), ('state_auto_order', True), ('state_events', False), ('state_output', 'full'), ('state_output_diff', False), ('state_top', 'salt://top.sls'), ('state_top_saltenv', None), ('state_verbose', True), ('states_dirs', []), ('sudo_user', ''), ('svnfs_update_interval', 60), ('syndic_finger', ''), ('tcp_authentication_retries', 5), ('tcp_keepalive', True), ('tcp_keepalive_cnt', -1), ('tcp_keepalive_idle', 300), ('tcp_keepalive_intvl', -1), ('tcp_pub_port', 4510), ('tcp_pull_port', 4511), ('test', False), ('thorium_interval', 0.5), ('thorium_roots', OrderedDict([('base', ['/srv/thorium'])])), ('thorium_top', 'top.sls'), ('thoriumenv', None), ('top_file', ''), ('top_file_merging_strategy', 'merge'), ('transport', 'zeromq'), ('unique_jid', False), ('update_restart_services', []), ('update_url', False), ('use_master_when_local', False), ('user', 'root'), ('username', None), ('utils_dirs', ['/var/cache/salt/minion/extmods/utils']), ('verify_env', True), ('verify_master_pubkey_sign', False), ('whitelist_modules', []), ('winrepo_branch', 'master'), ('winrepo_cache_expire_max', 604800), ('winrepo_cache_expire_min', 1800), ('winrepo_cachefile', 'winrepo.p'), ('winrepo_dir', '/srv/salt/win/repo'), ('winrepo_dir_ng', '/srv/salt/win/repo-ng'), ('winrepo_fallback', ''), ('winrepo_insecure_auth', False), ('winrepo_passphrase', ''), ('winrepo_password', ''), ('winrepo_privkey', ''), ('winrepo_pubkey', ''), ('winrepo_refspecs', ['+refs/heads/*:refs/remotes/origin/*', '+refs/tags/*:refs/tags/*']), ('winrepo_remotes', ['https://github.com/saltstack/salt-winrepo.git']), ('winrepo_remotes_ng', ['https://github.com/saltstack/salt-winrepo-ng.git']), ('winrepo_source_dir', 'salt://win/repo-ng/'), ('winrepo_ssl_verify', True), ('winrepo_user', ''), ('zmq_filtering', False), ('zmq_monitor', False)])), ('pillar', OrderedDict([('sshd_config', OrderedDict([('PubkeyAuthentication', 'yes')]))])), ('proxy', OrderedDict()), ('raise', '<function jinja_raise at 0x7fbc9b166378>'), ('range', "<class 'range'>"), ('rendered_sls', 'set()'), ('renderers', '<salt.loader.FilterDictWrapper object at 0x7fbc99585d30>'), ('salt', '<salt.utils.templates.AliasedLoader object at 0x7fbc9957e390>'), ('saltenv', 'base'), ('show_full_context', '<function show_full_context at 0x7fbc9b0d1268>'), ('sls', 'foo.test'), ('sls_path', 'foo'), ('slscolonpath', 'foo'), ('slsdotpath', 'foo'), ('slspath', 'foo'), ('tpldir', 'foo'), ('tpldot', 'foo'), ('tplfile', 'foo/test.sls'), ('tplpath', '/var/cache/salt/minion/files/base/foo/test.sls'), ('tplroot', 'foo')]))]))])])])), ('test-context-content-without-context-import', OrderedDict([('file.managed', [OrderedDict([('name', '/tmp/context-without-context.txt')]), OrderedDict([('source', 'salt://foo/serialize_yaml.jinja')]), OrderedDict([('template', 'jinja')]), OrderedDict([('context', OrderedDict([('value', OrderedDict([('cycler', "<class 'jinja2.utils.Cycler'>"), ('dict', "<class 'dict'>"), ('grains', OrderedDict([('biosreleasedate', '04/01/2014'), ('biosversion', '1.12.0-1'), ('cpu_flags', ['fpu', 'de', 'pse', 'tsc', 'msr', 'pae', 'mce', 'cx8', 'apic', 'sep', 'mtrr', 'pge', 'mca', 'cmov', 'pse36', 'clflush', 'mmx', 'fxsr', 'sse', 'sse2', 'syscall', 'nx', 'lm', 'rep_good', 'nopl', 'xtopology', 'cpuid', 'tsc_known_freq', 'pni', 'cx16', 'x2apic', 'hypervisor', 'lahf_lm', 'cpuid_fault', 'pti']), ('cpu_model', 'QEMU Virtual CPU version 2.5+'), ('cpuarch', 'x86_64'), ('cwd', '/root'), ('disks', ['sr0', 'sda']), ('dns', OrderedDict([('domain', 'example.net'), ('ip4_nameservers', ['192.168.232.2']), ('ip6_nameservers', []), ('nameservers', ['192.168.232.2']), ('options', []), ('search', []), ('sortlist', [])])), ('domain', 'example.net'), ('fqdn', 'testmachine1.example.net'), ('fqdn_ip4', ['127.0.1.1', '127.0.1.1', '127.0.1.1']), ('fqdn_ip6', []), ('fqdns', ['git.example.net']), ('gid', 0), ('gpus', [OrderedDict([('model', 'GD 5446'), ('vendor', 'unknown')])]), ('groupname', 'root'), ('host', 'testmachine1'), ('hwaddr_interfaces', OrderedDict([('ens3', '02:00:c0:a8:00:65'), ('lo', '00:00:00:00:00:00')])), ('id', 'testmachine1.example.net'), ('init', 'systemd'), ('ip4_gw', '192.168.0.1'), ('ip4_interfaces', OrderedDict([('ens3', ['192.168.0.101']), ('lo', ['127.0.0.1'])])), ('ip6_gw', False), ('ip6_interfaces', OrderedDict([('ens3', ['fe80::c0ff:fea8:65']), ('lo', ['::1'])])), ('ip_gw', True), ('ip_interfaces', OrderedDict([('ens3', ['192.168.0.101', 'fe80::c0ff:fea8:65']), ('lo', ['127.0.0.1', '::1'])])), ('ipv4', ['127.0.0.1', '192.168.0.101']), ('ipv6', ['::1', 'fe80::c0ff:fea8:65']), ('kernel', 'Linux'), ('kernelparams', [['BOOT_IMAGE', '/vmlinuz-4.19.0-13-amd64'], ['root', '/dev/mapper/buster--vg-root'], ['ro', None], ['quiet', None]]), ('kernelrelease', '4.19.0-13-amd64'), ('kernelversion', '#1 SMP Debian 4.19.160-2 (2020-11-28)'), ('locale_info', OrderedDict([('defaultencoding', 'UTF-8'), ('defaultlanguage', 'fr_FR'), ('detectedencoding', 'UTF-8'), ('timezone', 'CEST')])), ('localhost', 'testmachine1'), ('lsb_distrib_codename', 'buster'), ('lsb_distrib_description', 'Debian GNU/Linux 10 (buster)'), ('lsb_distrib_id', 'Debian'), ('lsb_distrib_release', '10'), ('lvm', OrderedDict([('buster-vg', ['boot', 'home', 'root', 'swap_1', 'var'])])), ('machine_id', 'e585542c6fd5435d9476a899ff954d2f'), ('manufacturer', 'QEMU'), ('master', 'salt'), ('mem_total', 987), ('nodename', 'testmachine1'), ('num_cpus', 2), ('num_gpus', 1), ('os', 'Debian'), ('os_family', 'Debian'), ('osarch', 'amd64'), ('oscodename', 'buster'), ('osfinger', 'Debian-10'), ('osfullname', 'Debian'), ('osmajorrelease', 10), ('osrelease', '10'), ('osrelease_info', [10]), ('path', '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'), ('pid', 15048), ('productname', 'Standard PC (i440FX + PIIX, 1996)'), ('ps', 'ps -efHww'), ('pythonexecutable', '/usr/bin/python3'), ('pythonpath', ['/usr/bin', '/usr/lib/python37.zip', '/usr/lib/python3.7', '/usr/lib/python3.7/lib-dynload', '/usr/local/lib/python3.7/dist-packages', '/usr/lib/python3/dist-packages']), ('pythonversion', [3, 7, 3, 'final', 0]), ('saltpath', '/usr/lib/python3/dist-packages/salt'), ('saltversion', '3002.2'), ('saltversioninfo', [3002, 2]), ('serialnumber', ''), ('server_id', 1210026740), ('shell', '/bin/bash'), ('ssds', []), ('swap_total', 1275), ('systemd', OrderedDict([('features', '+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD -IDN2 +IDN -PCRE2 default-hierarchy=hybrid'), ('version', '241')])), ('systempath', ['/usr/local/sbin', '/usr/local/bin', '/usr/sbin', '/usr/bin', '/sbin', '/bin']), ('uid', 0), ('username', 'root'), ('uuid', '360dd003-33fd-4730-a314-135bb3385c56'), ('virtual', 'kvm'), ('zfs_feature_flags', False), ('zfs_support', False), ('zmqversion', '4.3.1')])), ('joiner', "<class 'jinja2.utils.Joiner'>"), ('lipsum', '<function generate_lorem_ipsum at 0x7fbc9e0e5620>'), ('namespace', "<class 'jinja2.utils.Namespace'>"), ('odict', "<class 'salt.utils.odict.OrderedDict'>"), ('opts', OrderedDict([('__cli', 'salt-call'), ('__role', 'minion'), ('acceptance_wait_time', 10), ('acceptance_wait_time_max', 0), ('always_verify_signature', False), ('append_minionid_config_dirs', []), ('arg', ['foo.test']), ('args_stdin', False), ('auth_safemode', False), ('auth_timeout', 5), ('auth_tries', 7), ('auto_accept', True), ('autoload_dynamic_modules', True), ('autosign_timeout', 120), ('azurefs_update_interval', 60), ('backup_mode', ''), ('beacons', OrderedDict()), ('beacons_before_connect', False), ('cache', 'localfs'), ('cache_jobs', False), ('cache_sreqs', True), ('cachedir', '/var/cache/salt/minion'), ('caller', True), ('clean_dynamic_modules', True), ('cluster_mode', False), ('cmd_safe', True), ('conf_file', '/etc/salt/minion'), ('config_dir', '/etc/salt'), ('cython_enable', False), ('decrypt_pillar', []), ('decrypt_pillar_default', 'gpg'), ('decrypt_pillar_delimiter', ':'), ('decrypt_pillar_renderers', ['gpg']), ('default_include', 'minion.d/*.conf'), ('default_top', 'base'), ('disable_modules', []), ('disable_returners', []), ('disabled_requisites', []), ('discovery', False), ('doc', False), ('enable_fqdns_grains', True), ('enable_gpu_grains', True), ('enable_legacy_startup_events', True), ('enable_zip_modules', False), ('engines', []), ('env_order', []), ('event_match_type', 'startswith'), ('ext_job_cache', ''), ('extension_modules', '/var/cache/salt/minion/extmods'), ('extmod_blacklist', OrderedDict()), ('extmod_whitelist', OrderedDict()), ('failhard', False), ('file_buffer_size', 262144), ('file_client', 'remote'), ('file_ignore_glob', []), ('file_ignore_regex', []), ('file_recv', False), ('file_recv_max_size', 100), ('file_roots', OrderedDict([('base', [])])), ('fileserver_backend', ['roots']), ('fileserver_followsymlinks', True), ('fileserver_ignoresymlinks', False), ('fileserver_limit_traversal', False), ('force_color', False), ('fun', 'state.apply'), ('git_pillar_base', 'master'), ('git_pillar_branch', 'master'), ('git_pillar_env', ''), ('git_pillar_fallback', ''), ('git_pillar_global_lock', True), ('git_pillar_includes', True), ('git_pillar_insecure_auth', False), ('git_pillar_passphrase', ''), ('git_pillar_password', ''), ('git_pillar_privkey', ''), ('git_pillar_pubkey', ''), ('git_pillar_refspecs', ['+refs/heads/*:refs/remotes/origin/*', '+refs/tags/*:refs/tags/*']), ('git_pillar_root', ''), ('git_pillar_ssl_verify', True), ('git_pillar_update_interval', 60), ('git_pillar_user', ''), ('gitfs_base', 'master'), ('gitfs_disable_saltenv_mapping', False), ('gitfs_fallback', ''), ('gitfs_global_lock', True), ('gitfs_insecure_auth', False), ('gitfs_mountpoint', ''), ('gitfs_passphrase', ''), ('gitfs_password', ''), ('gitfs_privkey', ''), ('gitfs_pubkey', ''), ('gitfs_ref_types', ['branch', 'tag', 'sha']), ('gitfs_refspecs', ['+refs/heads/*:refs/remotes/origin/*', '+refs/tags/*:refs/tags/*']), ('gitfs_remotes', []), ('gitfs_root', ''), ('gitfs_saltenv', []), ('gitfs_saltenv_blacklist', []), ('gitfs_saltenv_whitelist', []), ('gitfs_ssl_verify', True), ('gitfs_update_interval', 60), ('gitfs_user', ''), ('gpg_cache', False), ('gpg_cache_backend', 'disk'), ('gpg_cache_ttl', 86400), ('grains', OrderedDict([('biosreleasedate', '04/01/2014'), ('biosversion', '1.12.0-1'), ('cpu_flags', ['fpu', 'de', 'pse', 'tsc', 'msr', 'pae', 'mce', 'cx8', 'apic', 'sep', 'mtrr', 'pge', 'mca', 'cmov', 'pse36', 'clflush', 'mmx', 'fxsr', 'sse', 'sse2', 'syscall', 'nx', 'lm', 'rep_good', 'nopl', 'xtopology', 'cpuid', 'tsc_known_freq', 'pni', 'cx16', 'x2apic', 'hypervisor', 'lahf_lm', 'cpuid_fault', 'pti']), ('cpu_model', 'QEMU Virtual CPU version 2.5+'), ('cpuarch', 'x86_64'), ('cwd', '/root'), ('disks', ['sr0', 'sda']), ('dns', OrderedDict([('domain', 'example.net'), ('ip4_nameservers', ['192.168.232.2']), ('ip6_nameservers', []), ('nameservers', ['192.168.232.2']), ('options', []), ('search', []), ('sortlist', [])])), ('domain', 'example.net'), ('fqdn', 'testmachine1.example.net'), ('fqdn_ip4', ['127.0.1.1', '127.0.1.1', '127.0.1.1']), ('fqdn_ip6', []), ('fqdns', ['git.example.net']), ('gid', 0), ('gpus', [OrderedDict([('model', 'GD 5446'), ('vendor', 'unknown')])]), ('groupname', 'root'), ('host', 'testmachine1'), ('hwaddr_interfaces', OrderedDict([('ens3', '02:00:c0:a8:00:65'), ('lo', '00:00:00:00:00:00')])), ('id', 'testmachine1.example.net'), ('init', 'systemd'), ('ip4_gw', '192.168.0.1'), ('ip4_interfaces', OrderedDict([('ens3', ['192.168.0.101']), ('lo', ['127.0.0.1'])])), ('ip6_gw', False), ('ip6_interfaces', OrderedDict([('ens3', ['fe80::c0ff:fea8:65']), ('lo', ['::1'])])), ('ip_gw', True), ('ip_interfaces', OrderedDict([('ens3', ['192.168.0.101', 'fe80::c0ff:fea8:65']), ('lo', ['127.0.0.1', '::1'])])), ('ipv4', ['127.0.0.1', '192.168.0.101']), ('ipv6', ['::1', 'fe80::c0ff:fea8:65']), ('kernel', 'Linux'), ('kernelparams', [['BOOT_IMAGE', '/vmlinuz-4.19.0-13-amd64'], ['root', '/dev/mapper/buster--vg-root'], ['ro', None], ['quiet', None]]), ('kernelrelease', '4.19.0-13-amd64'), ('kernelversion', '#1 SMP Debian 4.19.160-2 (2020-11-28)'), ('locale_info', OrderedDict([('defaultencoding', 'UTF-8'), ('defaultlanguage', 'fr_FR'), ('detectedencoding', 'UTF-8'), ('timezone', 'CEST')])), ('localhost', 'testmachine1'), ('lsb_distrib_codename', 'buster'), ('lsb_distrib_description', 'Debian GNU/Linux 10 (buster)'), ('lsb_distrib_id', 'Debian'), ('lsb_distrib_release', '10'), ('lvm', OrderedDict([('buster-vg', ['boot', 'home', 'root', 'swap_1', 'var'])])), ('machine_id', 'e585542c6fd5435d9476a899ff954d2f'), ('manufacturer', 'QEMU'), ('master', 'salt'), ('mem_total', 987), ('nodename', 'testmachine1'), ('num_cpus', 2), ('num_gpus', 1), ('os', 'Debian'), ('os_family', 'Debian'), ('osarch', 'amd64'), ('oscodename', 'buster'), ('osfinger', 'Debian-10'), ('osfullname', 'Debian'), ('osmajorrelease', 10), ('osrelease', '10'), ('osrelease_info', [10]), ('path', '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'), ('pid', 15048), ('productname', 'Standard PC (i440FX + PIIX, 1996)'), ('ps', 'ps -efHww'), ('pythonexecutable', '/usr/bin/python3'), ('pythonpath', ['/usr/bin', '/usr/lib/python37.zip', '/usr/lib/python3.7', '/usr/lib/python3.7/lib-dynload', '/usr/local/lib/python3.7/dist-packages', '/usr/lib/python3/dist-packages']), ('pythonversion', [3, 7, 3, 'final', 0]), ('saltpath', '/usr/lib/python3/dist-packages/salt'), ('saltversion', '3002.2'), ('saltversioninfo', [3002, 2]), ('serialnumber', ''), ('server_id', 1210026740), ('shell', '/bin/bash'), ('ssds', []), ('swap_total', 1275), ('systemd', OrderedDict([('features', '+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD -IDN2 +IDN -PCRE2 default-hierarchy=hybrid'), ('version', '241')])), ('systempath', ['/usr/local/sbin', '/usr/local/bin', '/usr/sbin', '/usr/bin', '/sbin', '/bin']), ('uid', 0), ('username', 'root'), ('uuid', '360dd003-33fd-4730-a314-135bb3385c56'), ('virtual', 'kvm'), ('zfs_feature_flags', False), ('zfs_support', False), ('zmqversion', '4.3.1')])), ('grains_blacklist', []), ('grains_cache', False), ('grains_cache_expiration', 300), ('grains_deep_merge', False), ('grains_dirs', []), ('grains_refresh_every', 0), ('grains_run', False), ('hard_crash', False), ('hash_type', 'sha256'), ('hgfs_update_interval', 60), ('http_connect_timeout', 20.0), ('http_max_body', 107374182400), ('http_request_timeout', 3600.0), ('id', 'testmachine1.example.net'), ('id_function', OrderedDict()), ('interface', '0.0.0.0'), ('ipc_mode', 'ipc'), ('ipc_write_buffer', 0), ('ipv6', None), ('jinja_env', OrderedDict()), ('jinja_lstrip_blocks', False), ('jinja_sls_env', OrderedDict()), ('jinja_trim_blocks', False), ('keysize', 2048), ('local', False), ('lock_saltenv', False), ('log_datefmt', '%H:%M:%S'), ('log_datefmt_console', '%H:%M:%S'), ('log_datefmt_logfile', '%Y-%m-%d %H:%M:%S'), ('log_file', '/var/log/salt/minion'), ('log_fmt_console', '[%(levelname)-8s] %(message)s'), ('log_fmt_jid', '[JID: %(jid)s]'), ('log_fmt_logfile', '%(asctime)s,%(msecs)03d [%(name)-17s:%(lineno)-4d][%(levelname)-8s][%(process)d] %(message)s'), ('log_granular_levels', OrderedDict()), ('log_level', 'debug'), ('log_level_logfile', 'warning'), ('log_rotate_backup_count', 0), ('log_rotate_max_bytes', 0), ('loop_interval', 1), ('master', 'salt'), ('master_alive_interval', 0), ('master_failback', False), ('master_failback_interval', 0), ('master_finger', ''), ('master_ip', '192.168.0.101'), ('master_port', 4506), ('master_shuffle', False), ('master_sign_key_name', 'master_sign'), ('master_tops_first', False), ('master_tries', 1), ('master_type', 'str'), ('master_uri', 'tcp://192.168.0.101:4506'), ('master_uri_format', 'default'), ('max_event_size', 1048576), ('mine_enabled', True), ('mine_interval', 60), ('mine_return_job', False), ('minion_id_caching', True), ('minion_id_lowercase', False), ('minion_id_remove_domain', False), ('minion_jid_queue_hwm', 100), ('minion_restart_command', []), ('minion_sign_messages', False), ('minionfs_update_interval', 60), ('module_dirs', []), ('modules_max_memory', -1), ('multifunc_ordered', False), ('multiprocessing', True), ('no_color', False), ('no_parse', []), ('nodegroups', OrderedDict()), ('on_demand_ext_pillar', ['libvirt', 'virtkey']), ('open_mode', False), ('optimization_order', [0, 1, 2]), ('output_file_append', False), ('outputter_dirs', []), ('password', None), ('permissive_pki_access', False), ('pidfile', '/var/run/salt-minion.pid'), ('pillar', OrderedDict([('sshd_config', OrderedDict([('PubkeyAuthentication', 'yes')]))])), ('pillar_cache', False), ('pillar_cache_backend', 'disk'), ('pillar_cache_ttl', 3600), ('pillar_includes_override_sls', False), ('pillar_merge_lists', False), ('pillar_opts', False), ('pillar_roots', OrderedDict([('base', ['/srv/pillar', '/srv/spm/pillar'])])), ('pillar_source_merging_strategy', 'smart'), ('pillarenv', None), ('pillarenv_from_saltenv', False), ('ping_interval', 0), ('pki_dir', '/etc/salt/pki/minion'), ('print_metadata', False), ('process_count_max', -1), ('profiling_enabled', False), ('profiling_path', '/tmp/stats'), ('providers', OrderedDict()), ('proxy_host', ''), ('proxy_password', ''), ('proxy_port', 0), ('proxy_username', ''), ('pub_ret', True), ('publisher_acl', OrderedDict()), ('publisher_acl_blacklist', OrderedDict()), ('random_master', False), ('random_reauth_delay', 10), ('random_startup_delay', 0), ('range_server', 'range:80'), ('reactor_refresh_interval', 60), ('reactor_worker_hwm', 10000), ('reactor_worker_threads', 10), ('recon_default', 1000), ('recon_max', 10000), ('recon_randomize', True), ('refresh_grains_cache', False), ('rejected_retry', False), ('render_dirs', []), ('renderer', 'jinja|yaml'), ('renderer_blacklist', []), ('renderer_whitelist', []), ('resolve_dns_fallback', True), ('restart_on_error', False), ('retcode_passthrough', False), ('retry_dns', 30), ('retry_dns_count', None), ('return', ''), ('return_retry_timer', 5), ('return_retry_timer_max', 10), ('returner_dirs', []), ('root_dir', '/'), ('roots_update_interval', 60), ('s3fs_update_interval', 60), ('salt_cp_chunk_size', 65536), ('saltenv', 'base'), ('schedule', OrderedDict([('__mine_interval', OrderedDict([('enabled', True), ('function', 'mine.update'), ('jid_include', True), ('maxrunning', 2), ('minutes', 60), ('return_job', False), ('run_on_start', True)]))])), ('scheduler_before_connect', False), ('selected_output_option', 'state_output'), ('sign_pub_messages', False), ('skip_grains', False), ('sls_list', []), ('snapper_states', False), ('snapper_states_config', 'root'), ('sock_dir', '/var/run/salt/minion'), ('sock_pool_size', 1), ('source_address', ''), ('source_interface_name', ''), ('source_publish_port', 0), ('source_ret_port', 0), ('ssh_merge_pillar', True), ('ssl', None), ('start_event_grains', []), ('startup_states', ''), ('state_aggregate', False), ('state_auto_order', True), ('state_events', False), ('state_output', 'full'), ('state_output_diff', False), ('state_top', 'salt://top.sls'), ('state_top_saltenv', None), ('state_verbose', True), ('states_dirs', []), ('sudo_user', ''), ('svnfs_update_interval', 60), ('syndic_finger', ''), ('tcp_authentication_retries', 5), ('tcp_keepalive', True), ('tcp_keepalive_cnt', -1), ('tcp_keepalive_idle', 300), ('tcp_keepalive_intvl', -1), ('tcp_pub_port', 4510), ('tcp_pull_port', 4511), ('test', False), ('thorium_interval', 0.5), ('thorium_roots', OrderedDict([('base', ['/srv/thorium'])])), ('thorium_top', 'top.sls'), ('thoriumenv', None), ('top_file', ''), ('top_file_merging_strategy', 'merge'), ('transport', 'zeromq'), ('unique_jid', False), ('update_restart_services', []), ('update_url', False), ('use_master_when_local', False), ('user', 'root'), ('username', None), ('utils_dirs', ['/var/cache/salt/minion/extmods/utils']), ('verify_env', True), ('verify_master_pubkey_sign', False), ('whitelist_modules', []), ('winrepo_branch', 'master'), ('winrepo_cache_expire_max', 604800), ('winrepo_cache_expire_min', 1800), ('winrepo_cachefile', 'winrepo.p'), ('winrepo_dir', '/srv/salt/win/repo'), ('winrepo_dir_ng', '/srv/salt/win/repo-ng'), ('winrepo_fallback', ''), ('winrepo_insecure_auth', False), ('winrepo_passphrase', ''), ('winrepo_password', ''), ('winrepo_privkey', ''), ('winrepo_pubkey', ''), ('winrepo_refspecs', ['+refs/heads/*:refs/remotes/origin/*', '+refs/tags/*:refs/tags/*']), ('winrepo_remotes', ['https://github.com/saltstack/salt-winrepo.git']), ('winrepo_remotes_ng', ['https://github.com/saltstack/salt-winrepo-ng.git']), ('winrepo_source_dir', 'salt://win/repo-ng/'), ('winrepo_ssl_verify', True), ('winrepo_user', ''), ('zmq_filtering', False), ('zmq_monitor', False)])), ('pillar', OrderedDict([('sshd_config', OrderedDict([('PubkeyAuthentication', 'yes')]))])), ('proxy', OrderedDict()), ('raise', '<function jinja_raise at 0x7fbc9b166378>'), ('range', "<class 'range'>"), ('rendered_sls', 'set()'), ('renderers', '<salt.loader.FilterDictWrapper object at 0x7fbc99585d30>'), ('salt', '<salt.utils.templates.AliasedLoader object at 0x7fbc9957e390>'), ('saltenv', 'base'), ('show_full_context', '<function show_full_context at 0x7fbc9b0d1268>'), ('sls', 'foo.test'), ('sls_path', 'foo'), ('slscolonpath', 'foo'), ('slsdotpath', 'foo'), ('slspath', 'foo'), ('tpldir', 'foo'), ('tpldot', 'foo'), ('tplfile', 'foo/test-context.jinja'), ('tplpath', '/var/cache/salt/minion/files/base/foo/test.sls')]))]))])])])), ('test-context-diff-between-with-context-and-without', OrderedDict([('cmd.run', [OrderedDict([('name', 'diff -u /tmp/context-with-context.txt /tmp/context-without-context.txt')])])]))])
[PROFILE ] Time (in seconds) to render '/var/cache/salt/minion/files/base/foo/test.sls' using 'yaml' renderer: 0.02126455307006836
[DEBUG   ] LazyLoaded config.option
[DEBUG   ] LazyLoaded file.managed
[INFO    ] Running state [/tmp/context-with-context.txt] at time 14:21:12.214243
[INFO    ] Executing state file.managed for [/tmp/context-with-context.txt]
[DEBUG   ] LazyLoaded file.source_list
[DEBUG   ] LazyLoaded cp.hash_file
[DEBUG   ] Initializing new AsyncZeroMQReqChannel for ('/etc/salt/pki/minion', 'testmachine1.example.net', 'tcp://192.168.0.101:4506', 'aes')
[DEBUG   ] Initializing new AsyncAuth for ('/etc/salt/pki/minion', 'testmachine1.example.net', 'tcp://192.168.0.101:4506')
[DEBUG   ] Connecting the Minion to the Master URI (for the return server): tcp://192.168.0.101:4506
[DEBUG   ] Trying to connect to: tcp://192.168.0.101:4506
[DEBUG   ] In saltenv 'base', looking at rel_path 'foo/serialize_yaml.jinja' to resolve 'salt://foo/serialize_yaml.jinja'
[DEBUG   ] In saltenv 'base', ** considering ** path '/var/cache/salt/minion/files/base/foo/serialize_yaml.jinja' to resolve 'salt://foo/serialize_yaml.jinja'
[DEBUG   ] Jinja search path: ['/var/cache/salt/minion/files/base']
[DEBUG   ] LazyLoaded slsutil.serialize
[INFO    ] File changed:
New file
[INFO    ] Completed state [/tmp/context-with-context.txt] at time 14:21:12.256603 (duration_in_ms=42.36)
[INFO    ] Running state [/tmp/context-without-context.txt] at time 14:21:12.256828
[INFO    ] Executing state file.managed for [/tmp/context-without-context.txt]
[DEBUG   ] In saltenv 'base', looking at rel_path 'foo/serialize_yaml.jinja' to resolve 'salt://foo/serialize_yaml.jinja'
[DEBUG   ] In saltenv 'base', ** considering ** path '/var/cache/salt/minion/files/base/foo/serialize_yaml.jinja' to resolve 'salt://foo/serialize_yaml.jinja'
[DEBUG   ] Jinja search path: ['/var/cache/salt/minion/files/base']
[INFO    ] File changed:
New file
[INFO    ] Completed state [/tmp/context-without-context.txt] at time 14:21:12.285906 (duration_in_ms=29.079)
[DEBUG   ] LazyLoaded cmd.run
[INFO    ] Running state [diff -u /tmp/context-with-context.txt /tmp/context-without-context.txt] at time 14:21:12.286663
[INFO    ] Executing state cmd.run for [diff -u /tmp/context-with-context.txt /tmp/context-without-context.txt]
[DEBUG   ] LazyLoaded cmd.run_all
[INFO    ] Executing command 'diff -u /tmp/context-with-context.txt /tmp/context-without-context.txt' in directory '/root'
[ERROR   ] Command 'diff -u /tmp/context-with-context.txt /tmp/context-without-context.txt' failed with return code: 1
[ERROR   ] stdout: --- /tmp/context-with-context.txt	2021-03-31 14:21:12.254006551 +0200
+++ /tmp/context-without-context.txt	2021-03-31 14:21:12.282007616 +0200
@@ -762,7 +762,6 @@
 slspath: foo
 tpldir: foo
 tpldot: foo
-tplfile: foo/test.sls
+tplfile: foo/test-context.jinja
 tplpath: /var/cache/salt/minion/files/base/foo/test.sls
-tplroot: foo
 ...
[ERROR   ] retcode: 1
[ERROR   ] {'pid': 15136, 'retcode': 1, 'stdout': '--- /tmp/context-with-context.txt\t2021-03-31 14:21:12.254006551 +0200\n+++ /tmp/context-without-context.txt\t2021-03-31 14:21:12.282007616 +0200\n@@ -762,7 +762,6 @@\n slspath: foo\n tpldir: foo\n tpldot: foo\n-tplfile: foo/test.sls\n+tplfile: foo/test-context.jinja\n tplpath: /var/cache/salt/minion/files/base/foo/test.sls\n-tplroot: foo\n ...', 'stderr': ''}
[INFO    ] Completed state [diff -u /tmp/context-with-context.txt /tmp/context-without-context.txt] at time 14:21:12.295216 (duration_in_ms=8.552)
[DEBUG   ] File /var/cache/salt/minion/accumulator/140448021739392 does not exist, no need to cleanup
[DEBUG   ] LazyLoaded state.check_result
[DEBUG   ] Initializing new AsyncZeroMQReqChannel for ('/etc/salt/pki/minion', 'testmachine1.example.net', 'tcp://192.168.0.101:4506', 'aes')
[DEBUG   ] Initializing new AsyncAuth for ('/etc/salt/pki/minion', 'testmachine1.example.net', 'tcp://192.168.0.101:4506')
[DEBUG   ] Connecting the Minion to the Master URI (for the return server): tcp://192.168.0.101:4506
[DEBUG   ] Trying to connect to: tcp://192.168.0.101:4506
[DEBUG   ] Closing AsyncZeroMQReqChannel instance
[DEBUG   ] LazyLoaded highstate.output
[DEBUG   ] LazyLoaded nested.output
[DEBUG   ] LazyLoaded nested.output
[DEBUG   ] LazyLoaded nested.output
[DEBUG   ] Closing AsyncZeroMQReqChannel instance
[DEBUG   ] Closing AsyncZeroMQReqChannel instance
[DEBUG   ] Closing AsyncZeroMQReqChannel instance
local:
----------
          ID: test-context-content-with-context-import
    Function: file.managed
        Name: /tmp/context-with-context.txt
      Result: True
     Comment: File /tmp/context-with-context.txt updated
     Started: 14:21:12.214243
    Duration: 42.36 ms
     Changes:   
              ----------
              diff:
                  New file
              mode:
                  0644
----------
          ID: test-context-content-without-context-import
    Function: file.managed
        Name: /tmp/context-without-context.txt
      Result: True
     Comment: File /tmp/context-without-context.txt updated
     Started: 14:21:12.256827
    Duration: 29.079 ms
     Changes:   
              ----------
              diff:
                  New file
              mode:
                  0644
----------
          ID: test-context-diff-between-with-context-and-without
    Function: cmd.run
        Name: diff -u /tmp/context-with-context.txt /tmp/context-without-context.txt
      Result: False
     Comment: Command "diff -u /tmp/context-with-context.txt /tmp/context-without-context.txt" run
     Started: 14:21:12.286664
    Duration: 8.552 ms
     Changes:   
              ----------
              pid:
                  15136
              retcode:
                  1
              stderr:
              stdout:
                  --- /tmp/context-with-context.txt	2021-03-31 14:21:12.254006551 +0200
                  +++ /tmp/context-without-context.txt	2021-03-31 14:21:12.282007616 +0200
                  @@ -762,7 +762,6 @@
                   slspath: foo
                   tpldir: foo
                   tpldot: foo
                  -tplfile: foo/test.sls
                  +tplfile: foo/test-context.jinja
                   tplpath: /var/cache/salt/minion/files/base/foo/test.sls
                  -tplroot: foo
                   ...

Summary for local
------------
Succeeded: 2 (changed=3)
Failed:    1
------------
Total states run:     3
Total run time:  79.991 ms

Copy link
Member

@noelmcloughlin noelmcloughlin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. thanks @baby-gnu

@baby-gnu
Copy link
Contributor Author

Thanks @noelmcloughlin for the review.

I see no formula using ../map.jinja but near all of them use with context, so may not be so easily automated with ssf-formula

🤔

I see some map.jinja settings in ssf-formula so it may not be that hard, like for the cert-formula.

`tplroot` can't be set correctly when the import:

- is done from another top directory than the formula directory
- the import is done `with context`

In this case, the `tpldir` is set to the directory of the importer
`.sls` file instead of the `.jinja` imported one.

We force the `without context` which permits to directly use `tpldir`
as the `tplroot` which is the directory of the imported file.

BREAKING CHANGE: `map.jinja` import must use `without context`

BREAKING CHANGE: `libmapstack.jinja` import must use `without context`

BREAKING CHANGE: `libmatchers.jinja` import must use `without context`
@baby-gnu baby-gnu force-pushed the feature/import-mapdata-from-outside-formula branch from f5b37d2 to 1555e42 Compare September 6, 2021 13:03
@Sxderp
Copy link

Sxderp commented Jul 28, 2022

I think this would break our workflow. We have many formulas and we want to use a single version of tofs for all of them rather than including the file in all of the formulas. This significantly reduces duplication.

The directory tree is something like:

$ tree
.
├── ssh
│   ├── client.sls
│   ├── files
│   │   ├── default
│   │   │   └── etc
│   │   │       └── ssh
│   │   │           └── ssh_known_hosts.tmpl
│   │   └── MacOS
│   │       └── etc
│   │           └── ssh
│   │               ├── ssh_config.tmpl
│   │               └── sshd_config.tmpl
│   ├── init.sls
│   ├── keys.sls
│   ├── known_hosts.sls
│   ├── parameters
│   │   ├── defaults.yaml
│   │   └── os_family
│   │       ├── MacOS.yaml
│   │       └── Windows.yaml
│   ├── pillar.example
│   └── server.sls
└── _tofs
    ├── libmapstack.jinja
    ├── libmatchers.jinja
    ├── libsaltcli.jinja
    ├── libtofs.jinja
    ├── map.jinja
    └── README.md
# cat ssh/client.sls
{%- from "_tofs/libtofs.jinja" import files_switch with context %}
{%- from "_tofs/map.jinja" import mapdata with context %}

ssh_config:
  file.managed:
    - name: {{ mapdata['filename'] }}
    - source: {{ files_switch(
                   ["/etc/ssh/ssh_config.tmpl"],
                   lookup="ssh_config",
                 )
              }}
    - user: root
    - group: wheel
    - mode: "0644"
    - template: jinja

By importing with context we can keep the tofs files in a different directory and it still correctly finds the tplroot of the formula. I haven't tested this change, but if it forces imports "without context" then I believe our setup will break.

The tofs files are supposed to be considered "library" files, so I think it would be silly to make them function based on their location rather than the location of the file doing the import. Alternatively, someone could just supply a "without context" if they want that (incredibly weird) functionality.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants