-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Add Ubuntu 18.04 support #1809
Conversation
40f911b
to
c8845c6
Compare
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
bf2bf7f
to
b51e3f7
Compare
There was a problem hiding this 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' |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
manifests/mod/dav_svn.pp
Outdated
@@ -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'])) { |
There was a problem hiding this comment.
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 :)
There was a problem hiding this comment.
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") |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 :)
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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? |
There was a problem hiding this comment.
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
spec/acceptance/mod_php_spec.rb
Outdated
shell("sed -i 's/^exit.*/exit 0/' /usr/sbin/policy-rc.d") | ||
end | ||
if fact('operatingsystemmajrelease') == '18.04' | ||
# Again Ubuntu. W T F. |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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!
cfba469
to
82e2fe9
Compare
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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} |
There was a problem hiding this comment.
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.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
d95cb1e
to
4a89433
Compare
@@ -35,5 +35,5 @@ | |||
} | |||
end | |||
|
|||
it { is_expected.to compile.with_all_deps } | |||
# it { is_expected.to compile.with_all_deps } |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 }
manifests/mod/dav_svn.pp
Outdated
@@ -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'])) { |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cleaned it up
manifests/mod/security.pp
Outdated
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: } } |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
manifests/mod/suphp.pp
Outdated
@@ -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') |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
manifests/params.pp
Outdated
@@ -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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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'))) || |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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')) || |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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' |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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?
spec/acceptance/vhost_spec.rb
Outdated
@@ -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)} || |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
4a89433
to
f82da3f
Compare
ba6be49
to
df5e3b3
Compare
8ac37b9
to
500d9e1
Compare
this needs a rebase... |
PR made to finialize work started by community member bastelfreak, (puppetlabs#1809). Includes work done to migrate spec classes tests to rspec-puppet-facts.
PR made to finialize work started by community member bastelfreak, (puppetlabs#1809). Includes work done to migrate spec classes tests to rspec-puppet-facts.
PR made to finialize work started by community member bastelfreak, (puppetlabs#1809). Includes work done to migrate spec classes tests to rspec-puppet-facts.
PR made to finialize work started by community member bastelfreak, (puppetlabs#1809). Includes work done to migrate spec classes tests to rspec-puppet-facts.
PR made to finialize work started by community member bastelfreak, (puppetlabs#1809). Includes work done to migrate spec classes tests to rspec-puppet-facts.
PR made to finialize work started by community member bastelfreak, (puppetlabs#1809). Includes work done to migrate spec classes tests to rspec-puppet-facts.
PR made to finialize work started by community member bastelfreak, (puppetlabs#1809). Includes work done to migrate spec classes tests to rspec-puppet-facts.
PR made to finialize work started by community member bastelfreak, (puppetlabs#1809). Includes work done to migrate spec classes tests to rspec-puppet-facts.
PR made to finialize work started by community member bastelfreak, (puppetlabs#1809). Includes work done to migrate spec classes tests to rspec-puppet-facts.
PR made to finialize work started by community member bastelfreak, (puppetlabs#1809). Includes work done to migrate spec classes tests to rspec-puppet-facts.
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>
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>
@bastelfreak Closing as a pr finishing this work has been merged in: |
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
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>
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
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>
I'm currently implementing Ubuntu 18.04 support. Early feedback is highly appreciated :)