diff options
| author | David Lutterkort <dlutter@redhat.com> | 2008-02-25 10:10:01 -0800 |
|---|---|---|
| committer | David Lutterkort <dlutter@redhat.com> | 2008-02-25 10:10:01 -0800 |
| commit | f0975df7ae2d57f8ac38ab5466b2a378ccabd855 (patch) | |
| tree | aa0adc93ddfefcd8c9442a085380f61cae709ad5 | |
| parent | c8b320e36652db5dac02870ecc73a62c70d5c736 (diff) | |
| download | puppet-f0975df7ae2d57f8ac38ab5466b2a378ccabd855.tar.gz puppet-f0975df7ae2d57f8ac38ab5466b2a378ccabd855.tar.xz puppet-f0975df7ae2d57f8ac38ab5466b2a378ccabd855.zip | |
Trac #1038: not a fix, just an attempt at improving the situation.
That ticket is caused by _some_ process crashing whiule holding rpmdb locks
(and doing that a lot) It is unclear whether yumhelper is that process, and
why it would be crashing.
This version tries much harder to exit cleanly no matter what.
| -rw-r--r-- | lib/puppet/provider/package/yumhelper.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/puppet/provider/package/yumhelper.py b/lib/puppet/provider/package/yumhelper.py index 1142401b9..962b96ce4 100644 --- a/lib/puppet/provider/package/yumhelper.py +++ b/lib/puppet/provider/package/yumhelper.py @@ -13,8 +13,7 @@ OVERRIDE_OPTS = { 'logfile': '/dev/null' } -def pkg_lists(): - my = yum.YumBase() +def pkg_lists(my): my.doConfigSetup() for k in OVERRIDE_OPTS.keys(): @@ -28,10 +27,13 @@ def pkg_lists(): return my.doPackageLists('updates') try: - ypl = pkg_lists() + try: + my = yum.YumBase() + ypl = pkg_lists(my) + for pkg in ypl.updates: + print "_pkg %s %s %s %s %s" % (pkg.name, pkg.epoch, pkg.version, pkg.release, pkg.arch) + finally: + my.closeRpmDB() except IOError, e: print "_err IOError %d %s" % (e.errno, e) sys.exit(1) - -for pkg in ypl.updates: - print "_pkg %s %s %s %s %s" % (pkg.name, pkg.epoch, pkg.version, pkg.release, pkg.arch) |
