Possible Bug in Python Pip Provider


#1

I think this might be a bug, but I wanted to be sure before I created a ticket.

I’m attempting to use the the pip provider to install a package. I’ve got
something like this:

python_pip “http://myinternal.repo/django/1.5/django-1.5.tar.gz” do
action :install
virtualenv virtualenv_path
version "1.5"
end

This yields the following error “HTTP error 404 while getting
http://myinternal.repo/django/1.5/django-1.5.tar.gz==1.5

Now according to COOK-2297 and
https://github.com/opscode-cookbooks/python/blob/master/providers/pip.rb#L134,
If my package name begins with an http as mine does then “==1.5” should not
get appended onto the URL. It appears that might not be working and I think its
because the name attribute is wrong.

The provider is saying new_resource.name.downcase.start_with, but the
resource seems to define the attribute as package_name
(https://github.com/opscode-cookbooks/python/blob/master/resources/pip.rb#L30)

Should name and package_name be interchangable, or should the provider logic on
L134 be updated to use package_name?


#2

package_name is set as :name_attribute => true, so that’s probably what’s
confusing you.

The code in the LWRP looks correct. Can you Gist the code from your recipe
somewhere?

  • Julian

On Fri, Mar 15, 2013 at 10:19 AM, davidpetzel@gmail.com wrote:

I think this might be a bug, but I wanted to be sure before I created a
ticket.

I’m attempting to use the the pip provider to install a package. I’ve got
something like this:

python_pip “http://myinternal.repo/django/1.5/django-1.5.tar.gz” do
action :install
virtualenv virtualenv_path
version "1.5"
end

This yields the following error “HTTP error 404 while getting
http://myinternal.repo/django/1.5/django-1.5.tar.gz==1.5

Now according to COOK-2297 and

https://github.com/opscode-cookbooks/python/blob/master/providers/pip.rb#L134
,
If my package name begins with an http as mine does then “==1.5” should
not
get appended onto the URL. It appears that might not be working and I
think its
because the name attribute is wrong.

The provider is saying new_resource.name.downcase.start_with, but the
resource seems to define the attribute as package_name
(
https://github.com/opscode-cookbooks/python/blob/master/resources/pip.rb#L30
)

Should name and package_name be interchangable, or should the provider
logic on
L134 be updated to use package_name?


[ Julian C. Dunn jdunn@aquezada.com * Sorry, I’m ]
[ WWW: http://www.aquezada.com/staff/julian * only Web 1.0 ]
[ gopher://sdf.org/1/users/keymaker/ * compliant! ]
[ PGP: 91B3 7A9D 683C 7C16 715F 442C 6065 D533 FDC2 05B9 ]


#3

Thanks Julian,
Turns out to be user error. The code to handle the http stuff was added in
1.2.2 and I was running an older version. Thanks for the clarification on
the name_attribute => true.

On Fri, Mar 15, 2013 at 10:33 AM, Julian C. Dunn jdunn@aquezada.com wrote:

package_name is set as :name_attribute => true, so that’s probably what’s
confusing you.

The code in the LWRP looks correct. Can you Gist the code from your recipe
somewhere?

  • Julian