Chef

yum query/yum-dump.py fails when a locally-compiled Python is in $PATH

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 0.10.0
  • Fix Version/s: 0.10.4
  • Component/s: Chef Client, Providers
  • Labels:
    None
  • Environment:

    CentOS 5
    Locally-compiled Python overriding system Python in my $PATH

  • Triage Status:
    Triaged

Description

If I run chef-client using above environment, it fails:

ERROR: package[rdiff-backup] (/srv/chef/cache/cookbooks/rdiff_backup/recipes/default.rb line 51) had an error:
yum failed - #<Process::Status: pid=15979,exited(1)> - returns: Traceback (most recent call last):
File "/usr/lib/ruby/gems/1.8/gems/chef-0.8.8/bin/../lib/chef/provider/package/yum-dump.py", line 33, in <module>
import yum
ImportError: No module named yum

/usr/lib/ruby/gems/1.8/gems/chef-0.8.8/bin/../lib/chef/provider/package/yum.rb:79:in `load_data'
/usr/lib/ruby/gems/1.8/gems/chef-0.8.8/bin/../lib/chef/provider/package/yum.rb:34:in `initialize'
/usr/lib/ruby/1.8/singleton.rb:95:in `new'
/usr/lib/ruby/1.8/singleton.rb:95:in `instance'
/usr/lib/ruby/gems/1.8/gems/chef-0.8.8/bin/../lib/chef/provider/package/yum.rb:110:in `initialize'
/usr/lib/ruby/gems/1.8/gems/chef-0.8.8/bin/../lib/chef/runner.rb:53:in `new'
/usr/lib/ruby/gems/1.8/gems/chef-0.8.8/bin/../lib/chef/runner.rb:53:in `build_provider'
/usr/lib/ruby/gems/1.8/gems/chef-0.8.8/bin/../lib/chef/runner.rb:59:in `run_action'
/usr/lib/ruby/gems/1.8/gems/chef-0.8.8/bin/../lib/chef/runner.rb:114:in `converge'
/usr/lib/ruby/gems/1.8/gems/chef-0.8.8/bin/../lib/chef/runner.rb:113:in `each'
/usr/lib/ruby/gems/1.8/gems/chef-0.8.8/bin/../lib/chef/runner.rb:113:in `converge'
/usr/lib/ruby/gems/1.8/gems/chef-0.8.8/bin/../lib/chef/resource_collection.rb:94:in `execute_each_resource'
/usr/lib/ruby/gems/1.8/gems/chef-0.8.8/bin/../lib/chef/resource_collection/stepable_iterator.rb:116:in `call'
/usr/lib/ruby/gems/1.8/gems/chef-0.8.8/bin/../lib/chef/resource_collection/stepable_iterator.rb:116:in `call_iterator_block'
/usr/lib/ruby/gems/1.8/gems/chef-0.8.8/bin/../lib/chef/resource_collection/stepable_iterator.rb:85:in `step'
/usr/lib/ruby/gems/1.8/gems/chef-0.8.8/bin/../lib/chef/resource_collection/stepable_iterator.rb:104:in `iterate'
/usr/lib/ruby/gems/1.8/gems/chef-0.8.8/bin/../lib/chef/resource_collection/stepable_iterator.rb:55:in `each_with_index'
/usr/lib/ruby/gems/1.8/gems/chef-0.8.8/bin/../lib/chef/resource_collection.rb:92:in `execute_each_resource'
/usr/lib/ruby/gems/1.8/gems/chef-0.8.8/bin/../lib/chef/runner.rb:91:in `converge'
/usr/lib/ruby/gems/1.8/gems/chef-0.8.8/bin/../lib/chef/client.rb:319:in `converge'
/usr/lib/ruby/gems/1.8/gems/chef-0.8.8/bin/../lib/chef/client.rb:89:in `run'
/usr/lib/ruby/gems/1.8/gems/chef-0.8.8/bin/../lib/chef/application/client.rb:210:in `run_application'
/usr/lib/ruby/gems/1.8/gems/chef-0.8.8/bin/../lib/chef/application/client.rb:202:in `loop'
/usr/lib/ruby/gems/1.8/gems/chef-0.8.8/bin/../lib/chef/application/client.rb:202:in `run_application'
/usr/lib/ruby/gems/1.8/gems/chef-0.8.8/bin/../lib/chef/application.rb:57:in `run'
/usr/lib/ruby/gems/1.8/gems/chef-0.8.8/bin/chef-client:26
/usr/bin/chef-client:19:in `load'
/usr/bin/chef-client:19
/usr/lib/ruby/gems/1.8/gems/chef-0.8.8/bin/../lib/chef/provider/package/yum.rb:79:in `load_data': yum failed - #<Process::Status: pid=15979,exited(1)> - returns: Traceback (most recent call last): (Chef::Exceptions::Package)
File "/usr/lib/ruby/gems/1.8/gems/chef-0.8.8/bin/../lib/chef/provider/package/yum-dump.py", line 33, in <module>
import yum
ImportError: No module named yum
from /usr/lib/ruby/gems/1.8/gems/chef-0.8.8/bin/../lib/chef/provider/package/yum.rb:34:in `initialize'
from /usr/lib/ruby/1.8/singleton.rb:95:in `new'
from /usr/lib/ruby/1.8/singleton.rb:95:in `instance'
from /usr/lib/ruby/gems/1.8/gems/chef-0.8.8/bin/../lib/chef/provider/package/yum.rb:110:in `initialize'
from /usr/lib/ruby/gems/1.8/gems/chef-0.8.8/bin/../lib/chef/runner.rb:53:in `new'
from /usr/lib/ruby/gems/1.8/gems/chef-0.8.8/bin/../lib/chef/runner.rb:53:in `build_provider'
from /usr/lib/ruby/gems/1.8/gems/chef-0.8.8/bin/../lib/chef/runner.rb:59:in `run_action'
from /usr/lib/ruby/gems/1.8/gems/chef-0.8.8/bin/../lib/chef/runner.rb:114:in `converge'
... 15 levels...
from /usr/lib/ruby/gems/1.8/gems/chef-0.8.8/bin/../lib/chef/application.rb:57:in `run'
from /usr/lib/ruby/gems/1.8/gems/chef-0.8.8/bin/chef-client:26
from /usr/bin/chef-client:19:in `load'
from /usr/bin/chef-client:19

Investigating further, lib/chef/provider/package/yum.rb on line 63 does

popen4("python #{helper}", :waitlast => true)

which means that any python in my $PATH can over-ride the system python. Since the Yum RPM relies on the standard Python RPM, we should be able to specify the path here intead. So this would instead become:

popen4("/usr/bin/python #{helper}", :waitlast => true)

Activity

Hide
Matthew Kent added a comment - 26/Apr/11 9:24 PM

Agreed - seems to cause issues on RHEL 4 as well. Don't see any downside here, yum is key part of the system and a user is unlikely to have replaced /usr/bin/python with something custom.

Show
Matthew Kent added a comment - 26/Apr/11 9:24 PM Agreed - seems to cause issues on RHEL 4 as well. Don't see any downside here, yum is key part of the system and a user is unlikely to have replaced /usr/bin/python with something custom.
Hide
Matthew Kent added a comment - 26/Apr/11 9:27 PM

Fixed as suggested thanks! Please pull from

https://github.com/mdkent/chef/tree/CHEF-1063

Show
Matthew Kent added a comment - 26/Apr/11 9:27 PM Fixed as suggested thanks! Please pull from https://github.com/mdkent/chef/tree/CHEF-1063
Hide
Matthew Kent added a comment - 28/Apr/11 4:24 AM

yum fixes are starting to overlap - I'm pooling them under CHEF-2280 and this branch: https://github.com/mdkent/chef/commits/yum-improvements

Show
Matthew Kent added a comment - 28/Apr/11 4:24 AM yum fixes are starting to overlap - I'm pooling them under CHEF-2280 and this branch: https://github.com/mdkent/chef/commits/yum-improvements
Hide
Bryan McLellan added a comment - 20/May/11 1:14 AM

This patch has been merged to opscode/master and will be included in the next release. Thank you for contributing to Chef!

Show
Bryan McLellan added a comment - 20/May/11 1:14 AM This patch has been merged to opscode/master and will be included in the next release. Thank you for contributing to Chef!
Hide
Bryan McLellan added a comment - 07/Jul/11 6:00 PM

Reopening for fix version change.

Show
Bryan McLellan added a comment - 07/Jul/11 6:00 PM Reopening for fix version change.
Hide
Bryan McLellan added a comment - 07/Jul/11 6:02 PM

0.10.2 was a security release, 0.10.4 is the next maintenance release.

Show
Bryan McLellan added a comment - 07/Jul/11 6:02 PM 0.10.2 was a security release, 0.10.4 is the next maintenance release.
Hide
Bryan McLellan added a comment - 07/Jul/11 6:04 PM

Bulk edit: this ticket should have been previously merged for 0.10.2, but will be released in 0.10.4

Show
Bryan McLellan added a comment - 07/Jul/11 6:04 PM Bulk edit: this ticket should have been previously merged for 0.10.2, but will be released in 0.10.4

People

Vote (0)
Watch (1)

Dates

  • Created:
    25/Mar/10 5:44 PM
    Updated:
    07/Jul/11 6:04 PM
    Resolved:
    07/Jul/11 6:04 PM