diff --git a/Gemfile b/Gemfile index e960f7c4b..106cfb76f 100644 --- a/Gemfile +++ b/Gemfile @@ -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 diff --git a/manifests/params.pp b/manifests/params.pp index a3cde9ea5..500c982ef 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -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, @@ -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' @@ -97,7 +103,6 @@ '127.0.0.1', '-6 ::1', ] - $service_name = 'ntp' $iburst_enable = false $servers = [ '0.opensuse.pool.ntp.org', @@ -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 @@ -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 diff --git a/spec/acceptance/nodesets/sles-12-64.yml b/spec/acceptance/nodesets/sles-12-64.yml new file mode 100644 index 000000000..00c147a8f --- /dev/null +++ b/spec/acceptance/nodesets/sles-12-64.yml @@ -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 diff --git a/spec/acceptance/ntp_install_spec.rb b/spec/acceptance/ntp_install_spec.rb index 1c81fb005..29aac2246 100644 --- a/spec/acceptance/ntp_install_spec.rb +++ b/spec/acceptance/ntp_install_spec.rb @@ -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 diff --git a/spec/acceptance/ntp_parameters_spec.rb b/spec/acceptance/ntp_parameters_spec.rb index 675cf81e4..e4c230d7e 100644 --- a/spec/acceptance/ntp_parameters_spec.rb +++ b/spec/acceptance/ntp_parameters_spec.rb @@ -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') diff --git a/spec/acceptance/ntp_service_spec.rb b/spec/acceptance/ntp_service_spec.rb index 83c279758..7851bd07c 100644 --- a/spec/acceptance/ntp_service_spec.rb +++ b/spec/acceptance/ntp_service_spec.rb @@ -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 diff --git a/spec/classes/ntp_spec.rb b/spec/classes/ntp_spec.rb index 809bc12f5..ab7eda5ed 100644 --- a/spec/classes/ntp_spec.rb +++ b/spec/classes/ntp_spec.rb @@ -9,6 +9,10 @@ let :facts do super().merge({ :osfamily => 'Linux', :operatingsystem => 'Gentoo' }) end + elsif system == 'Suse' + let :facts do + super().merge({ :osfamily => system,:operatingsystem => 'SLES',:operatingsystemmajrelease => '11' }) + end else let :facts do super().merge({ :osfamily => system }) @@ -214,19 +218,19 @@ :servers => ['a', 'b', 'c', 'd'], :logfile => '/var/log/foobar.log', }} - + it 'should contain logfile setting' do should contain_file('/etc/ntp.conf').with({ 'content' => /^logfile = \/var\/log\/foobar\.log\n/, }) end end - + context 'when set to false' do let(:params) {{ :servers => ['a', 'b', 'c', 'd'], }} - + it 'should not contain a logfile line' do should_not contain_file('/etc/ntp.conf').with({ 'content' => /logfile =/, @@ -289,13 +293,13 @@ describe "on osfamily Suse" do let :facts do - super().merge({ :osfamily => 'Suse' }) + super().merge({ :osfamily => 'Suse', :operatingsystem => 'SLES',:operatingsystemmajrelease => '11' }) end it 'uses the opensuse ntp servers by default' do should contain_file('/etc/ntp.conf').with({ 'content' => /server \d.opensuse.pool.ntp.org/, - }) + }) end end diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index 07c47c601..3f5e41061 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -1,20 +1,25 @@ 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 -b 3.2.x https://github.com/puppetlabs/puppetlabs-stdlib /etc/puppetlabs/puppet/modules/stdlib' end end @@ -29,6 +34,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