salt-ext-modules-vmware icon indicating copy to clipboard operation
salt-ext-modules-vmware copied to clipboard

`saltext.vmware.states.license_mgr.present` and `saltext.vmware.states.license_mgr.absent` fail with `KeyError: 'changes'`

Open ggiesen opened this issue 2 years ago • 1 comments

Using the saltext.vmware.states.license_mgr.present state module fails with fails with KeyError: 'changes'.

licence_present.sls:

licence_vsphere:
   vmware_license_mgr.present:
     - license_key: 1A1AA-11111-111AA-1A1AA-1AAAA

Using a vcenter proxy:

vc01:
    The minion function caused an exception: Traceback (most recent call last):
      File "/usr/lib/python3.6/site-packages/salt/metaproxy/proxy.py", line 483, in thread_return
        opts, data, func, args, kwargs
      File "/usr/lib/python3.6/site-packages/salt/loader/lazy.py", line 149, in __call__
        return self.loader.run(run_func, *args, **kwargs)
      File "/usr/lib/python3.6/site-packages/salt/loader/lazy.py", line 1201, in run
        return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
      File "/usr/lib/python3.6/site-packages/contextvars/__init__.py", line 38, in run
        return callable(*args, **kwargs)
      File "/usr/lib/python3.6/site-packages/salt/loader/lazy.py", line 1216, in _run_as
        return _func_or_method(*args, **kwargs)
      File "/usr/lib/python3.6/site-packages/salt/executors/direct_call.py", line 10, in execute
        return func(*args, **kwargs)
      File "/usr/lib/python3.6/site-packages/salt/loader/lazy.py", line 149, in __call__
        return self.loader.run(run_func, *args, **kwargs)
      File "/usr/lib/python3.6/site-packages/salt/loader/lazy.py", line 1201, in run
        return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
      File "/usr/lib/python3.6/site-packages/contextvars/__init__.py", line 38, in run
        return callable(*args, **kwargs)
      File "/usr/lib/python3.6/site-packages/salt/loader/lazy.py", line 1216, in _run_as
        return _func_or_method(*args, **kwargs)
      File "/usr/lib/python3.6/site-packages/salt/modules/state.py", line 793, in apply_
        return sls(mods, **kwargs)
      File "/usr/lib/python3.6/site-packages/salt/modules/state.py", line 1392, in sls
        ret = st_.state.call_high(high_, orchestration_jid)
      File "/usr/lib/python3.6/site-packages/salt/state.py", line 3279, in call_high
        ret = self.call_chunks(chunks)
      File "/usr/lib/python3.6/site-packages/salt/state.py", line 2497, in call_chunks
        running = self.call_chunk(low, running, chunks)
      File "/usr/lib/python3.6/site-packages/salt/state.py", line 3003, in call_chunk
        running[tag] = self.call(low, chunks, running)
      File "/usr/lib/python3.6/site-packages/salt/utils/decorators/state.py", line 45, in _func
        result = func(*args, **kwargs)
      File "/usr/lib/python3.6/site-packages/salt/state.py", line 2237, in call
        self.check_refresh(low, ret)
      File "/usr/lib/python3.6/site-packages/salt/state.py", line 1253, in check_refresh
        if not ret["changes"]:
    KeyError: 'changes'

licence_absent.sls:

licence_vsphere:
   vmware_license_mgr.absent:
     - license_key: 1A1AA-11111-111AA-1A1AA-1AAAA
vc01:
    The minion function caused an exception: Traceback (most recent call last):
      File "/usr/lib/python3.6/site-packages/salt/metaproxy/proxy.py", line 483, in thread_return
        opts, data, func, args, kwargs
      File "/usr/lib/python3.6/site-packages/salt/loader/lazy.py", line 149, in __call__
        return self.loader.run(run_func, *args, **kwargs)
      File "/usr/lib/python3.6/site-packages/salt/loader/lazy.py", line 1201, in run
        return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
      File "/usr/lib/python3.6/site-packages/contextvars/__init__.py", line 38, in run
        return callable(*args, **kwargs)
      File "/usr/lib/python3.6/site-packages/salt/loader/lazy.py", line 1216, in _run_as
        return _func_or_method(*args, **kwargs)
      File "/usr/lib/python3.6/site-packages/salt/executors/direct_call.py", line 10, in execute
        return func(*args, **kwargs)
      File "/usr/lib/python3.6/site-packages/salt/loader/lazy.py", line 149, in __call__
        return self.loader.run(run_func, *args, **kwargs)
      File "/usr/lib/python3.6/site-packages/salt/loader/lazy.py", line 1201, in run
        return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
      File "/usr/lib/python3.6/site-packages/contextvars/__init__.py", line 38, in run
        return callable(*args, **kwargs)
      File "/usr/lib/python3.6/site-packages/salt/loader/lazy.py", line 1216, in _run_as
        return _func_or_method(*args, **kwargs)
      File "/usr/lib/python3.6/site-packages/salt/modules/state.py", line 793, in apply_
        return sls(mods, **kwargs)
      File "/usr/lib/python3.6/site-packages/salt/modules/state.py", line 1392, in sls
        ret = st_.state.call_high(high_, orchestration_jid)
      File "/usr/lib/python3.6/site-packages/salt/state.py", line 3279, in call_high
        ret = self.call_chunks(chunks)
      File "/usr/lib/python3.6/site-packages/salt/state.py", line 2497, in call_chunks
        running = self.call_chunk(low, running, chunks)
      File "/usr/lib/python3.6/site-packages/salt/state.py", line 3003, in call_chunk
        running[tag] = self.call(low, chunks, running)
      File "/usr/lib/python3.6/site-packages/salt/utils/decorators/state.py", line 45, in _func
        result = func(*args, **kwargs)
      File "/usr/lib/python3.6/site-packages/salt/state.py", line 2237, in call
        self.check_refresh(low, ret)
      File "/usr/lib/python3.6/site-packages/salt/state.py", line 1253, in check_refresh
        if not ret["changes"]:
    KeyError: 'changes'

The execution modules work, however:

salt vc01 vmware_license_mgr.list:

vc01:
    ----------
    licenses:
        - 1A1AA-AAAA-11AA1-11AA1-1A111
        - 222B2-2BB2B-222BB-22BBB-2BBBB
        - 3C3CC-33333-333CC-3C3CC-3CCCC
        - DD4DD-444DD-D4DDD-4DDDD-D4444

salt vc01 vmware_license_mgr.remove 1A1AA-AAAA-11AA1-11AA1-1A111:

vc01:
    ----------

salt vc01 vmware_license_mgr.list:

vc01:
    ----------
    licenses:
        - 222B2-2BB2B-222BB-22BBB-2BBBB
        - 3C3CC-33333-333CC-3C3CC-3CCCC
        - DD4DD-444DD-D4DDD-4DDDD-D4444

salt vc01 vmware_license_mgr.add 1A1AA-AAAA-11AA1-11AA1-1A111:

vc01:
    ----------
    licenses:
        1A1AA-AAAA-11AA1-11AA1-1A111

salt vc01 vmware_license_mgr.list:

vc01:
    ----------
    licenses:
        - 1A1AA-AAAA-11AA1-11AA1-1A111
        - 222B2-2BB2B-222BB-22BBB-2BBBB
        - 3C3CC-33333-333CC-3C3CC-3CCCC
        - DD4DD-444DD-D4DDD-4DDDD-D4444

Versions Report

salt --versions-report (Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)
Salt Version:
          Salt: 3004.1

Dependency Versions:
          cffi: 1.11.5
      cherrypy: unknown
      dateutil: 2.6.1
     docker-py: Not Installed
         gitdb: Not Installed
     gitpython: Not Installed
        Jinja2: 2.10.1
       libgit2: 0.26.8
      M2Crypto: 0.35.2
          Mako: Not Installed
       msgpack: 0.6.2
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     pycparser: 2.14
      pycrypto: Not Installed
  pycryptodome: Not Installed
        pygit2: 0.26.4
        Python: 3.6.8 (default, Nov 17 2021, 16:10:06)
  python-gnupg: Not Installed
        PyYAML: 3.12
         PyZMQ: 19.0.0
         smmap: Not Installed
       timelib: Not Installed
       Tornado: 4.5.3
           ZMQ: 4.3.4

System Versions:
          dist: almalinux 8.5 Arctic Sphynx
        locale: UTF-8
       machine: x86_64
       release: 4.18.0-348.20.1.el8_5.x86_64
        system: Linux
       version: AlmaLinux 8.5 Arctic Sphynx

Additional context vcenter proxy minion against vSphere 7.0.3. pyVmomi 7.0.3

ggiesen avatar May 21 '22 12:05 ggiesen