From ee91d3d4dd2114437795d80f32827c04993b60fc Mon Sep 17 00:00:00 2001 From: Max W Schwarz Date: Tue, 4 Nov 2014 15:17:04 -0800 Subject: [PATCH 1/2] Fix squashing of pear exit codes Commit 286125b fixed an error from where badly encoded data would cause crashes, but the fix of piping it through iconv mean that the status code returned was that of iconv. This causes the module to always treat the pear module as "installed," meaning the install exec would never run. This changes fixes that by sending the standard output to /dev/null, which preserves the original exit code. --- manifests/pear/module.pp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifests/pear/module.pp b/manifests/pear/module.pp index 080c478..d095aab 100644 --- a/manifests/pear/module.pp +++ b/manifests/pear/module.pp @@ -59,13 +59,13 @@ } $pear_exec_unless = $ensure ? { - present => "pear info ${pear_source} | iconv -c", + present => "pear info ${pear_source} > /dev/null", absent => undef } $pear_exec_onlyif = $ensure ? { present => undef, - absent => "pear info ${pear_source} | iconv -c", + absent => "pear info ${pear_source} > /dev/null", } $real_service = $service ? { From 4698b3345a616830141bf2531955a24c3779a9e8 Mon Sep 17 00:00:00 2001 From: Max W Schwarz Date: Tue, 4 Nov 2014 16:06:25 -0800 Subject: [PATCH 2/2] Update test for exec to match previous fix --- spec/defines/php_pear_module_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/defines/php_pear_module_spec.rb b/spec/defines/php_pear_module_spec.rb index 3603ead..13f977c 100644 --- a/spec/defines/php_pear_module_spec.rb +++ b/spec/defines/php_pear_module_spec.rb @@ -39,7 +39,7 @@ it 'should install pear module with exec commands' do should contain_exec('pear-Crypt-CHAP').with( 'command' => 'pear -d preferred_state=stable install pear.php.net/Crypt-CHAP', - 'unless' => 'pear info pear.php.net/Crypt-CHAP | iconv -c' + 'unless' => 'pear info pear.php.net/Crypt-CHAP > /dev/null' ) end end