Skip to content

Commit

Permalink
Add SLES12 support as it has changed to Systemd
Browse files Browse the repository at this point in the history
  • Loading branch information
Travis Fields committed Oct 23, 2014
1 parent e5cd001 commit 8491dd6
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 21 deletions.
3 changes: 1 addition & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ group :development, :test do
gem 'puppetlabs_spec_helper', :require => false
gem 'serverspec', :require => false
gem 'puppet-lint', :require => false
gem 'beaker', :require => false
gem 'beaker-rspec', :require => false
gem 'beaker-rspec','>=2.2.0', :require => false
gem 'pry', :require => false
gem 'simplecov', :require => false
end
Expand Down
15 changes: 10 additions & 5 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
$udlc = false
$interfaces = []

# On virtual machines allow large clock skews.
# On virtual machines allow large clock skews.
$panic = str2bool($::is_virtual) ? {
true => false,
default => true,
Expand Down Expand Up @@ -87,6 +87,12 @@
]
}
'Suse': {
if $::operatingsystem == 'SLES' and $::operatingsystemmajrelease == '12'
{
$service_name = 'ntpd'
} else{
$service_name = 'ntp'
}
$config = $default_config
$keys_file = $default_keys_file
$driftfile = '/var/lib/ntp/drift/ntp.drift'
Expand All @@ -97,7 +103,6 @@
'127.0.0.1',
'-6 ::1',
]
$service_name = 'ntp'
$iburst_enable = false
$servers = [
'0.opensuse.pool.ntp.org',
Expand Down Expand Up @@ -168,7 +173,7 @@
'3.pool.ntp.org',
]
}
# Gentoo was added as its own $::osfamily in Facter 1.7.0
# Gentoo was added as its own $::osfamily in Facter 1.7.0
'Gentoo': {
$config = $default_config
$keys_file = $default_keys_file
Expand All @@ -190,8 +195,8 @@
]
}
'Linux': {
# Account for distributions that don't have $::osfamily specific settings.
# Before Facter 1.7.0 Gentoo did not have its own $::osfamily
# Account for distributions that don't have $::osfamily specific settings.
# Before Facter 1.7.0 Gentoo did not have its own $::osfamily
case $::operatingsystem {
'Gentoo': {
$config = $default_config
Expand Down
20 changes: 20 additions & 0 deletions spec/acceptance/nodesets/sles-12-64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
HOSTS:
czriitzephrrlzw:
roles:
- master
- database
- dashboard
- agent
- default
platform: sles-12-x86_64
template: sles-12-x86_64
hypervisor: vcloud
CONFIG:
nfs_server: none
consoleport: 443
datastore: instance0
folder: Delivery/Quality Assurance/Enterprise/Dynamic
resourcepool: delivery/Quality Assurance/Enterprise/Dynamic
pooling_api: http://vcloud.delivery.puppetlabs.net/
pe_dir: http://enterprise.delivery.puppetlabs.net/3.4/preview
6 changes: 5 additions & 1 deletion spec/acceptance/ntp_install_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@
packagename = 'service/network/ntp'
end
else
packagename = 'ntp'
if fact('operatingsystem') == 'SLES' and fact('operatingsystemmajrelease') == '12'
servicename = 'ntpd'
else
servicename = 'ntp'
end
end

describe 'ntp::install class', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do
Expand Down
6 changes: 5 additions & 1 deletion spec/acceptance/ntp_parameters_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@
packagename = 'service/network/ntp'
end
else
packagename = 'ntp'
if fact('operatingsystem') == 'SLES' and fact('operatingsystemmajrelease') == '12'
servicename = 'ntpd'
else
servicename = 'ntp'
end
end

if (fact('osfamily') == 'Solaris')
Expand Down
20 changes: 12 additions & 8 deletions spec/acceptance/ntp_service_spec.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
require 'spec_helper_acceptance'

case fact('osfamily')
when 'RedHat', 'FreeBSD', 'Linux', 'Gentoo'
servicename = 'ntpd'
when 'Solaris'
servicename = 'network/ntp'
when 'AIX'
servicename = 'xntpd'
else
servicename = 'ntp'
when 'RedHat', 'FreeBSD', 'Linux', 'Gentoo'
servicename = 'ntpd'
when 'Solaris'
servicename = 'network/ntp'
when 'AIX'
servicename = 'xntpd'
else
if fact('operatingsystem') == 'SLES' and fact('operatingsystemmajrelease') == '12'
servicename = 'ntpd'
else
servicename = 'ntp'
end
end

describe 'ntp::service class', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do
Expand Down
15 changes: 11 additions & 4 deletions spec/spec_helper_acceptance.rb
Original file line number Diff line number Diff line change
@@ -1,20 +1,26 @@
require 'beaker-rspec'

UNSUPPORTED_PLATFORMS = [ 'windows', 'Darwin' ]
UNSUPPORTED_PLATFORMS = ['windows', 'Darwin']

unless ENV['RS_PROVISION'] == 'no' or ENV['BEAKER_provision'] == 'no'
# This will install the latest available package on el and deb based
# systems fail on windows and osx, and install via gem on other *nixes
foss_opts = { :default_action => 'gem_install' }
foss_opts = {:default_action => 'gem_install'}

if default.is_pe?; then install_pe; else install_puppet( foss_opts ); end
if default.is_pe?; then
install_pe;
else
install_puppet(foss_opts);
end

hosts.each do |host|
unless host.is_pe?
on host, "/bin/echo '' > #{host['hieraconf']}"
end
on host, "mkdir -p #{host['distmoduledir']}"
on host, puppet('module install puppetlabs-stdlib'), { :acceptable_exit_codes => [0,1] }
on host, apply_manifest('package{"git":ensure => present}')
on host, 'git clone https://github.com/puppetlabs/puppetlabs-stdlib /etc/puppetlabs/puppet/modules/stdlib'
#on host, puppet('module install puppetlabs-stdlib'), {:acceptable_exit_codes => [0, 1]}
end
end

Expand All @@ -29,6 +35,7 @@
c.before :suite do
hosts.each do |host|
on host, "mkdir -p #{host['distmoduledir']}/ntp"
on host, puppet('module install puppetlabs-stdlib')
%w(lib manifests templates metadata.json).each do |file|
scp_to host, "#{proj_root}/#{file}", "#{host['distmoduledir']}/ntp"
end
Expand Down

0 comments on commit 8491dd6

Please sign in to comment.