poise / python

THIS COOKBOOK IS DEPRECATED – Chef cookbook to install Python and related tools

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

environment parameter is not working as expected

kplimack opened this issue · comments

I'm trying to override ENV['PATH'] for a python_pip command, but it's not working as expected.

      ================================================================================
      Error executing action `install` on resource 'python_pip[whisper]'
      ================================================================================

      Errno::ENOENT
      -------------
      No such file or directory - pip

      Cookbook Trace:
      ---------------
      /var/chef/cache/cookbooks/python/providers/pip.rb:112:in `current_installed_version'
      /var/chef/cache/cookbooks/python/providers/pip.rb:100:in `load_current_resource'

      Resource Declaration:
      ---------------------
      # In /var/chef/cache/cookbooks/myorg-graphite/resources/carbon_cache.rb

       12:   python_pip new_resource.backend_name do
       13:     new_resource.backend_attributes.each { |attr, value| send(attr, value) }
       14:     Chef::Log.info "Installing storage backend: #{package_name}"
       15:     action :install
       16:     environment 'PATH' => "/opt/python-2.7/bin"
       17:   end
       18: end

      Compiled Resource:
      ------------------
      # Declared in /var/chef/cache/cookbooks/myorg-graphite/resources/carbon_cache.rb:12:in `block in class_from_file'

      python_pip("whisper") do
        action [:install]
        retries 0
        retry_delay 2
        default_guard_interpreter :default
        declared_type :python_pip
        cookbook_name "myorg-graphite"
        package_name "whisper"
        environment {"PATH"=>"/opt/python-2.7/bin"}
      end


    ================================================================================
    Error executing action `create` on resource 'myorg_graphite_carbon_cache[default]'
    ================================================================================

    Errno::ENOENT
    -------------
    python_pip[whisper] (/var/chef/cache/cookbooks/myorg-graphite/resources/carbon_cache.rb line 12) had an error: Errno::ENOENT: No such file or directory - pip

    Cookbook Trace:
    ---------------
    /var/chef/cache/cookbooks/python/providers/pip.rb:112:in `current_installed_version'
    /var/chef/cache/cookbooks/python/providers/pip.rb:100:in `load_current_resource'

this works, though

  ENV['PATH'] = "/opt/python-2.7/bin:#{ENV['PATH']}"
  python_pip new_resource.backend_name do
    new_resource.backend_attributes.each { |attr, value| send(attr, value) }
    Chef::Log.info "Installing storage backend: #{package_name}"
    action :install
    environment 'PATH' => "/opt/python-2.7/bin"
  end

This cookbook is deprecated, no bug fixes will be provided.