From 3f678343f9c636b10b024c4aa5ffc25aaa6d6218 Mon Sep 17 00:00:00 2001 From: Konrad Scherer Date: Tue, 5 Jan 2016 11:26:17 -0500 Subject: [PATCH 1/2] Add support of OpenSuSE and SLED All currently supported versions of OpenSuSE use systemd. Suse Enterprise Linux has two flavors: Server and Desktop. The 11.x release still uses sysv but the 12.0 release uses systemd. Signed-off-by: Konrad Scherer --- manifests/params.pp | 10 ++++++++-- spec/classes/init_spec.rb | 27 +++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/manifests/params.pp b/manifests/params.pp index 9cab2e5d..3e597faf 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -55,8 +55,14 @@ } } elsif $::operatingsystem == 'Archlinux' { $init_style = 'systemd' - } elsif $::operatingsystem == 'SLES' { - $init_style = 'sles' + } elsif $::operatingsystem == 'OpenSuSE' { + $init_style = 'systemd' + } elsif $::operatingsystem =~ /SLE[SD]/ { + if versioncmp($::operatingsystemrelease, '12.0') < 0 { + $init_style = 'sles' + } else { + $init_style = 'systemd' + } } elsif $::operatingsystem == 'Darwin' { $init_style = 'launchd' } elsif $::operatingsystem == 'Amazon' { diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index a4db6ceb..cd7fdab3 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -690,6 +690,33 @@ it { should contain_class('consul').with_init_style('debian') } end + context "On opensuse" do + let(:facts) {{ + :operatingsystem => 'OpenSuSE', + :operatingsystemrelease => '13.1' + }} + + it { should contain_class('consul').with_init_style('systemd') } + end + + context "On SLED" do + let(:facts) {{ + :operatingsystem => 'SLED', + :operatingsystemrelease => '11.4' + }} + + it { should contain_class('consul').with_init_style('sles') } + end + + context "On SLES" do + let(:facts) {{ + :operatingsystem => 'SLES', + :operatingsystemrelease => '12.0' + }} + + it { should contain_class('consul').with_init_style('systemd') } + end + # Config Stuff context "With extra_options" do let(:params) {{ From e9c07984bf7dd1fb9007ff11b3833cdfdb701ac1 Mon Sep 17 00:00:00 2001 From: Konrad Scherer Date: Wed, 6 Jan 2016 08:42:24 -0500 Subject: [PATCH 2/2] Update metadata.json with Suse support Signed-off-by: Konrad Scherer --- metadata.json | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/metadata.json b/metadata.json index b913bcca..6362683d 100644 --- a/metadata.json +++ b/metadata.json @@ -77,6 +77,27 @@ "20", "21" ] + }, + { + "operatingsystem": "OpenSuSE", + "operatingsystemrelease": [ + "13.1", + "13.2" + ] + }, + { + "operatingsystem": "SLES", + "operatingsystemrelease": [ + "11.4", + "12.0" + ] + }, + { + "operatingsystem": "SLED", + "operatingsystemrelease": [ + "11.4", + "12.0" + ] } ] }