Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
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)
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.