From 3d01bab8bf6cdedd612200ef40e1e22395dd8736 Mon Sep 17 00:00:00 2001 From: Colleen Murphy Date: Wed, 8 Aug 2018 21:45:56 +0200 Subject: [PATCH] Turn off binary symlink in nodejs module On Xenial, the nodejs puppet module tries to create a symlink from /usr/bin/node to /usr/bin/nodejs. Depending on the resource ordering, this might happen before or after the nodejs package creates its own /usr/bin/node. If puppet has the chance to make the symlink itself, it breaks node by creating a broken link cycle. This patch uses the legacy_debian_symlinks parameter to prevent the puppet module from doing that. This problem was fixed and the option was deprecated and removed in later versions of the nodejs puppet module, so we will have to remove the parameter if we update the nodejs module. In this case, on puppet 3 a quirk of the resource ordering was causing the module not to be idempotent since the second puppet run would change the file to a symlink, so this patch has the side benefit of also allowing us to add a test for idempotency. With that second puppet run, the etherpad service now has enough time to fully start up and we can uncomment the curl test. Change-Id: Ic834ad6f0828cc2d20810e48bb053f9b14659c4a --- manifests/init.pp | 5 +++-- spec/acceptance/etherpad_lite_spec.rb | 26 ++++++++++++++------------ 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 71f476a..9ff72a3 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -59,8 +59,9 @@ class etherpad_lite ( if ($nodejs_version != 'system') { class { '::nodejs': - repo_url_suffix => $nodejs_version, - before => Anchor['nodejs-package-install'], + repo_url_suffix => $nodejs_version, + legacy_debian_symlinks => false, + before => Anchor['nodejs-package-install'], } } else { package { ['nodejs', 'npm']: diff --git a/spec/acceptance/etherpad_lite_spec.rb b/spec/acceptance/etherpad_lite_spec.rb index beb7713..e6a2f58 100644 --- a/spec/acceptance/etherpad_lite_spec.rb +++ b/spec/acceptance/etherpad_lite_spec.rb @@ -24,6 +24,10 @@ describe 'puppet-etherpad_lite:: manifest', :if => ['debian', 'ubuntu'].include? apply_manifest(init_puppet_module, catch_failures: true) end + it 'should be idempotent' do + apply_manifest(init_puppet_module, catch_changes: true) + end + describe 'required files' do describe file('/opt/etherpad-lite/') do it { should be_directory } @@ -46,18 +50,16 @@ describe 'puppet-etherpad_lite:: manifest', :if => ['debian', 'ubuntu'].include? end end - # This needs more work before it's up in the test env ... - # - # describe 'required services' do - # describe 'ports are open and services are reachable' do - # describe port(80) do - # it { should be_listening } - # end + describe 'required services' do + describe 'ports are open and services are reachable' do + describe port(80) do + it { should be_listening } + end - # describe command('curl -L -k http://localhost --verbose') do - # its(:stdout) { should contain('randomPadName()') } - # end - # end - # end + describe command('curl -L -k http://localhost --verbose') do + its(:stdout) { should contain('randomPadName()') } + end + end + end end