Skip to content

Commit

Permalink
Merge pull request #712 from ghoneycutt/710_support_debian_7_and_8
Browse files Browse the repository at this point in the history
(GH-710) support debian 7 and 8
  • Loading branch information
ghoneycutt committed Jul 6, 2017
2 parents a83a744 + 6ce9054 commit 1a63540
Show file tree
Hide file tree
Showing 12 changed files with 90 additions and 34 deletions.
4 changes: 2 additions & 2 deletions Rakefile
Expand Up @@ -25,8 +25,8 @@ end
desc 'Validate manifests, templates, ruby files and shell scripts'
task :validate do
# lib/* gets checked by puppetlabs_spec_helper, though it skips spec entirely
Dir['Vagrantfile', 'spec/**/*.rb', 'lib/**/*.rb'].each do |ruby_file|
sh "ruby -c #{ruby_file}" unless ruby_file =~ /^(spec\/fixtures)|(lib)/
Dir['Vagrantfile', 'spec/**/*.rb'].each do |ruby_file|
sh "ruby -c #{ruby_file}" unless ruby_file =~ /spec\/fixtures/
end

Dir['**/*.sh'].each do |shell_script|
Expand Down
31 changes: 23 additions & 8 deletions Vagrantfile
Expand Up @@ -39,31 +39,31 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
client.vm.hostname = 'el7-client.example.com'
client.vm.network :private_network, ip: "192.168.56.11"
client.vm.provision :shell, :path => "tests/provision_basic_el.sh"
client.vm.provision :shell, :path => "tests/provision_client_el7.sh"
client.vm.provision :shell, :inline => "puppet apply /vagrant/tests/sensu-client.pp"
end

config.vm.define "el6-client", autostart: false do |client|
client.vm.box = "centos/6"
client.vm.hostname = 'el6-client.example.com'
client.vm.network :private_network, ip: "192.168.56.12"
client.vm.provision :shell, :path => "tests/provision_basic_el.sh"
client.vm.provision :shell, :path => "tests/provision_client_el6.sh"
client.vm.provision :shell, :inline => "puppet apply /vagrant/tests/sensu-client-sensu_gem.pp"
end

config.vm.define "ubuntu1604-client", autostart: false do |client|
client.vm.box = "ubuntu/xenial64"
client.vm.hostname = 'ubuntu1604-client.example.com'
client.vm.network :private_network, ip: "192.168.56.13"
client.vm.provision :shell, :path => "tests/provision_basic_ubuntu.sh"
client.vm.provision :shell, :path => "tests/provision_client_ubuntu.sh"
client.vm.provision :shell, :path => "tests/provision_basic_debian.sh"
client.vm.provision :shell, :inline => "puppet apply /vagrant/tests/sensu-client.pp"
end

config.vm.define "ubuntu1404-client", autostart: false do |client|
client.vm.box = "ubuntu/trusty64"
client.vm.hostname = 'ubuntu1404-client.example.com'
client.vm.network :private_network, ip: "192.168.56.14"
client.vm.provision :shell, :path => "tests/provision_basic_ubuntu.sh"
client.vm.provision :shell, :path => "tests/provision_client_ubuntu1404.sh"
client.vm.provision :shell, :path => "tests/provision_basic_debian.sh"
client.vm.provision :shell, :inline => "puppet apply /vagrant/tests/sensu-client-sensu_gem.pp"
end

config.vm.define "win2012r2-client", autostart: false do |client|
Expand All @@ -83,8 +83,23 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
client.vm.provision :shell, :path => "tests/provision_basic_win.ps1"
## Symlink module into place, run puppet module install for puppet apply
client.vm.provision :shell, :path => "tests/provision_basic_win.2.ps1"
## Run puppet apply
client.vm.provision :shell, :path => "tests/provision_client_win.ps1"
client.vm.provision :shell, :inline => 'iex "puppet apply -v C:/vagrant/tests/sensu-client-windows.pp"'
end

config.vm.define "debian8-client", autostart: false do |client|
client.vm.box = "debian/jessie64"
client.vm.hostname = 'debian8-client.example.com'
client.vm.network :private_network, ip: "192.168.56.17"
client.vm.provision :shell, :path => "tests/provision_basic_debian.sh"
client.vm.provision :shell, :inline => "puppet apply /vagrant/tests/sensu-client.pp"
end

config.vm.define "debian7-client", autostart: false do |client|
client.vm.box = "debian/wheezy64"
client.vm.hostname = 'debian7-client.example.com'
client.vm.network :private_network, ip: "192.168.56.18"
client.vm.provision :shell, :path => "tests/provision_basic_debian.sh"
client.vm.provision :shell, :inline => "puppet apply /vagrant/tests/sensu-client.pp"
end

# This system is meant to be started without 'sensu-server' running.
Expand Down
7 changes: 7 additions & 0 deletions manifests/init.pp
Expand Up @@ -65,6 +65,12 @@
# String. URL of the apt GPG key
# Default: https://sensu.global.ssl.fastly.net/apt/pubkey.gpg
#
# [*repo_release*]
# String. Release for the apt source. Only set this if you want to run
# packages from another release, which is not supported by Sensu. Only works
# with systems that use apt.
# Default: $::lsbdistcodename
#
# [*client*]
# Boolean. Include the sensu client
# Default: true
Expand Down Expand Up @@ -405,6 +411,7 @@
$repo_source = undef,
$repo_key_id = 'EE15CFF6AB6E4E290FDAB681A20F259AEB9C94BB',
$repo_key_source = 'https://sensu.global.ssl.fastly.net/apt/pubkey.gpg',
$repo_release = undef,
$enterprise_repo_key_id = '910442FF8781AFD0995D14B311AB27E8C3FE3269',
$client = true,
$server = false,
Expand Down
10 changes: 9 additions & 1 deletion manifests/repo/apt.pp
Expand Up @@ -23,10 +23,18 @@
$url = 'https://sensu.global.ssl.fastly.net/apt'
}

# ignoring the puppet-lint plugin because of a bug that warns on the next
# line.
if $::sensu::repo_release == undef { #lint:ignore:undef_in_function
$release = $::lsbdistcodename
} else {
$release = $::sensu::repo_release
}

apt::source { 'sensu':
ensure => $ensure,
location => $url,
release => $::lsbdistcodename,
release => $release,
repos => $::sensu::repo,
include => {
'src' => false,
Expand Down
7 changes: 7 additions & 0 deletions metadata.json
Expand Up @@ -33,6 +33,13 @@
"7"
]
},
{
"operatingsystem": "Debian",
"operatingsystemrelease": [
"7",
"8"
]
},
{
"operatingsystem": "Ubuntu",
"operatingsystemrelease": [
Expand Down
34 changes: 31 additions & 3 deletions spec/classes/sensu_package_spec.rb
Expand Up @@ -161,8 +161,25 @@
end
end

context 'debian' do
let(:facts) { { :osfamily => 'Debian', :lsbdistid => 'Debian', :lsbdistrelease => '8.6', :lsbdistcodename => 'jessie', :os => {:name => 'debian', :release => {:full => '8.6'} }, } }
context 'Debian' do
context '7 (wheezy)' do
let(:facts) { { :osfamily => 'Debian', :lsbdistid => 'Debian', :lsbdistrelease => '7.11', :lsbdistcodename => 'wheezy', :os => {:name => 'Debian', :release => {:full => '7.11'} }, } }

context 'repo release' do
it { should contain_apt__source('sensu').with(
:ensure => 'present',
:location => 'https://sensu.global.ssl.fastly.net/apt',
:release => 'wheezy',
:repos => 'main',
:include => { 'src' => false },
:key => { 'id' => 'EE15CFF6AB6E4E290FDAB681A20F259AEB9C94BB', 'source' => 'https://sensu.global.ssl.fastly.net/apt/pubkey.gpg' },
:before => 'Package[sensu]'
) }
end
end

context '8 (jessie)' do
let(:facts) { { :osfamily => 'Debian', :lsbdistid => 'Debian', :lsbdistrelease => '8.6', :lsbdistcodename => 'jessie', :os => {:name => 'Debian', :release => {:full => '8.6'} }, } }

context 'repo release' do
it { should contain_apt__source('sensu').with(
Expand All @@ -175,10 +192,21 @@
:before => 'Package[sensu]'
) }
end
end

context 'with repo_release specified' do
let(:facts) { { :osfamily => 'Debian', :lsbdistid => 'Debian', :lsbdistrelease => '7.11', :lsbdistcodename => 'wheezy', :os => {:name => 'Debian', :release => {:full => '7.11'} }, } }
let(:params) { { :repo_release => 'myrelease' } }

context 'repo release' do
it { should contain_apt__source('sensu').with(
:release => 'myrelease',
) }
end
end
end

context 'redhat' do
context 'RedHat' do
let(:facts) { { :osfamily => 'RedHat' } }

context 'default' do
Expand Down
Expand Up @@ -10,14 +10,23 @@ function deb_install() {

export DEBIAN_FRONTEND=noninteractive

. /etc/lsb-release
if [ -f /etc/lsb-release ]; then
# ubuntu
. /etc/lsb-release
CODENAME=$DISTRIB_CODENAME
else
# debian
CODENAME=$(grep ^VERSION= /etc/os-release | awk -F \( '{print $2}' | awk -F \) '{print $1}')
apt-get -y install apt-transport-https
apt-get update
fi

apt-key adv --fetch-keys http://apt.puppetlabs.com/DEB-GPG-KEY-puppet

apt-get -y install wget

# install and configure puppet
deb_install http://apt.puppetlabs.com/puppetlabs-release-pc1-${DISTRIB_CODENAME}.deb
deb_install http://apt.puppetlabs.com/puppetlabs-release-pc1-${CODENAME}.deb
apt-get update
apt-get -y install puppet-agent
ln -s /opt/puppetlabs/puppet/bin/puppet /usr/bin/puppet
Expand Down
4 changes: 0 additions & 4 deletions tests/provision_client_el6.sh

This file was deleted.

4 changes: 0 additions & 4 deletions tests/provision_client_el7.sh

This file was deleted.

4 changes: 0 additions & 4 deletions tests/provision_client_ubuntu.sh

This file was deleted.

4 changes: 0 additions & 4 deletions tests/provision_client_ubuntu1404.sh

This file was deleted.

2 changes: 0 additions & 2 deletions tests/provision_client_win.ps1

This file was deleted.

0 comments on commit 1a63540

Please sign in to comment.