Skip to content

state.low: KeyError: '__id__' #45682

Description

@jasperla

Description of Issue/Question

state.low expects an explicit __id__.

Setup

CentOS 7; salt installed with bootstrap script.

Steps to Reproduce Issue

The documentation of state.low suggests the following should work:

[root@salt salt]# salt salt\* state.low '{"state": "file", "fun": "exists", "name": "/etc/fstab"}'
salt.localdomain:
    The minion function caused an exception: Traceback (most recent call last):
      File "/usr/lib/python2.7/site-packages/salt/minion.py", line 1470, in _thread_return
        return_data = executor.execute()
      File "/usr/lib/python2.7/site-packages/salt/executors/direct_call.py", line 28, in execute
        return self.func(*self.args, **self.kwargs)
      File "/usr/lib/python2.7/site-packages/salt/modules/state.py", line 312, in low
        ret = st_.call(data)
      File "/usr/lib/python2.7/site-packages/salt/state.py", line 1901, in call
        ret['__id__'] = low['__id__']
    KeyError: '__id__'
[root@salt salt]#

However it does not because no explicit __id__ is added. The state compiler explicitly references this key since #26780.

So either the documentation needs to be updated to reflect the need to explicitly pass __id__, or State.call() needs to handle it being absent.

Also, tests for state.low have not caught this for some reason.

Versions Report

Salt Version:
           Salt: 2017.7.2

Dependency Versions:
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: Not Installed
      docker-py: Not Installed
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
         Jinja2: 2.7.2
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.4.8
   mysql-python: Not Installed
      pycparser: Not Installed
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: Not Installed
         Python: 2.7.5 (default, Aug  4 2017, 00:39:18)
   python-gnupg: Not Installed
         PyYAML: 3.11
          PyZMQ: 15.3.0
           RAET: Not Installed
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.1.4

System Versions:
           dist: centos 7.4.1708 Core
         locale: ANSI_X3.4-1968
        machine: x86_64
        release: 3.10.0-693.11.6.el7.x86_64
         system: Linux
        version: CentOS Linux 7.4.1708 Core

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Corerelates to code central or existential to Saltbugbroken, incorrect, or confusing behaviorseverity-medium3rd level, incorrect or bad functionality, confusing and lacks a work around

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions