Pecl module installed but not activated
Closed this issue · 3 comments
Cookbook version
6.1.1
Chef-client version
12.13
Platform Details
Ubuntu 18.04
Scenario:
Mcrypt install for php 7.2
Steps to Reproduce:
"pecl": {
"packages": {
"mcrypt": "1.0.2"
}
}
node['pecl']['packages'].each do |package, version|
php_pear package do
version version
action :install
binary 'pecl'
end
end
Expected Result:
I want to see activated module in php -m
Actual Result:
pecl list
Installed packages, channel pecl.php.net:
=========================================
Package Version State
mcrypt 1.0.2 snapshot
No config in /etc/php/7.2/mods-available/ and no result if run php -m | grep mcrypt
I fixed this issue by changes in resources/pear.rb
Line 233-236:
if grep_for_version(shell_out(new_resource.binary + search_args).stdout, new_resource.package_name)
false
elsif grep_for_version(shell_out(node['php']['pecl'] + search_args).stdout, new_resource.package_name)
true
Changed to:
if grep_for_version(shell_out(new_resource.binary + search_args).stdout, new_resource.package_name) ||
grep_for_version(shell_out(node['php']['pecl'] + search_args).stdout, new_resource.package_name)
true
I don't sure that it's right way. Please let me know if you have a solution.
I hit this problem using PHP cookbook 6.1.1 and Chef Client 14.10.9
Resource definition
php_pear 'amqp' do
version '1.9.4'
preferred_state 'stable'
binary 'pecl'
end
Patch for resources/pear.rb
if grep_for_version(shell_out(new_resource.binary + search_args).stdout, new_resource.package_name)
- false
+ if new_resource.binary.include? 'pecl'
+ true
+ else
+ false
+ end
The pecl?
code used to only test pear packages in the first conditional test, but when the binary param was added, this conditional test was not updated to support cases where binary
was not the default value. I'm happy to roll this change into a PR if desired
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.