Skip to content

Add Ubuntu 18.04 support #1809

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 18 commits into from
Closed

Conversation

bastelfreak
Copy link
Collaborator

I'm currently implementing Ubuntu 18.04 support. Early feedback is highly appreciated :)

@bastelfreak bastelfreak force-pushed the ubuntu1804 branch 7 times, most recently from 40f911b to c8845c6 Compare August 5, 2018 18:01
bastelfreak added a commit to bastelfreak/puppetlabs-apache that referenced this pull request Aug 6, 2018
This typo is present since ~ 7 months. puppetlabs@02919a8#diff-54659813dfca25ca1f5df88aaccb09ecL199
Nobody noticed it because there are no acceptance tests running for
everything where unless does not match. I discovered this in puppetlabs#1809
@bastelfreak bastelfreak force-pushed the ubuntu1804 branch 2 times, most recently from bf2bf7f to b51e3f7 Compare August 6, 2018 19:34
@bastelfreak bastelfreak changed the title [WIP] Add Ubuntu 18.04 support Add Ubuntu 18.04 support Aug 6, 2018
Copy link
Contributor

@HelenCampbell HelenCampbell left a comment

Choose a reason for hiding this comment

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

Looking good, just a few general comments at the minute. Awesome job on the test updates!
I've been running this through a test pipeline and it's passing on Debian 8 and Redhat 7 so far, failing on Ubuntu 16 due to that policy.rc issue.

Gemfile Outdated
@@ -43,6 +43,9 @@ group :system_tests do
gem "beaker-pe", require: false
gem "beaker-hostgenerator"
gem "beaker-rspec"
gem 'rbnacl', '~> 4', :require => false if RUBY_VERSION >= '2.2.6'
Copy link
Contributor

Choose a reason for hiding this comment

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

What are you using these Gems for? The Gemfile will be overwritten by a pdk run so these changes would eventually get removed. If you want them permanent they'll have to be moved to .sync.yml.

Copy link
Collaborator

Choose a reason for hiding this comment

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

These are needed if you use modern SSH keys (ed25519) and want to run acceptance tests.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The commit already has some information:
7703346

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks! We will look in to adding these to puppet-module-gems.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We changed it to allow newer version of rbnacl as well: voxpupuli/modulesync_config@58f32bf

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you remove these new Gems for merge? We will be adding them to the puppet-module-gems in due time and these would conflict.

@@ -13,7 +13,7 @@

::apache::mod { 'dav_svn': }

if $::osfamily == 'Debian' and ($::operatingsystemmajrelease != '6' and $::operatingsystemmajrelease != '10.04' and $::operatingsystemrelease != '10.04' and $::operatingsystemmajrelease != '16.04') {
if $::osfamily == 'Debian' and ($::operatingsystemmajrelease != '6' and !($::operatingsystemmajrelease in ['10.04', '16.04', '18.04'])) {
Copy link
Contributor

Choose a reason for hiding this comment

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

We have long dropped support for 10.04 so you can remove it here :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

removed it


# without this apache fails to start -> installation of mod-php-something fails because it reloads apache to enable the module. WTF Ubuntu
# exit codes are documented at https://askubuntu.com/a/365912. Default for docker images is 101
shell("sed -i 's/^exit.*/exit 0/' /usr/sbin/policy-rc.d")
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it be worth adding this code into the spec_helper_acceptance since you reuse it a couple of times? Also gross to these bugs :| I am running this PR through an ad-hoc pipeline and am hitting this issue on Ubuntu 16 as you seem to be.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Did you run the master branch and that failed, or my version?

Copy link
Contributor

Choose a reason for hiding this comment

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

Your version. I'll re-run again this morning with your recent changes :)

Copy link
Contributor

Choose a reason for hiding this comment

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

So I've found locally that my tests will run if I change to
before :all do on(host, "if [ -a '/usr/sbin/policy-rc.d' ]; then sed -i 's/^exit.*/exit 0/' /usr/sbin/policy-rc.d; fi") if ['16.04', '18.04'].include?(fact('operatingsystemmajrelease')) end
instead of doing it in the describe.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ew that didn't format well.. To summarise I just moved it into a 'before :all' clause. That seems to be why I kept hitting into that issue where the tests bombed out instead of running.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I added it like this:

 spec/acceptance/mod_suphp_spec.rb | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/spec/acceptance/mod_suphp_spec.rb b/spec/acceptance/mod_suphp_spec.rb
index dbf3a28c..4a1388b8 100644
--- a/spec/acceptance/mod_suphp_spec.rb
+++ b/spec/acceptance/mod_suphp_spec.rb
@@ -1,8 +1,8 @@
 require 'spec_helper_acceptance'
 
 # why is that not executed on 16.04
-describe 'apache::mod::suphp class', if: (fact('operatingsystem') == 'Ubuntu' && fact('operatingsystemmajrelease') != '16.04') do
-  if ['16.04', '18.04'].include?(fact('operatingsystemmajrelease'))
+describe 'apache::mod::suphp class' do
+  before :all do
     # this policy defaults to 101. it prevents newly installed services from starting
     # it is useful for containers, it prevents new processes during 'docker build'
     # but we actually want to test the services and this should not behave like docker
@@ -10,8 +10,9 @@ describe 'apache::mod::suphp class', if: (fact('operatingsystem') == 'Ubuntu' &&
 
     # without this apache fails to start -> installation of mod-php-something fails because it reloads apache to enable the module. WTF Ubuntu
     # exit codes are documented at https://askubuntu.com/a/365912. Default for docker images is 101
-    shell("sed -i 's/^exit.*/exit 0/' /usr/sbin/policy-rc.d")
+    on(host, "if [ -a '/usr/sbin/policy-rc.d' ]; then sed -i 's/^exit.*/exit 0/' /usr/sbin/policy-rc.d; fi") if ['16.04', '18.04'].include?(fact('operatingsystemmajrelease'))
   end
+
   # mod php isn't supported for ubuntu 1.04
   next if fact('operatingsystemmajrelease') == '18.04'
   context 'default suphp config' do

but I get this error:

Failures:

  1) apache::mod::suphp class default suphp config succeeds in puppeting suphp
     Failure/Error: on(host, "if [ -a '/usr/sbin/policy-rc.d' ]; then sed -i 's/^exit.*/exit 0/' /usr/sbin/policy-rc.d; fi") if ['16.04', '18.04'].include?(fact('operatingsystemmajrelease'))
     NoMethodError:
       private method `exec' called for Host "":Serverspec::Type::Host

end
end

context 'provide content and template config file' do
# does the following even makes sense? Why do we hardcode the php5 template?
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd agree with you, not sure there's much point to this test

shell("sed -i 's/^exit.*/exit 0/' /usr/sbin/policy-rc.d")
end
if fact('operatingsystemmajrelease') == '18.04'
# Again Ubuntu. W T F.

Choose a reason for hiding this comment

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

I'd just like to point out this is an upstream Debian bug, so your 'WTF Ubuntu' is misdirected and misplaced. Regardless your personal feelings and reactions should most likely never appear in public code in the first place even if misguided.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

sorry, that was written after hours of personal frustration, I removed it

Choose a reason for hiding this comment

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

I know the feeling, thanks for cleaning it up!

@bastelfreak bastelfreak force-pushed the ubuntu1804 branch 2 times, most recently from cfba469 to 82e2fe9 Compare August 14, 2018 07:08
@tphoney
Copy link
Contributor

tphoney commented Aug 14, 2018

Having a look, what a PR 😮

.sync.yml Outdated
@@ -5,6 +5,8 @@
docker_sets:
- set: docker/centos-7
- set: docker/ubuntu-14.04
- set: docker/ubuntu-16.04
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we get both Ubuntu16&18 removed from here and the travis file.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

.travis.yml Outdated
dist: trusty
env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_set=docker/centos-7
env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_setfile=centos7-64{hypervisor=docker}
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we get this change reverted back to BEAKER_set=docker/centos-7 and BEAKER_set=docker/ubuntu-14.04 please? (Work is ongoing to implement this functionality.)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

@@ -35,5 +35,5 @@
}
end

it { is_expected.to compile.with_all_deps }
# it { is_expected.to compile.with_all_deps }
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there any reason this is commented out?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It didn't work in combination with rspec-puppet-facts and also felt redundant. All the mod files should already include it { is_expected.to compile.with_all_deps }

@@ -13,7 +13,7 @@

::apache::mod { 'dav_svn': }

if $::osfamily == 'Debian' and ($::operatingsystemmajrelease != '6' and $::operatingsystemmajrelease != '10.04' and $::operatingsystemrelease != '10.04' and $::operatingsystemmajrelease != '16.04') {
if $::osfamily == 'Debian' and ($::operatingsystemmajrelease != '6' and !($::operatingsystemmajrelease in ['16.04', '18.04'])) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

The $::operatingsystemmajrelease != '6' looks redundant. I hope Debian 6 isn't supported. It's also pretty hard to parse. So the result is that for Ubuntu 14.04 it's undef but everything else has dav_svn_authz_svn.load?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I tried to not rewrite it because that would cause an even bigger diff. A general cleanup is advised after this PR + #1804 got merged.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

cleaned it up

unless $::operatingsystem == 'SLES' { apache::security::rule_link { $activated_rules: } }
# the rule setup on ubuntu 18.04 is completely different,
# the default rules used within this module aren't available
unless $::operatingsystem == 'SLES' or $facts['os']['release']['major'] == '18.04' { apache::security::rule_link { $activated_rules: } }
Copy link
Collaborator

Choose a reason for hiding this comment

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

Might be a bit more readable to put the body on a new line. It's very long.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed

@@ -1,5 +1,8 @@
class apache::mod::suphp (
){
if ($facts['os']['name'] == 'Ubuntu' and versioncmp($facts['os']['release']['major'], '18.04') >= 0) {
fail('mod_fastcgi is no longer supported on Ubuntu 18.04 and above. Please use mod_proxy_fcgi')
Copy link
Collaborator

Choose a reason for hiding this comment

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

This message doesn't make sense to me. Does suphp depend on mod_fastcgi? Copy paste error?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

good spot, copy and paste error. I will fix it

@@ -263,6 +263,33 @@
'wsgi' => 'libapache2-mod-wsgi',
'xsendfile' => 'libapache2-mod-xsendfile',
}
} elsif $facts['os']['release']['major'] == '18.04' {
# major.minor version used since Debian stretch and Ubuntu Xenial
$php_version = '7.2' # different to Ubuntu 18.04
Copy link
Collaborator

Choose a reason for hiding this comment

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

Did you mean 16.04 here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed

metadata.json Outdated
@@ -21,15 +21,13 @@
{
"operatingsystem": "RedHat",
"operatingsystemrelease": [
"5",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this the right PR to drop these?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

cherry-picked into #1824

@@ -171,10 +181,9 @@ class { 'apache::mod::passenger': }
expected_one = [%r{Apache processes}, %r{Nginx processes}, %r{Passenger processes}]
# passenger-memory-stats output on newer Debian/Ubuntu verions do not contain
# these two lines
unless (fact('operatingsystem') == 'Ubuntu' && fact('operatingsystemrelease') == '14.04') ||
(fact('operatingsystem') == 'Ubuntu' && fact('operatingsystemrelease') == '16.04') ||
unless (fact('operatingsystem') == 'Ubuntu' && ['14.04', '16.04', '18.04'].include?(fact('operatingsystemrelease'))) ||
Copy link
Collaborator

Choose a reason for hiding this comment

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

Isn't this basically every supported Ubuntu version? I'd even thing Debian 9 would fail here so I think this whole block can be removed if it's no longer included.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed

# spacing may vary
expect(r.stdout).to match(%r{[\-]+ General information [\-]+})
end
end
expected_two = if fact('operatingsystem') == 'Ubuntu' && fact('operatingsystemrelease') == '14.04' ||
(fact('operatingsystem') == 'Ubuntu' && fact('operatingsystemrelease') == '16.04') ||
expected_two = if fact('operatingsystem') == 'Ubuntu' && ['14.04', '16.04', '18.04'].include?(fact('operatingsystemrelease')) ||
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think you can drop the Ubuntu version checks here as well.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

shell("sed -i 's/^exit.*/exit 0/' /usr/sbin/policy-rc.d")
end
# mod php isn't supported for ubuntu 1.04
next if fact('operatingsystemmajrelease') == '18.04'
Copy link
Collaborator

Choose a reason for hiding this comment

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

It's better to do this in the describe like 16.04.

@@ -1,6 +1,19 @@
require 'spec_helper_acceptance'

# why is that not executed on 16.04
Copy link
Collaborator

Choose a reason for hiding this comment

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

And why is it only executed on Ubuntu setups? Do other distros not ship it?

@@ -964,7 +964,7 @@ class { 'apache': }
describe file($ports_file) do
it { is_expected.to be_file }
if fact('osfamily') == 'RedHat' && fact('operatingsystemmajrelease') == '7' ||
fact('operatingsystem') == 'Ubuntu' && fact('operatingsystemrelease') =~ %r{(14\.04|16\.04)} ||
fact('operatingsystem') == 'Ubuntu' && fact('operatingsystemrelease') =~ %r{(14\.04|16\.04|18\.04)} ||
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this is all supported Ubuntu versions.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed

@mmoll
Copy link
Contributor

mmoll commented Nov 6, 2018

this needs a rebase...
without having a closer look: what's backwards-incompatible here?

david22swan added a commit to david22swan/puppetlabs-apache that referenced this pull request Nov 22, 2018
PR made to finialize work started by community member bastelfreak, (puppetlabs#1809).
Includes work done to migrate spec classes tests to rspec-puppet-facts.
david22swan added a commit to david22swan/puppetlabs-apache that referenced this pull request Nov 22, 2018
PR made to finialize work started by community member bastelfreak, (puppetlabs#1809).
Includes work done to migrate spec classes tests to rspec-puppet-facts.
david22swan added a commit to david22swan/puppetlabs-apache that referenced this pull request Nov 23, 2018
PR made to finialize work started by community member bastelfreak, (puppetlabs#1809).
Includes work done to migrate spec classes tests to rspec-puppet-facts.
david22swan added a commit to david22swan/puppetlabs-apache that referenced this pull request Nov 23, 2018
PR made to finialize work started by community member bastelfreak, (puppetlabs#1809).
Includes work done to migrate spec classes tests to rspec-puppet-facts.
david22swan added a commit to david22swan/puppetlabs-apache that referenced this pull request Nov 26, 2018
PR made to finialize work started by community member bastelfreak, (puppetlabs#1809).
Includes work done to migrate spec classes tests to rspec-puppet-facts.
david22swan added a commit to david22swan/puppetlabs-apache that referenced this pull request Nov 26, 2018
PR made to finialize work started by community member bastelfreak, (puppetlabs#1809).
Includes work done to migrate spec classes tests to rspec-puppet-facts.
david22swan added a commit to david22swan/puppetlabs-apache that referenced this pull request Nov 26, 2018
PR made to finialize work started by community member bastelfreak, (puppetlabs#1809).
Includes work done to migrate spec classes tests to rspec-puppet-facts.
david22swan added a commit to david22swan/puppetlabs-apache that referenced this pull request Nov 26, 2018
PR made to finialize work started by community member bastelfreak, (puppetlabs#1809).
Includes work done to migrate spec classes tests to rspec-puppet-facts.
david22swan added a commit to david22swan/puppetlabs-apache that referenced this pull request Nov 29, 2018
PR made to finialize work started by community member bastelfreak, (puppetlabs#1809).
Includes work done to migrate spec classes tests to rspec-puppet-facts.
david22swan added a commit to david22swan/puppetlabs-apache that referenced this pull request Nov 29, 2018
PR made to finialize work started by community member bastelfreak, (puppetlabs#1809).
Includes work done to migrate spec classes tests to rspec-puppet-facts.
david22swan added a commit to david22swan/puppetlabs-apache that referenced this pull request Nov 30, 2018
PR made to finialize work started by community member bastelfreak, (puppetlabs#1809).
Includes work done to migrate spec classes tests to rspec-puppet-facts.

Co-authered-by: Tim Meusel <tim@bastelfreak.de>
david22swan added a commit to david22swan/puppetlabs-apache that referenced this pull request Nov 30, 2018
PR made to finialize work started by community member bastelfreak, (puppetlabs#1809).
Includes work done to migrate spec classes tests to rspec-puppet-facts.

Co-authored-by: Tim Meusel <tim@bastelfreak.de>
@david22swan
Copy link
Member

@bastelfreak Closing as a pr finishing this work has been merged in:
#1850
Thanks for the great work you put into it though

yakatz pushed a commit to yakatz/puppetlabs-apache that referenced this pull request Apr 23, 2020
This typo is present since ~ 7 months. puppetlabs@02919a8#diff-54659813dfca25ca1f5df88aaccb09ecL199
Nobody noticed it because there are no acceptance tests running for
everything where unless does not match. I discovered this in puppetlabs#1809
yakatz pushed a commit to yakatz/puppetlabs-apache that referenced this pull request Apr 23, 2020
PR made to finialize work started by community member bastelfreak, (puppetlabs#1809).
Includes work done to migrate spec classes tests to rspec-puppet-facts.

Co-authored-by: Tim Meusel <tim@bastelfreak.de>
cegeka-jenkins pushed a commit to cegeka/puppet-apache that referenced this pull request Jul 15, 2020
This typo is present since ~ 7 months. puppetlabs@02919a8#diff-54659813dfca25ca1f5df88aaccb09ecL199
Nobody noticed it because there are no acceptance tests running for
everything where unless does not match. I discovered this in puppetlabs#1809
cegeka-jenkins pushed a commit to cegeka/puppet-apache that referenced this pull request Jul 15, 2020
PR made to finialize work started by community member bastelfreak, (puppetlabs#1809).
Includes work done to migrate spec classes tests to rspec-puppet-facts.

Co-authored-by: Tim Meusel <tim@bastelfreak.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants