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

Exception - NameError: global name '_check_32' is not defined #12177

Closed
jimdickinson opened this issue Apr 22, 2014 · 10 comments · Fixed by #12269
Closed

Exception - NameError: global name '_check_32' is not defined #12177

jimdickinson opened this issue Apr 22, 2014 · 10 comments · Fixed by #12269
Labels
Bug broken, incorrect, or confusing behavior severity-low 4th level, cosemtic problems, work around exists
Milestone

Comments

@jimdickinson
Copy link

I encountered the following exception in the 2014.1.3 minion release. I looked at the code a bit, but I'm not a python developer.

          ID: install-oracle-jdk-rpm
    Function: pkg.installed
      Result: False
     Comment: An exception occurred in this state: Traceback (most recent call last):
                File "/usr/lib/python2.6/site-packages/salt/state.py", line 1378, in call
                  **cdata['kwargs'])
                File "/usr/lib/python2.6/site-packages/salt/states/pkg.py", line 518, in installed
                  **kwargs)
                File "/usr/lib/python2.6/site-packages/salt/modules/yumpkg.py", line 687, in install
                  name, pkgs, sources, **kwargs
                File "/usr/lib/python2.6/site-packages/salt/modules/pkg_resource.py", line 276, in parse_targets
                  problems = _verify_binary_pkg(srcinfo)
                File "/usr/lib/python2.6/site-packages/salt/modules/pkg_resource.py", line 196, in _verify_binary_pkg
                  pkgmeta_name, pkgmeta_version = _parse_pkg_meta(pkg_path)
                File "/usr/lib/python2.6/site-packages/salt/modules/pkg_resource.py", line 139, in _parse_pkg_meta
                  return metaparser(path)
                File "/usr/lib/python2.6/site-packages/salt/modules/pkg_resource.py", line 46, in parse_rpm_redhat
                  pkginfo = _parse_pkginfo(pkginfo)
                File "/usr/lib/python2.6/site-packages/salt/modules/yumpkg.py", line 87, in _parse_pkginfo
                  if not _check_32(arch):
              NameError: global name '_check_32' is not defined
     Changes:

2014.1.0 minions didn't have any problems running the state.

The state in question was this...

install-oracle-jdk-rpm:
  pkg:
    - installed
    - sources:
      - jdk: /root/jdk-7u55-linux-x64.rpm

salt --versions-report output

               Salt: 2014.1.3
             Python: 2.6.9 (unknown, Mar 28 2014, 00:06:37)
             Jinja2: 2.6
           M2Crypto: 0.20.2
     msgpack-python: 0.1.13
       msgpack-pure: Not Installed
           pycrypto: 2.6.1
             PyYAML: 3.10
              PyZMQ: 2.2.0.1
                ZMQ: 3.2.4
@cznewt
Copy link

cznewt commented Apr 23, 2014

I'm having same issue, CentOS 6.5

horizon_repo:
  pkg.installed:
  - sources:
    - rdo-release: http://rdo.fedorapeople.org/rdo-release.rpm


salt-minion --versions-report
       Salt: 2014.1.3
     Python: 2.6.6 (r266:84292, Jan 22 2014, 09:42:36)

@stanislavb
Copy link
Contributor

I have the same issue for a noarch pkg on CentOS 6.5.

salt-minion --versions-report
       Salt: 2014.1.2
     Python: 2.6.6 (r266:84292, Jan 22 2014, 09:42:36)
     Jinja2: 2.6
   M2Crypto: 0.20.2
 msgpack-python: 0.1.13
msgpack-pure: Not Installed
   pycrypto: 2.0.1
     PyYAML: 3.10
      PyZMQ: 2.2.0.1
        ZMQ: 3.2.4

@basepi
Copy link
Contributor

basepi commented Apr 24, 2014

Thanks for the reports. Very strange, as the _check_32 function is definitely there....

@jadickin On which OS did you see the error? RHEL 6.5 like the others?

@terminalmage could you potentially test this on a RHEL 6.5 machine? Curious if we can reproduce.

@basepi basepi added this to the Approved milestone Apr 24, 2014
@terminalmage
Copy link
Contributor

Yeah, this is an issue with binary package verification. And there's no good way to fix this since the _check_32() function is being called from within a function that is being imported into pkg_resource.py.

I've decided to remove binary package verification altogether. It's unnecessary since the state will still fail if the desired package name differs from the actual package name, due to the desired package name not appearing in the return data from list_pkgs().

To those experiencing this issue right now, I have ported that change to 2014.1.3 and saved the result in this pastebin. Save it as pkg_resource.py within the _modules directory of your base environment (In other words, if your base environment is /srv/salt, put the file into /srv/salt/_modules, making that directory first if not present). Once that is done, running salt '*' saltutil.sync_modules will push this file out, which will fix this issue and allow you to go about your business as normal.

This fix will be in 2014.1.4, so make sure to remove that file and re-sync the modules before upgrading to 2014.1.4, or else the sync'ed version will take precedence over future releases, leading to unforeseen issues.

@jimdickinson
Copy link
Author

Thanks for the quick workaround! If you're curious, I was using the latest Amazon Linux AMI, 2014.03.

@terminalmage
Copy link
Contributor

@jadickin Did the workaround work for you, then? I tested myself before posting that, but I just wanted to be sure.

@jimdickinson
Copy link
Author

The workaround did work, and the instructions for using it were really good. I've been digging into saltstack for a couple weeks, but I wouldn't have been able to do much without the explanation. 😄

@terminalmage
Copy link
Contributor

Great! Glad I could help 😄

@deuscapturus
Copy link
Contributor

This work around didn't work for me. Now I get this error with all pkg.installed uses.

salt-master-2014.1.0-1.el6.noarch

          ID: otherrpms
    Function: pkg.installed
      Result: False
     Comment: An exception occurred in this state: Traceback (most recent call last):
                File "/usr/lib/python2.6/site-packages/salt/state.py", line 1379, in call
                  self.verify_ret(ret)
                File "/usr/lib64/python2.6/contextlib.py", line 34, in __exit__
                  self.gen.throw(type, value, traceback)
                File "/usr/lib/python2.6/site-packages/salt/utils/context.py", line 43, in func_globals_inject
                  yield
                File "/usr/lib/python2.6/site-packages/salt/state.py", line 1378, in call
                  **cdata['kwargs'])
                File "/usr/lib/python2.6/site-packages/salt/states/pkg.py", line 468, in installed
                  **kwargs)
                File "/usr/lib/python2.6/site-packages/salt/states/pkg.py", line 130, in _find_install_targets
                  cur_pkgs = __salt__['pkg.list_pkgs'](versions_as_list=True, **kwargs)
                File "/usr/lib/python2.6/site-packages/salt/modules/yumpkg.py", line 319, in list_pkgs
                  __salt__['pkg_resource.add_pkg'](ret, pkginfo.name, pkginfo.version)
              KeyError: 'pkg_resource.add_pkg'
     Changes:   

@TriAnMan
Copy link

Have the same bug. The solution in #12177 (comment) works for me.

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 severity-low 4th level, cosemtic problems, work around exists
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants