Skip to content

mine.get returns different dictionary format in version 3000 #56118

@ryanmilne-digicert

Description

@ryanmilne-digicert

I created couple new servers today and noticed that the output of the mine function I use for getting the ip address of the minion is returning in a different format. I can find documentation about the change in format for defining a mine function, but nothing noting the difference in output.

Am I overlooking something?

Set

mine function definition (via pillar):

mine_functions:
  internal_ip:
    - mine_function: grains.get
    - fqdn_ip4
  internal_ips:
    - mine_function: grains.get
    - ipv4

command to get mine data:

salt saltmaster mine.get '*' internal_ip

expected output:

    minion_name:
        - 10.1.2.3

received output:

    minion_name:
        ----------
        __data__:
            - 10.1.2.3
        __saltmine_acl__:
            1

When used in a jinja template I receive an error that there is not an element 0

{% for server, addr in salt['mine.get'](match, 'internal_ip', tgt_type='compound').items() | sort(case_sensitive=False) -%}
{{ host }}     IN    A   {{ addr[0] }}
{% endfor -%}
          ID: zone_file
    Function: file.managed
        Name: /var/named/chroot/etc/named/name.zone
      Result: False
     Comment: An exception occurred in this state: Traceback (most recent call last):
                File "/usr/lib/python2.7/site-packages/salt/state.py", line 1933, in call
                  **cdata['kwargs'])
                File "/usr/lib/python2.7/site-packages/salt/loader.py", line 1951, in wrapper
                  return f(*args, **kwargs)
                File "/usr/lib/python2.7/site-packages/salt/states/file.py", line 2769, in managed
                  **kwargs
                File "/usr/lib/python2.7/site-packages/salt/modules/file.py", line 4824, in check_managed_changes
                  **kwargs)
                File "/usr/lib/python2.7/site-packages/salt/modules/file.py", line 4265, in get_managed
                  **kwargs)
                File "/usr/lib/python2.7/site-packages/salt/utils/templates.py", line 169, in render_tmpl
                  output = render_str(tmplstr, context, tmplpath)
                File "/usr/lib/python2.7/site-packages/salt/utils/templates.py", line 404, in render_jinja_tmpl
                  buf=tmplstr)
              SaltRenderError: Jinja variable dict object has no element 0
     Started: 21:07:23.444192
    Duration: 1053.174 ms
     Changes:

Versions Report

Salt Version:
           Salt: 3000

Dependency Versions:
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: Not Installed
      docker-py: Not Installed
          gitdb: Not Installed
      gitpython: Not Installed
         Jinja2: 2.7.2
        libgit2: Not Installed
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.6.2
   mysql-python: Not Installed
      pycparser: Not Installed
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: Not Installed
         Python: 2.7.5 (default, Aug  7 2019, 00:51:29)
   python-gnupg: Not Installed
         PyYAML: 3.11
          PyZMQ: 15.3.0
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.5.3
            ZMQ: 4.1.4

System Versions:
           dist: centos 7.7.1908 Core
         locale: UTF-8
        machine: x86_64
        release: 3.10.0-1062.12.1.el7.x86_64
         system: Linux
        version: CentOS Linux 7.7.1908 Core

Metadata

Metadata

Assignees

Labels

P3Priority 3bugbroken, incorrect, or confusing behaviorfixed-pls-verifyfix is linked, bug author to confirm fixseverity-medium3rd level, incorrect or bad functionality, confusing and lacks a work aroundv3000.1vulnerable version

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions