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

[BUG] Can't remove pkg inside for loop #59003

Open
pesc opened this issue Nov 23, 2020 · 4 comments
Open

[BUG] Can't remove pkg inside for loop #59003

pesc opened this issue Nov 23, 2020 · 4 comments
Assignees
Labels
Bug broken, incorrect, or confusing behavior FreeBSD Regression The issue is a bug that breaks functionality known to work in previous releases.
Milestone

Comments

@pesc
Copy link

pesc commented Nov 23, 2020

Description
salt3002.2 fails to remove pkg on FreeBSD while inside a for loop -> no problem while using pkg.installed or not deleting pkg's inside a loop. It seems not to be a pkg state/module problem but it's easy to reproduce it that way
same Issue ( #57543 ) for salt 3000 - but got fixed in 3002 and broken again in 3002.2

Setup

{% for i in range(3) %}
   salt3000_test_{{ i }}:
      pkg.removed:
        - pkgs:
          - php{{ i }}
{% endfor %}

Steps to Reproduce the behavior

salt-call -l critical state.sls foo test=true  --state-verbose=false --log-file-level=debug saltenv=salt3000
Traceback (most recent call last):
  File "/usr/local/bin/salt-call", line 11, in <module>
    load_entry_point('salt==3002.2', 'console_scripts', 'salt-call')()
  File "/usr/local/lib/python3.7/site-packages/salt/scripts.py", line 449, in salt_call
    client.run()
  File "/usr/local/lib/python3.7/site-packages/salt/cli/call.py", line 58, in run
    caller.run()
  File "/usr/local/lib/python3.7/site-packages/salt/cli/caller.py", line 112, in run
    ret = self.call()
  File "/usr/local/lib/python3.7/site-packages/salt/cli/caller.py", line 220, in call
    self.opts, data, func, args, kwargs
  File "/usr/local/lib/python3.7/site-packages/salt/executors/direct_call.py", line 12, in execute
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/salt/modules/state.py", line 1416, in sls
    _set_retcode(ret, high_)
  File "/usr/local/lib/python3.7/site-packages/salt/modules/state.py", line 111, in _set_retcode
    if not __utils__["state.check_result"](ret, highstate=highstate):
  File "/usr/local/lib/python3.7/site-packages/salt/utils/context.py", line 223, in __getitem__
    return self._dict()[key]
KeyError: 'state.check_result'

Expected behavior (works in salt3002.1)

local:
----------
          ID: salt3000_test_0
    Function: pkg.removed
      Result: True
     Comment: All specified packages are already absent
     Started: 13:38:01.534142
    Duration: 80.558 ms
     Changes:   
----------
          ID: salt3000_test_1
    Function: pkg.removed
      Result: True
     Comment: All specified packages are already absent
     Started: 13:38:01.630030
    Duration: 35.614 ms
     Changes:   
----------
          ID: salt3000_test_2
    Function: pkg.removed
      Result: True
     Comment: All specified packages are already absent
     Started: 13:38:01.680598
    Duration: 35.292 ms
     Changes:   

Summary for local
------------
Succeeded: 3
Failed:    0

Summary for local

Versions Report

salt --versions-report Minion: FreeBSD; Master - Ubuntu; Both 3000.3
Salt Version:
          Salt: 3002.2

Dependency Versions:
          cffi: 1.14.3
      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: 1.0.0
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     pycparser: 2.20
      pycrypto: 2.6.1
  pycryptodome: 3.9.8
        pygit2: Not Installed
        Python: 3.7.9 (default, Oct 14 2020, 23:05:14)
  python-gnupg: Not Installed
        PyYAML: 5.3.1
         PyZMQ: 19.0.2
         smmap: Not Installed
       timelib: Not Installed
       Tornado: 4.5.3
           ZMQ: 4.3.1

System Versions:
          dist: freebsd 11.4
        locale: UTF-8
       machine: amd64
       release: 11.4-RELEASE-p4
        system: FreeBSD
       version: FreeBSD 11.4
@pesc pesc added the Bug broken, incorrect, or confusing behavior label Nov 23, 2020
@pesc pesc changed the title [BUG] [BUG] Can't remove pkg inside for loop Nov 23, 2020
@sagetherage sagetherage added FreeBSD needs-triage Regression The issue is a bug that breaks functionality known to work in previous releases. labels Nov 23, 2020
@sagetherage sagetherage added Aluminium Release Post Mg and Pre Si and removed needs-triage labels Dec 7, 2020
@sagetherage sagetherage added this to the Aluminium milestone Dec 10, 2020
@krionbsd
Copy link
Contributor

krionbsd commented Jan 5, 2021

@pesc that's weird as I couldn't reproduce it on FreeBSD 13 and 3002.2, did you encounter the error if you run the state from master?

@pesc
Copy link
Author

pesc commented Feb 15, 2021

Sorry, was out of office for over a month. Let me check and I'll provide you with the details no later than tomorrow.

@pesc that's weird as I couldn't reproduce it on FreeBSD 13 and 3002.2, did you encounter the error if you run the state from master?

@pesc
Copy link
Author

pesc commented Feb 15, 2021

Alright just tested it. And it happens with salt-call or directly from salt-master (FreeBSD 11.4)

salt 'f1040.*'  -l critical state.sls foo test=true  --state-verbose=false --log-file-level=debug saltenv=salt3000
f1040.....:
    The minion function caused an exception: Traceback (most recent call last):
      File "/usr/local/lib/python3.7/site-packages/salt/minion.py", line 1890, in _thread_return
        function_name, function_args, executors, opts, data
      File "/usr/local/lib/python3.7/site-packages/salt/minion.py", line 1846, in _execute_job_function
        return_data = self.executors[fname](opts, data, func, args, kwargs)
      File "/usr/local/lib/python3.7/site-packages/salt/executors/direct_call.py", line 12, in execute
        return func(*args, **kwargs)
      File "/usr/local/lib/python3.7/site-packages/salt/modules/state.py", line 1416, in sls
        _set_retcode(ret, high_)
      File "/usr/local/lib/python3.7/site-packages/salt/modules/state.py", line 111, in _set_retcode
        if not __utils__["state.check_result"](ret, highstate=highstate):
      File "/usr/local/lib/python3.7/site-packages/salt/utils/context.py", line 223, in __getitem__
        return self._dict()[key]
    KeyError: 'state.check_result'
ERROR: Minions returned with non-zero exit code

and from salt-minion

salt-call -l critical state.sls foo test=true  --state-verbose=false --log-file-level=debug saltenv=salt3000
Traceback (most recent call last):
  File "/usr/local/bin/salt-call", line 11, in <module>
    load_entry_point('salt==3002.2', 'console_scripts', 'salt-call')()
  File "/usr/local/lib/python3.7/site-packages/salt/scripts.py", line 449, in salt_call
    client.run()
  File "/usr/local/lib/python3.7/site-packages/salt/cli/call.py", line 58, in run
    caller.run()
  File "/usr/local/lib/python3.7/site-packages/salt/cli/caller.py", line 112, in run
    ret = self.call()
  File "/usr/local/lib/python3.7/site-packages/salt/cli/caller.py", line 220, in call
    self.opts, data, func, args, kwargs
  File "/usr/local/lib/python3.7/site-packages/salt/executors/direct_call.py", line 12, in execute
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/salt/modules/state.py", line 1416, in sls
    _set_retcode(ret, high_)
  File "/usr/local/lib/python3.7/site-packages/salt/modules/state.py", line 111, in _set_retcode
    if not __utils__["state.check_result"](ret, highstate=highstate):
  File "/usr/local/lib/python3.7/site-packages/salt/utils/context.py", line 223, in __getitem__
    return self._dict()[key]
KeyError: 'state.check_result'

Versions Report

salt --versions-report Minion: FreeBSD; Master - Ubuntu; Both 3000.3
Salt Version:
          Salt: 3002.2

Dependency Versions:
          cffi: 1.14.4
      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: 1.0.2
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     pycparser: 2.20
      pycrypto: 2.6.1
  pycryptodome: 3.9.8
        pygit2: Not Installed
        Python: 3.7.9 (default, Oct 14 2020, 23:05:14)
  python-gnupg: Not Installed
        PyYAML: 5.3.1
         PyZMQ: 22.0.3
         smmap: Not Installed
       timelib: Not Installed
       Tornado: 4.5.3
           ZMQ: 4.3.1

System Versions:
          dist: freebsd 11.4
        locale: UTF-8
       machine: amd64
       release: 11.4-RELEASE-p4
        system: FreeBSD
       version: FreeBSD 11.4
cat foo.sls
{% for i in range(3) %}
   salt3000_test_{{ i }}:
      pkg.removed:
        - pkgs:
          - php{{ i }}
{% endfor %}

@sagetherage sagetherage added Silicon v3004.0 Release code name and removed Aluminium Release Post Mg and Pre Si labels Feb 24, 2021
@sagetherage sagetherage modified the milestones: Aluminium, Silicon Feb 24, 2021
@pesc
Copy link
Author

pesc commented Jul 1, 2021

@sagetherage / @krionbsd Any clue what changed in 3003(.1)? It works! But as I mentioned the bug appeared already twice with newer versions (#57543). So it would be nice if we know the changelog for this bug.

salt-call -l critical state.sls foo test=true  --state-verbose=false --log-file-level=debug saltenv=salt3000
local:

Summary for local
------------
Succeeded: 3
Failed:    0
------------
Total states run:     3
Total run time: 241.679 ms

Versions Report of Minion

salt --versions-report ``` Salt Version: Salt: 3003.1

Dependency Versions:
cffi: 1.14.5
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: 1.0.2
msgpack-pure: Not Installed
mysql-python: Not Installed
pycparser: 2.20
pycrypto: 2.6.1
pycryptodome: 3.10.1
pygit2: Not Installed
Python: 3.7.10 (default, May 16 2021, 23:06:50)
python-gnupg: Not Installed
PyYAML: 5.4.1
PyZMQ: 22.1.0
smmap: Not Installed
timelib: Not Installed
Tornado: 4.5.3
ZMQ: 4.3.4

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

</details>

@sagetherage sagetherage modified the milestones: Silicon, Approved Aug 19, 2021
@sagetherage sagetherage removed the Silicon v3004.0 Release code name label Aug 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug broken, incorrect, or confusing behavior FreeBSD Regression The issue is a bug that breaks functionality known to work in previous releases.
Projects
None yet
Development

No branches or pull requests

3 participants