Skip to content

Instantly share code, notes, and snippets.

@scottwb
Created January 29, 2014 16:41
Show Gist options
  • Save scottwb/8691913 to your computer and use it in GitHub Desktop.
Save scottwb/8691913 to your computer and use it in GitHub Desktop.
Illustrates bug (and fix) in the `php` community cookbook's `pear` provider from https://github.com/opscode-cookbooks/php/blob/master/providers/pear.rb that occurs when upgrading packages when there is not detectable version to upgrade to. Free for anyone with a CLA to take and contribute! :)
diff --git a/cookbooks/php/providers/pear.rb b/cookbooks/php/providers/pear.rb
index db90e17..0172fca 100644
--- a/cookbooks/php/providers/pear.rb
+++ b/cookbooks/php/providers/pear.rb
@@ -155,7 +155,8 @@ def upgrade_package(name, version)
command = "echo \"\r\" | #{@bin} -d"
command << " preferred_state=#{can_haz(@new_resource, "preferred_state")}"
command << " upgrade -a#{expand_options(@new_resource.options)}"
- command << " #{prefix_channel(can_haz(@new_resource, "channel"))}#{name}-#{version}"
+ command << " #{prefix_channel(can_haz(@new_resource, "channel"))}#{name}"
+ command << "-#{version}" if version
pear_shell_out(command)
manage_pecl_ini(name, :create, can_haz(@new_resource, 'directives'), can_haz(@new_resource, 'zend_extensions')) if pecl?
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment