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

salt.proxy.fx2: dictionary changed size during iteration #48367

Closed
asenci opened this Issue Jun 29, 2018 · 1 comment

Comments

Projects
None yet
2 participants
@asenci
Contributor

asenci commented Jun 29, 2018

Description of Issue/Question

The "chconfig" function inside the salt.proxy.fx2 module causes a Python runtime error trying to modify the kwargs dictionary while iterating over it:

The minion function caused an exception: Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/salt/minion.py", line 1606, in _thread_return
    return_data = minion_instance.executors[fname](opts, data, func, args, kwargs)
  File "/usr/lib/python2.7/dist-packages/salt/executors/direct_call.py", line 12, in execute
    return func(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/salt/modules/chassis.py", line 52, in cmd
    return __proxy__[proxycmd](cmd, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/salt/proxy/fx2.py", line 331, in chconfig
    for k in kwargs:
RuntimeError: dictionary changed size during iteration

Looks like the same situation as issue #46765.

I haven't tested, but I'd expect the following modules to have the same behaviour:

salt.modules.nxos, line 62:

    for k in kwargs:
        if k.startswith('__pub_'):
            kwargs.pop(k)

salt.modules.cisconso, line 152:

    for k in kwargs:
        if k.startswith('__pub_'):
            kwargs.pop(k)

salt.proxy.esxi, line 493:

    for k in kwargs:
        if k.startswith('__pub_'):
            kwargs.pop(k)

Setup

Steps to Reproduce Issue

Run "chassis.cmd" with any parameters against a FX2 proxy minion. E.g.:
sudo salt 'dellchassis01' chassis.cmd inventory -t 300 -l debug

Versions Report

Salt Version:
Salt: 2018.3.2

Dependency Versions:
cffi: Not Installed
cherrypy: Not Installed
dateutil: 2.6.0
docker-py: Not Installed
gitdb: 2.0.2
gitpython: 2.1.5
ioflo: Not Installed
Jinja2: 2.9.6
libgit2: 0.24.6
libnacl: Not Installed
M2Crypto: Not Installed
Mako: 1.0.7
msgpack-pure: Not Installed
msgpack-python: 0.4.8
mysql-python: Not Installed
pycparser: Not Installed
pycrypto: 2.6.1
pycryptodome: Not Installed
pygit2: 0.24.2
Python: 2.7.14 (default, Sep 23 2017, 22:06:14)
python-gnupg: 0.3.9
PyYAML: 3.12
PyZMQ: 16.0.2
RAET: Not Installed
smmap: 2.0.3
timelib: Not Installed
Tornado: 4.5.1
ZMQ: 4.2.1

System Versions:
dist: Ubuntu 17.10 artful
locale: UTF-8
machine: x86_64
release: 4.13.0-43-generic
system: Linux
version: Ubuntu 17.10 artful

@gtmanfred

This comment has been minimized.

Contributor

gtmanfred commented Jun 29, 2018

Thanks for the pr to fix this!
Daniel

@gtmanfred gtmanfred closed this Jun 29, 2018

gtmanfred added a commit that referenced this issue Jun 29, 2018

Merge pull request #48368 from asenci/fix_48367
Fix issue #48367 using the same approach as PR #46776

gitebra pushed a commit to gitebra/salt that referenced this issue Jun 29, 2018

Merge remote-tracking branch 'upstream/develop' into develop
* upstream/develop: (26 commits)
  Fix issue saltstack#48367 using the same approach as PR saltstack#46776
  Changing debug to info for logging
  Update glusterfs test case
  Lint
  Netmiko module: enhance the behaviour for a more flexible commit arg
  Use the right ssh key to destroy kitchen
  Enhance the NAPALM validator function to render (remote) SLS files
  Fix tuple element to be int
  Fix unit tests
  Add warnings plugin to replace violations
  Remove In Progress Warning for 2018.3.2 Release
  Update release versions for the develop branch
  Fix missing parentheses
  Fix GlusterFS module for version 4.0 and above
  Add backward-compatibility for older python-consul package dependencies
  Add new netmiko and junos functions to the napalm module
  3rd times the charm for Sphinx?
  Documentation change
  Fix PEP8 E302 lint issues
  Post code review alterations
  ...

rallytime added a commit to rallytime/salt that referenced this issue Jun 29, 2018

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