Giter VIP home page Giter VIP logo

Comments (7)

bmr-cymru avatar bmr-cymru commented on July 23, 2024

And here's why:

def pkgByName(self, name):
    """
    Return a single package that matches name.
    """
    try:
        self.AllPkgsByName(name)[-1]
    except Exception:
        return None

Hashing out that try block:

rm -rf sosreport-localhost.* && sosreport -vvv --batch --debug 2>&1 | tee /tmp/log | less;

sosreport (version 2.3)

plugin abrt does not install, skipping: 'PackageManager' object has no attribute 'AllPkgsByName'
Traceback (most recent call last):
File "/usr/sbin/sosreport", line 23, in
main(sys.argv[1:])
File "/usr/lib/python2.7/site-packages/sos/sosreport.py", line 961, in main
sos.execute()
File "/usr/lib/python2.7/site-packages/sos/sosreport.py", line 921, in execute
self.load_plugins()
File "/usr/lib/python2.7/site-packages/sos/sosreport.py", line 454, in load_plugins
if self._is_inactive(plugbase, plugin_class):
File "/usr/lib/python2.7/site-packages/sos/sosreport.py", line 394, in _is_inactive
return (not pluginClass(self.get_commons()).checkenabled() and
File "/usr/lib/python2.7/site-packages/sos/plugins/abrt.py", line 27, in checkenabled
return self.isInstalled("abrt-cli") or
File "/usr/lib/python2.7/site-packages/sos/plugins/init.py", line 166, in isInstalled
print "pkgByName: %s" % self.policy().pkgByName(package_name)
File "/usr/lib/python2.7/site-packages/sos/policies/init.py", line 197, in pkgByName
return self.package_manager.pkgByName(pkg)
File "/usr/lib/python2.7/site-packages/sos/policies/init.py", line 73, in pkgByName
self.AllPkgsByName(name)[-1]
AttributeError: 'PackageManager' object has no attribute 'AllPkgsByName'

So looks like this has been totally bust since Feb at least :-)

from sos.

bmr-cymru avatar bmr-cymru commented on July 23, 2024

Fixing the one-char typo ('All' for 'all') gives:

# rm -rf sosreport-localhost.* && sosreport -vvv --batch --debug 2>&1 | tee /tmp/log | less;

sosreport (version 2.3)

plugin abrt does not install, skipping: global name 'shell_out' is not defined
Traceback (most recent call last):
  File "/usr/sbin/sosreport", line 23, in <module>
    main(sys.argv[1:])
  File "/usr/lib/python2.7/site-packages/sos/sosreport.py", line 961, in main
    sos.execute()
  File "/usr/lib/python2.7/site-packages/sos/sosreport.py", line 921, in execute
    self.load_plugins()
  File "/usr/lib/python2.7/site-packages/sos/sosreport.py", line 454, in load_plugins
    if  self._is_inactive(plugbase, plugin_class):
  File "/usr/lib/python2.7/site-packages/sos/sosreport.py", line 394, in _is_inactive
    return (not pluginClass(self.get_commons()).checkenabled() and
  File "/usr/lib/python2.7/site-packages/sos/plugins/abrt.py", line 27, in checkenabled
    return self.isInstalled("abrt-cli") or \
  File "/usr/lib/python2.7/site-packages/sos/plugins/__init__.py", line 166, in isInstalled
    print "pkgByName: %s" % self.policy().pkgByName(package_name)
  File "/usr/lib/python2.7/site-packages/sos/policies/__init__.py", line 197, in pkgByName
    return self.package_manager.pkgByName(pkg)
  File "/usr/lib/python2.7/site-packages/sos/policies/__init__.py", line 73, in pkgByName
    self.allPkgsByName(name)[-1]
  File "/usr/lib/python2.7/site-packages/sos/policies/__init__.py", line 59, in allPkgsByName
    return fnmatch.filter(self.allPkgs().keys(), name)
  File "/usr/lib/python2.7/site-packages/sos/policies/__init__.py", line 98, in allPkgs
    self.packages = self.getPackageList()
  File "/usr/lib/python2.7/site-packages/sos/policies/__init__.py", line 83, in getPackageList
    pkg_list = shell_out(self.query_command).splitlines()
NameError: global name 'shell_out' is not defined

Adding the missing import for sos.utilities.shell_out thens says:

# rm -rf sosreport-localhost.* && sosreport -vvv --batch --debug 2>&1 | tee /tmp/log | less;

sosreport (version 2.3)

plugin abrt does not install, skipping: list index out of range
Traceback (most recent call last):
  File "/usr/sbin/sosreport", line 23, in <module>
    main(sys.argv[1:])
  File "/usr/lib/python2.7/site-packages/sos/sosreport.py", line 961, in main
    sos.execute()
  File "/usr/lib/python2.7/site-packages/sos/sosreport.py", line 921, in execute
    self.load_plugins()
  File "/usr/lib/python2.7/site-packages/sos/sosreport.py", line 454, in load_plugins
    if  self._is_inactive(plugbase, plugin_class):
  File "/usr/lib/python2.7/site-packages/sos/sosreport.py", line 394, in _is_inactive
    return (not pluginClass(self.get_commons()).checkenabled() and
  File "/usr/lib/python2.7/site-packages/sos/plugins/abrt.py", line 27, in checkenabled
    return self.isInstalled("abrt-cli") or \
  File "/usr/lib/python2.7/site-packages/sos/plugins/__init__.py", line 166, in isInstalled
    print "pkgByName: %s" % self.policy().pkgByName(package_name)
  File "/usr/lib/python2.7/site-packages/sos/policies/__init__.py", line 198, in pkgByName
    return self.package_manager.pkgByName(pkg)
  File "/usr/lib/python2.7/site-packages/sos/policies/__init__.py", line 74, in pkgByName
    self.allPkgsByName(name)[-1]
IndexError: list index out of range

This would have been caught by the try block I commented out but I think it's better to test the length of the array and return None explicitly if it has zero length, e.g.:

    def pkgByName(self, name):
        """
        Return a single package that matches name.
        """
#        try:
        pkgmatches = self.allPkgsByName(name)
        if (len(pkgmatches) != 0):
            return self.allPkgsByName(name)[-1]
        else:
            return None
#        except Exception:
#            return None

I have lots of this now:

checking packages:
('kexec-tools',)
pkgByName: kexec-tools
Is installed(kexec-tools): True
checking packages:
('openldap', 'nss-pam-ldapd')
pkgByName: openldap
Is installed(openldap): True
checking packages:
('openssl',)
pkgByName: openssl
Is installed(openssl): True

And I hit the original exception I was trying to debug when I noticed this:

Traceback (most recent call last):
  File "/usr/sbin/sosreport", line 23, in <module>
    main(sys.argv[1:])
  File "/usr/lib/python2.7/site-packages/sos/sosreport.py", line 961, in main
    sos.execute()
TypeError: coercing to Unicode: need string or buffer, NoneType found

> /usr/lib64/python2.7/posixpath.py(133)islink()
-> st = os.lstat(path)
(Pdb) 

(which is a known issue that Keith already posted a fix to BZ for).

Don't think I've ever been so happy to see a python backtrace!

from sos.

bmr-cymru avatar bmr-cymru commented on July 23, 2024

Fixed in commit 3cce6b

from sos.

bmr-cymru avatar bmr-cymru commented on July 23, 2024

Oops, using commit doesn't work if you haven't pushed it..

from sos.

bmr-cymru avatar bmr-cymru commented on July 23, 2024

Fixed in commit 3cce6b

from sos.

bmr-cymru avatar bmr-cymru commented on July 23, 2024

wtf?

from sos.

bmr-cymru avatar bmr-cymru commented on July 23, 2024

Not enough chars... commit 3cce6b2 dammit.

from sos.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.