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

problem with salt.wheel.error.error and raise_error #49152

Closed
erwindon opened this issue Aug 16, 2018 · 1 comment

Comments

Projects
None yet
2 participants
@erwindon
Copy link
Contributor

commented Aug 16, 2018

Description of Issue/Question

When executing wheel.error.error, an unexpected internal error occurs.
The original purpose of this function is to raise an error. But it should be the specified error.

I believe the error is due to the code in file salt/utils/error.py.
There is exception handling around import exceptions which is triggered as under Python3 this package does not exist,
But on lines 28/29, the exceptions object is still used, thus raising an unwanted exception.
When I comment these 2 lines, the function works as expected for a custom error.

Note that a similar situation is properly handled in salt/_compat.py.

Setup

Default installation with just a salt-master and a salt-minion on the same machine.

Steps to Reproduce Issue

$ salt HOSTNAME saltutil.wheel error.error "Exception" "This is an error."
HOSTNAME:
    ----------
    _stamp:
        2018-08-16T09:30:10.582247
    fun:
        wheel.error.error
    fun_args:
        - Exception
        - This is an error.
    jid:
        20180816113010567620
    return:
        Exception occurred in wheel error.error: Traceback (most recent call last):
          File "/usr/lib/python3.4/site-packages/salt/client/mixins.py", line 387, in _low
            data['return'] = self.functions[fun](*args, **kwargs)
          File "/usr/lib/python3.4/site-packages/salt/wheel/error.py", line 30, in error
            salt.utils.error.raise_error(name=name, message=message)
          File "/usr/lib/python3.4/site-packages/salt/utils/error.py", line 28, in raise_error
            elif hasattr(exceptions, name):
        NameError: name 'exceptions' is not defined
    success:
        False
    user:
        UNKNOWN

Versions Report

Salt Version:
Salt: 2018.3.2

Dependency Versions:
cffi: Not Installed
cherrypy: unknown
dateutil: Not Installed
docker-py: Not Installed
gitdb: 2.0.3
gitpython: 2.1.10
ioflo: Not Installed
Jinja2: 2.8
libgit2: Not Installed
libnacl: Not Installed
M2Crypto: Not Installed
Mako: Not Installed
msgpack-pure: Not Installed
msgpack-python: 0.5.1
mysql-python: 1.3.12
pycparser: Not Installed
pycrypto: 2.6.1
pycryptodome: Not Installed
pygit2: Not Installed
Python: 3.4.8 (default, Mar 23 2018, 10:04:27)
python-gnupg: Not Installed
PyYAML: 3.11
PyZMQ: 15.3.0
RAET: Not Installed
smmap: 2.0.3
timelib: Not Installed
Tornado: 4.4.2
ZMQ: 4.1.4

System Versions:
dist: centos 7.5.1804 Core
locale: UTF-8
machine: x86_64
release: 3.10.0-862.3.2.el7.x86_64
system: Linux
version: CentOS Linux 7.5.1804 Core

@erwindon erwindon changed the title problem with salt.wheel.error and raise_error problem with salt.wheel.error.errro and raise_error Aug 16, 2018

@erwindon erwindon changed the title problem with salt.wheel.error.errro and raise_error problem with salt.wheel.error.error and raise_error Aug 16, 2018

@Ch3LL

This comment has been minimized.

Copy link
Contributor

commented Aug 16, 2018

looks like you have the problem spot on, want to take a go at a PR?

@Ch3LL Ch3LL added this to the Approved milestone Aug 16, 2018

erwindon added a commit to erwindon/salt that referenced this issue Aug 16, 2018

erwindon added a commit to erwindon/salt that referenced this issue Aug 16, 2018

dwoz added a commit that referenced this issue Aug 17, 2018

Merge pull request #49162 from erwindon/wheel_error_error
Fixed unknown 'exceptions' under Python3 (#49152)

@erwindon erwindon closed this Aug 17, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.