Bug #1354
yum provider problems with RHEL 3
| Status: | Closed | Start date: | 06/10/2008 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assignee: | % Done: | 0% |
||
| Category: | Red Hat | |||
| Target version: | 0.24.6 | |||
| Affected Puppet version: | Branch: | |||
| Keywords: | ||||
| Votes: | 0 |
Description
When using the yum provider with RHEL 3, the following error occurs.
[0;32minfo: Retrieving plugins[0m
[0;31mnotice: Ignoring cache[0m
[0;32minfo: Caching catalog at /var/lib/puppet/localconfig.yaml[0m
[0;31mnotice: Starting catalog run[0m
/usr/lib/site_ruby/1.8/puppet/util.rb:374:in `execute'
/usr/lib/site_ruby/1.8/puppet/provider.rb:138:in `python'
/usr/lib/site_ruby/1.8/puppet/provider.rb:127:in `python'
/usr/lib/site_ruby/1.8/puppet/provider/package/yum.rb:32:in `prefetch'
/usr/lib/site_ruby/1.8/puppet/transaction.rb:490:in `prefetch'
/usr/lib/site_ruby/1.8/puppet/transaction.rb:487:in `each'
/usr/lib/site_ruby/1.8/puppet/transaction.rb:487:in `prefetch'
/usr/lib/site_ruby/1.8/puppet/transaction.rb:502:in `prepare'
/usr/lib/site_ruby/1.8/puppet/transaction.rb:299:in `evaluate'
/usr/lib/site_ruby/1.8/puppet/node/catalog.rb:118:in `apply'
/usr/lib/site_ruby/1.8/puppet/network/client/master.rb:264:in `run'
/usr/lib/site_ruby/1.8/puppet/network/client/master.rb:263:in `benchmark'
/usr/lib/site_ruby/1.8/puppet/util.rb:211:in `measure'
/usr/lib/ruby/1.8/benchmark.rb:342:in `realtime'
/usr/lib/site_ruby/1.8/puppet/util.rb:211:in `benchmark'
/usr/lib/site_ruby/1.8/puppet/network/client/master.rb:263:in `run'
/usr/lib/site_ruby/1.8/puppet/network/client/master.rb:245:in `synchronize'
/usr/lib/site_ruby/1.8/puppet/network/client/master.rb:245:in `run'
/usr/sbin/puppetd:439
[0;33merr: Could not prefetch package provider 'yum': Execution of '/usr/bin/python /usr/lib/site_ruby/1.8/puppet/provider/package/yumhelper.py' returned 256: Traceback (most recent call last):
File "/usr/lib/site_ruby/1.8/puppet/provider/package/yumhelper.py", line 7, in ?
import yum
ImportError: No module named yum
[0m
[0;32minfo: Sent transaction report in 0.45 seconds[0m
[0;31mnotice: Finished catalog run in 11.16 seconds[0m
History
Updated by Ian Burrell over 3 years ago
The latest version of yum that will run on RHEL 3 is yum- .0.8. Yum 2.0.8 does not have a yum python module that later versions do. I suspect that the new module based yum provider won’t work with old yum versions.
Updated by AJ Christensen over 3 years ago
- Status changed from Unreviewed to Accepted
- Assignee set to Puppet Community
Anyone have some python-fu that can update the yumhelper.py to check if ‘import yum’ is succesful, and if not the package provider should be marked as unavailable? If so, that’d be super – I’m not sure this is even possible in Python
Updated by Oliver Hookins over 3 years ago
Can’t you just wrap the import in a try/except :
try:
import yum
except ImportError:
blah
where “blah” is returning something meaningful to yum.rb. Then yum.rb could potentially fall back to calling the yum executable directly like most of the other providers do. Given a python helper is used only for yum is it really worth keeping yum different to all the other package types?
Updated by Luke Kanies over 3 years ago
This kind of shell-out if the yum libraries are missing seems like a good idea — then you at least get degenerate behaviour when nothing else is available.
My guess, though, is that it’d be impossible to have the shell-out produce the same output format as the yumhelper, which means, really, that the yum provider needs to support both the yumhelpler and yum directly, for when yumhelper fails, I guess.
Updated by Oliver Hookins over 3 years ago
Well, I’ve been working on this and while some discussions on IRC led me to think completely replacing yumhelper.py would result in better code this has not been the case. Parsing the output of the yum command correctly on all platforms and versions of yum IMHO is too error-prone. So I’m going to have a crack at just parsing the output of versions of yum (2.4 and earlier), and having everything else handled by yumhelper.py.
Until there are native ruby libraries for yum I doubt there will be a nicer way than handing off the work to either the executable or a python helper.
Updated by Oliver Hookins over 3 years ago
I’ve posted this patch which fixes the issue for RHEL3 and RHEL2.1 on the puppet-dev mailing list, but it is awaiting moderation/approval. Ready for testing.
Updated by Luke Kanies over 3 years ago
Can someone try the attached patch with both newer and older versions of RHEL to make sure it works?
Updated by Luke Kanies over 3 years ago
- Assignee changed from Puppet Community to David Lutterkort
- Target version set to 0.24.6
Updated by James Turnbull over 3 years ago
- Target version changed from 0.24.6 to 0.25.0
Due to a lack of response this hasn’t made 0.24.6
Updated by Oliver Hookins over 3 years ago
If it makes any difference, I have tested it and am running all my machines with the patch provided and it works well. The configurations that make up my environment are: – RHEL 2.1 i386 – RHEL 3 i386 – RHEL 4 i386/x86_64 – RHEL 5 i386/x86_64
Of course if you need someone else to test then ignore this post.
Updated by Luke Kanies over 3 years ago
ohookins wrote:
If it makes any difference, I have tested it and am running all my machines with the patch provided and it works well. The configurations that make up my environment are: – RHEL 2.1 i386 – RHEL 3 i386 – RHEL 4 i386/x86_64 – RHEL 5 i386/x86_64
Of course if you need someone else to test then ignore this post.
Ideally we’d like at least one other person to test. I’ll ask around.
Updated by David Lutterkort over 3 years ago
I tested it on a couple Fedora machines (seem to have misplaced all my RHEL VM’s), but the patch looks good and at the very least doesn’t cause regressions.
Can you add a comment that specifically states that the shell_out business is only needed for RHEL3 and earlier (so we can kill it when RHEL3 is EOL’d)
Also, there’s a few minor things in shell_out:
- Instead of doing ‘rc >> 8’ use os.WEXITSTATUS, since that’s the documented way to get the child’s status in waitpid(2)
- Shouldn’t the regexp to skip a blank line be “[ \t]*$” instead of “( )?$” ? Would be more conservative
Other than that, looks good.
Updated by Luke Kanies over 3 years ago
- Status changed from Accepted to Code Insufficient
- Assignee changed from David Lutterkort to James Turnbull
- Target version changed from 0.25.0 to 0.24.6
Assigning to James because ohookins isn’t a developer on the project. :/
Updated by James Turnbull over 3 years ago
- Assignee changed from James Turnbull to Oliver Hookins
Updated by Oliver Hookins over 3 years ago
Here’s the updated patch with suggested improvements.
Updated by James Turnbull over 3 years ago
- Status changed from Code Insufficient to Closed
Pushed in commit:7275d7cb9083b4183f394a5d6798e1675def6d28 in branch 0.24.x