Re: Python PIP and Centos 6

1,191 views
Skip to first unread message

Joshua Vote

unread,
Dec 16, 2012, 9:20:44 PM12/16/12
to puppet...@googlegroups.com
I alluded to hacky workarounds in the OP - the below is what I'm currently using. It seems to work OK in a very non portable manner

file { '/usr/bin/pip':
   ensure => 'link',
   target => '/usr/bin/pip-python',
}


It would be great to hear if anyone knows of a preferred way to go about this. I'm very new to puppet but not afraid to get my hands dirty,

On Friday, December 14, 2012 4:12:02 PM UTC+8, Joshua Vote wrote:
Hi,

I'm currently in the process of writing my first puppet script and I've hit a a problem with the pip package provider. It seems like the puppet pip provider is looking for executable by the name of 'pip' but under Centos 6, the executable goes by the name 'pip-python'. While I can probably hack a workaround in, I'm curious if there is a preferred method of doing this? Should I try and extend the pip provider, create something akin to an alias or do something else entirely?

I'm using the Puppet 3.0.1 release and Centos 6.3 for what it's worth.

Thanks for any advice

Joshua Vote

unread,
Dec 18, 2012, 3:39:18 AM12/18/12
to puppet...@googlegroups.com
Yeah, I saw that function. Is there a way I can extend the class and override that method for my own use? Or will I need to make the fix myself and submit a pull request?

On Tuesday, December 18, 2012 9:01:35 AM UTC+8, 刘长元 wrote:
https://github.com/puppetlabs/puppet/blob/master/lib/puppet/provider/package/pip.rb

this is pip's source file. 
in the end, you can see this

private
  def lazy_pip(*args)
    pip *args
  rescue NoMethodError => e
    if pathname = which('pip')
      self.class.commands :pip => pathname
      pip *args
    else
      raise e, 'Could not locate the pip command.'
    end
  end

other functions call lazy_pip to install or uninstall packages.
and lazy_pip use which to find where is the 'pip' command.

在 2012年12月14日星期五UTC+8下午4时12分02秒,Joshua Vote写道:

Jakov Sosic

unread,
Dec 18, 2012, 8:58:06 PM12/18/12
to puppet...@googlegroups.com
On 12/18/2012 09:39 AM, Joshua Vote wrote:
> Yeah, I saw that function. Is there a way I can extend the class and
> override that method for my own use? Or will I need to make the fix
> myself and submit a pull request?

Pull request would be far better off because everyone would benefit from it.


--
Jakov Sosic
www.srce.unizg.hr

Joshua Vote

unread,
Dec 20, 2012, 1:41:16 AM12/20/12
to puppet...@googlegroups.com
If anyone else is watching this issue: the pull request has been made and attached to issue - http://projects.puppetlabs.com/issues/18236

Jared Curtis

unread,
Dec 21, 2012, 2:48:24 AM12/21/12
to puppet...@googlegroups.com
I've created another pull request that's a little more flexible than your version. If some other OS uses a different name for pip then it can easily be added to the case statement.

Reply all
Reply to author
Forward
0 new messages