saltstack / saltstack/salt

[BUG] Wrong module function results in confusing KeyError

Open
#57,888 3 comments 0 reactions 1 assignee View on GitHub

@krionbsd is already working on this.

Since Jul 9, 2020.

bug FreeBSD severity-medium
Dominant language
Python
Stars
15.7k
Forks
5.6k
Avg merge
2d 44m
Merged PRs (30d)
80

Description

Description
onlyif doesn't accept zfs.filesystem_absent module

Setup

State:

{{ jailname }}_oncourse-template-snapshot:
  cmd.run:
    - name: fetch https://xyz.com/repository/zfs/oncourse-{{ jail.version }}.bz2 -o - | bzcat | zfs recv -F tank/jails/templates/oncourse-{{ jail.version }}
    - onlyif:
      - fun: zfs.filesystem_absent
        name: {{ zfs_pool }}/jails/templates/oncourse-{{ jail.version }}@{{ jail.version }}

output:

          ID: yc_oncourse-template-snapshot
    Function: cmd.run
        Name: fetch https://xyz.com/repository/zfs/oncourse-28.bz2 -o - | bzcat | zfs recv -F tank/jails/templates/oncourse-28
      Result: False
     Comment: An exception occurred in this state: Traceback (most recent call last):
                File "/usr/local/lib/python3.7/site-packages/salt/state.py", line 2118, in call
                  ret.update(self._run_check(low))
                File "/usr/local/lib/python3.7/site-packages/salt/state.py", line 890, in _run_check
                  _ret = self._run_check_onlyif(low_data, cmd_opts)
                File "/usr/local/lib/python3.7/site-packages/salt/state.py", line 963, in _run_check_onlyif
                  result = self._run_check_function(entry)
                File "/usr/local/lib/python3.7/site-packages/salt/state.py", line 921, in _run_check_function
                  return self.functions[fun](*cdata["args"], **cdata["kwargs"])
                File "/usr/local/lib/python3.7/site-packages/salt/loader.py", line 1278, in __getitem__
                  func = super(LazyLoader, self).__getitem__(item)
                File "/usr/local/lib/python3.7/site-packages/salt/utils/lazy.py", line 108, in __getitem__
                  raise KeyError(key)
              KeyError: 'zfs.filesystem_absent'

Versions Report

# salt --versions-report
Salt Version:
           Salt: 3001

Dependency Versions:
           cffi: 1.14.0
       cherrypy: Not Installed
       dateutil: 2.8.1
      docker-py: Not Installed
          gitdb: Not Installed
      gitpython: Not Installed
         Jinja2: 2.11.2
        libgit2: Not Installed
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.6.2
   mysql-python: 1.4.6
      pycparser: 2.20
       pycrypto: 2.6.1
   pycryptodome: 3.9.7
         pygit2: Not Installed
         Python: 3.7.7 (default, Jun 22 2020, 07:58:14)
   python-gnupg: Not Installed
         PyYAML: 5.3.1
          PyZMQ: 19.0.1
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.5.3
            ZMQ: 4.3.1

System Versions:
           dist: freebsd 12.1
         locale: UTF-8
        machine: amd64
        release: 12.1-RELEASE-p1
         system: FreeBSD
        version: FreeBSD 12.1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.