Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Oct 2, 2018. It is now read-only.

[COOK-2297] more gracefully handle pip packages from VCS and source archives #28

Merged
merged 1 commit into from
Feb 2, 2013

Conversation

Frick
Copy link
Contributor

@Frick Frick commented Jan 30, 2013

This small change prevents the (rather specific) use case of specifying a version with a package in version control from causing an error. Currently when a version is specified it will be appended to the resource name, breaking any URLs.

jtimberman pushed a commit that referenced this pull request Feb 2, 2013
[COOK-2297] more gracefully handle pip packages from VCS and source archives
@jtimberman jtimberman merged commit 6d2451d into poise:master Feb 2, 2013
pip_cmd('install', version == 'latest' ? '' : "==#{version}")
# if a version isn't specified (latest), is a source archive (ex. http://my.package.repo/SomePackage-1.0.4.zip),
# or from a VCS (ex. git+https://git.repo/some_pkg.git) then do not append a version as this will break the source link
if version == 'latest' || @new_resource.name.downcase.start_with?('http:') || ['git', 'hg', 'svn'].include?(@new_resource.name.downcase.split('+')[0])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't take HTTPS into account.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're correct, I failed to take that into account. Perhaps a single regex test would be better? I'm not sure of the proper way to update this, though. Update the associated ticket and this pull request or submit a new ticket and pull request?

@coderanger
Copy link
Member

Just as a general comment, this makes idempotence much harder to manage.

@Frick
Copy link
Contributor Author

Frick commented Feb 2, 2013

While I agree that using these types of URLs makes idempotence impossible (since they can point to a specific version or 'latest'), the only other option is to not support them at all. Currently if version is specified with one of these URLs it will throw an error. This patch was just to get around that issue as we use a couple of packages in this manner. And as I stated in the ticket, if you use an :upgrade action with a URL of this type the only way to prevent it from re-installing the package on every chef-client run is by specifying a package_name and version.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants