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

stringutils.to_none AttributeError: 'module' object has no attribute 'tex_type' #50142

Closed
m03 opened this issue Oct 20, 2018 · 1 comment

Comments

Projects
None yet
2 participants
@m03
Copy link
Contributor

commented Oct 20, 2018

Description of Issue/Question

Using salt.utils.stringutils.to_none results in the following:

  File "/usr/lib/python2.7/dist-packages/salt/utils/stringutils.py", line 150, in to_none
    if six.tex_type(text).strip():
AttributeError: 'module' object has no attribute 'tex_type'.

Setup

Tested on Masterless Minion.

Steps to Reproduce Issue

Use salt.utils.stringutils.to_none anywhere. Example execution module:

from __future__ import absolute_import, print_function, unicode_literals

import salt.utils

__virtualname__ = 'fakemod'

def __virtual__():
    return __virtualname__

def is_broken():
    return None == salt.utils.stringutils.to_none('')

def is_not_broken():
    return 42 == salt.utils.stringutils.to_num('42')

Example output:

root@example# salt-call fakemod.is_not_broken
local:
    True
root@example# salt-call fakemod.is_broken
[ERROR   ] An un-handled exception was caught by salt's global exception handler:
AttributeError: 'module' object has no attribute 'tex_type'
Traceback (most recent call last):
  File "/usr/bin/salt-call", line 11, in <module>
    salt_call()
  File "/usr/lib/python2.7/dist-packages/salt/scripts.py", line 400, in salt_call
    client.run()
  File "/usr/lib/python2.7/dist-packages/salt/cli/call.py", line 57, in run
    caller.run()
  File "/usr/lib/python2.7/dist-packages/salt/cli/caller.py", line 134, in run
    ret = self.call()
  File "/usr/lib/python2.7/dist-packages/salt/cli/caller.py", line 212, in call
    ret['return'] = func(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/salt/modules/fakemod.py", line 16, in is_broken
    return None == salt.utils.stringutils.to_none('')
  File "/usr/lib/python2.7/dist-packages/salt/utils/stringutils.py", line 150, in to_none
    if six.tex_type(text).strip():
AttributeError: 'module' object has no attribute 'tex_type'
Traceback (most recent call last):
  File "/usr/bin/salt-call", line 11, in <module>
    salt_call()
  File "/usr/lib/python2.7/dist-packages/salt/scripts.py", line 400, in salt_call
    client.run()
  File "/usr/lib/python2.7/dist-packages/salt/cli/call.py", line 57, in run
    caller.run()
  File "/usr/lib/python2.7/dist-packages/salt/cli/caller.py", line 134, in run
    ret = self.call()
  File "/usr/lib/python2.7/dist-packages/salt/cli/caller.py", line 212, in call
    ret['return'] = func(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/salt/modules/fakemod.py", line 16, in is_broken
    return None == salt.utils.stringutils.to_none('')
  File "/usr/lib/python2.7/dist-packages/salt/utils/stringutils.py", line 150, in to_none
    if six.tex_type(text).strip():
AttributeError: 'module' object has no attribute 'tex_type'

Versions Report

Salt Version:
           Salt: 2018.3.2

Dependency Versions:
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: 2.4.2
      docker-py: Not Installed
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
         Jinja2: 2.8
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: 1.0.3
   msgpack-pure: Not Installed
 msgpack-python: 0.4.6
   mysql-python: Not Installed
      pycparser: Not Installed
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: Not Installed
         Python: 2.7.12 (default, Dec  4 2017, 14:50:18)
   python-gnupg: 0.3.8
         PyYAML: 3.11
          PyZMQ: 15.2.0
           RAET: Not Installed
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.1.4

System Versions:
           dist: Ubuntu 16.04 xenial
         locale: ISO-8859-1
        machine: x86_64
        release: 4.4.0-87-generic
         system: Linux
        version: Ubuntu 16.04 xenial

m03 added a commit to m03/salt that referenced this issue Oct 20, 2018

@gtmanfred gtmanfred closed this in e4b59ee Oct 22, 2018

gtmanfred added a commit that referenced this issue Oct 22, 2018

@gtmanfred

This comment has been minimized.

Copy link
Contributor

commented Oct 22, 2018

Woop, looks like a typo. Thanks for the pr to fix this, i have merged it and we will get it backported to the other releases.

For future reference, when submitting bug fixes, PRs should be submitted against the oldest support release that the bug is in.

Thanks!
Daniel

rallytime added a commit to rallytime/salt that referenced this issue Oct 23, 2018

lomeroe added a commit to lomeroe/salt that referenced this issue Oct 24, 2018

gitebra pushed a commit to gitebra/salt that referenced this issue Oct 25, 2018

Merge remote-tracking branch 'upstream/develop' into develop
* upstream/develop: (270 commits)
  Add 2017.7.8 previous release
  Update release versions for the develop branch
  Ignore testinfra 1.17.0
  shutdown typo 2
  shutdown typo
  added force recognition to reboot_host
  added shutdown_host to vmware cloud
  Change versionadded
  add 2 second timeout on DNS socket check
  Added brief documentation and unit test.
  Added `method_call` jinja filter.
  add release note
  remove extra spaces in http.query state comment output. Add test for status_type=pcre
  correct typo
  Support regex status types in http.query state
  Add test_to_none
  Improve handling of non-ascii characters in terminal output. (Fixes: saltstack#49523)
  make toml serializer discoverable in docs
  Fix saltstack#50142, stringutils.to_none
  fix pylint issues that seemingly appeared out of nowhere
  ...
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.