diff --git a/.sync.yml b/.sync.yml index 928d81f77..578b586c8 100644 --- a/.sync.yml +++ b/.sync.yml @@ -1,6 +1,9 @@ --- .travis.yml: secure: "qtLA1TPKaVgd9rvi0kkF2v0CP0QLls//lFHJ9IowTYNi5O+0dx7OxZCK3g4nkNWWbsujS464/YFJqVRWoXIeLIyFtfMKkaRAiuaukxOQqnzD+BsnpYYeo2zeZPCvMbB94+7G7JQ+jpuzlsHX6j+H6LQEj6+kXzd8NAj8rlygrL8XcFN3bA8XM/unCvqn2b2sduShExVl0mnNMIvZMHCbdrEzByXkz+FmyGYCay+feDIYbIbhzYLNnh6BcDkq24TxRmVOdEnUkPG6ZU0UJlNqBZB++zAIazR25NyX+b22/CFp6D6YJKkJvBNnywGUNNF21s4a6kPoEnUVBEO6yg5sDkKgp8nAvsmUnI8A1tfRFWKejxHZN3YqveY60xiNIUEHJU4MjEE6VVi9WpNW8CpJbfP/z3RtlU5n4ckSER7mb/ApxspUPJRzyMKjobDP12WU/bgXinzdNMu6PH9H56WkDpRNtIYnNhIAuirdfDr2Ok5z9/9yObUt/OQddM4wrOnMG7lyyUIzAO2OOJbIcOaZBedTKccpCu6k2mOkUHhMutf1D0bde5IGhrs7E54V2ZNxX5Dopv5eOrmVN2OxdcB9g8nmISxX6Tty/BNrTBvt7urthGjUJrjlnNE/K1595KmcWa6PGWUcYZyzdKeWqiA3+iWKSmnx1Ri0lsml5Z/a4QM=" + docker_sets: + - set: docker/ubuntu-16.04 + - set: docker/centos-7 Gemfile: optional: ':test': diff --git a/.travis.yml b/.travis.yml index 003f0acd7..7392419f8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,6 +15,18 @@ script: matrix: fast_finish: true include: + - rvm: 2.4.1 + bundler_args: --without development + dist: trusty + env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_set=docker/ubuntu-14.04 CHECK=beaker + services: docker + sudo: required + - rvm: 2.4.1 + bundler_args: --without development + dist: trusty + env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_set=docker/centos-7 CHECK=beaker + services: docker + sudo: required - rvm: 2.1.9 bundler_args: --without system_tests development env: PUPPET_VERSION="~> 4.0" CHECK=test diff --git a/Gemfile b/Gemfile index 9e331c59e..2579f05db 100644 --- a/Gemfile +++ b/Gemfile @@ -56,6 +56,7 @@ group :system_tests do end gem 'serverspec', :require => false gem 'beaker-puppet_install_helper', :require => false + gem 'beaker-module_install_helper', :require => false end @@ -63,7 +64,7 @@ end if facterversion = ENV['FACTER_GEM_VERSION'] gem 'facter', facterversion.to_s, :require => false, :groups => [:test] else -gem 'facter', :require => false, :groups => [:test] + gem 'facter', :require => false, :groups => [:test] end ENV['PUPPET_VERSION'].nil? ? puppetversion = '~> 5.0' : puppetversion = ENV['PUPPET_VERSION'].to_s diff --git a/README.md b/README.md index 9b8a5a77a..73e3bd6f8 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ 1. [Overview](#overview) 1. [Module Description](#module-description) 1. [Setup](#setup) + * [Requirements](#requirements) * [Beginning with Grafana](#beginning-with-grafana) 1. [Usage](#usage) * [Classes and Defined Types](#classes-and-defined-types) @@ -40,6 +41,15 @@ This module will: package source * Perform basic configuration of Grafana +### Requirements + +* If using an operating system of the Debian-based family, and the "repo" +`install_method`, you will need to ensure that +[puppetlabs-apt](https://forge.puppet.com/puppetlabs/apt) version 4.x is +installed. +* If using Docker, you will need the +[garethr/docker](https://forge.puppet.com/garethr/docker) module version 5.x + ### Beginning with Grafana To install Grafana with the default parameters: diff --git a/manifests/init.pp b/manifests/init.pp index d68a39283..467ffc5c5 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -92,9 +92,11 @@ fail('cfg parameter must be a hash') } - anchor { 'grafana::begin': } - -> class { '::grafana::install': } - -> class { '::grafana::config': } - ~> class { '::grafana::service': } - -> anchor { 'grafana::end': } + contain grafana::install + contain grafana::config + contain grafana::service + + Class['grafana::install'] + -> Class['grafana::config'] + ~> Class['grafana::service'] } diff --git a/manifests/install.pp b/manifests/install.pp index 872c76973..ef6cdeebd 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -1,11 +1,12 @@ # == Class grafana::install # class grafana::install { + $base_url = 'https://s3-us-west-2.amazonaws.com/grafana-releases/release' if $::grafana::archive_source != undef { $real_archive_source = $::grafana::archive_source } else { - $real_archive_source = "https://grafanarel.s3.amazonaws.com/builds/grafana-${::grafana::version}.linux-x64.tar.gz" + $real_archive_source = "${base_url}/grafana-${::grafana::version}.linux-x64.tar.gz" } if $::grafana::package_source != undef { @@ -13,8 +14,8 @@ } else { $real_package_source = $::osfamily ? { - /(RedHat|Amazon)/ => "https://grafanarel.s3.amazonaws.com/builds/grafana-${::grafana::version}-${::grafana::rpm_iteration}.x86_64.rpm", - 'Debian' => "https://grafanarel.s3.amazonaws.com/builds/grafana_${::grafana::version}_amd64.deb", + /(RedHat|Amazon)/ => "${base_url}/grafana-${::grafana::version}-${::grafana::rpm_iteration}.x86_64.rpm", + 'Debian' => "${base_url}/builds/grafana_${::grafana::version}_amd64.deb", default => $real_archive_source, } } diff --git a/manifests/params.pp b/manifests/params.pp index fb8aa07a0..4407a1c5e 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -17,7 +17,7 @@ $package_source = undef $rpm_iteration = '1' $repo_name = 'stable' - $version = '2.5.0' + $version = '4.5.1' case $::osfamily { 'Archlinux': { $manage_package_repo = false diff --git a/metadata.json b/metadata.json index 934975e75..ca080ef7c 100644 --- a/metadata.json +++ b/metadata.json @@ -8,10 +8,6 @@ "project_page": "https://github.com/voxpupuli/puppet-grafana", "issue_url": "https://github.com/voxpupuli/puppet-grafana/issues", "dependencies": [ - { - "name": "garethr/docker", - "version_requirement": ">= 5.0.0 < 6.0.0" - }, { "name": "maestrodev/wget", "version_requirement": ">= 1.7.3 < 2.0.0" @@ -20,10 +16,6 @@ "name": "puppet/archive", "version_requirement": ">= 1.0.1 < 2.0.0" }, - { - "name": "puppetlabs/apt", - "version_requirement": ">=2.1.0 < 5.0.0" - }, { "name": "puppetlabs/stdlib", "version_requirement": ">=4.6.0 < 5.0.0" @@ -39,19 +31,22 @@ { "operatingsystem": "Ubuntu", "operatingsystemrelease": [ - "14.04" + "14.04", + "16.04" ] }, { "operatingsystem": "RedHat", "operatingsystemrelease": [ + "6", "6" ] }, { "operatingsystem": "CentOS", "operatingsystemrelease": [ - "6" + "6", + "7" ] }, { @@ -61,7 +56,7 @@ "requirements": [ { "name": "puppet", - "version_requirement": ">= 4.6.1 < 5.0.0" + "version_requirement": ">= 4.7.1 < 6.0.0" } ], "tags": [ diff --git a/spec/acceptance/class_spec.rb b/spec/acceptance/class_spec.rb index 759ad09f3..4e65250a9 100644 --- a/spec/acceptance/class_spec.rb +++ b/spec/acceptance/class_spec.rb @@ -17,7 +17,7 @@ class { 'grafana': } it { is_expected.to be_installed } end - describe service('grafana') do + describe service('grafana-server') do it { is_expected.to be_enabled } it { is_expected.to be_running } end diff --git a/spec/classes/grafana_spec.rb b/spec/classes/grafana_spec.rb index 4f1e152ab..c66c95879 100644 --- a/spec/classes/grafana_spec.rb +++ b/spec/classes/grafana_spec.rb @@ -28,12 +28,10 @@ context 'with default values' do it { is_expected.to compile.with_all_deps } it { is_expected.to contain_class('grafana') } - it { is_expected.to contain_anchor('grafana::begin') } it { is_expected.to contain_class('grafana::params') } - it { is_expected.to contain_class('grafana::install') } - it { is_expected.to contain_class('grafana::config') } + it { is_expected.to contain_class('grafana::install').that_comes_before('Class[grafana::config]') } + it { is_expected.to contain_class('grafana::config').that_notifies('Class[grafana::service]') } it { is_expected.to contain_class('grafana::service') } - it { is_expected.to contain_anchor('grafana::end') } end context 'with parameter install_method is set to package' do @@ -91,7 +89,7 @@ end describe 'install the package' do - it { is_expected.to contain_package('grafana').with_ensure('2.5.0') } + it { is_expected.to contain_package('grafana').with_ensure('4.5.1') } end when 'RedHat' describe 'yum repo dependencies first' do @@ -104,7 +102,7 @@ end describe 'install the package' do - it { is_expected.to contain_package('grafana').with_ensure('2.5.0-1') } + it { is_expected.to contain_package('grafana').with_ensure('4.5.1-1') } end end end @@ -151,7 +149,7 @@ install_dir = '/usr/share/grafana' service_config = '/usr/share/grafana/conf/custom.ini' - archive_source = 'https://grafanarel.s3.amazonaws.com/builds/grafana-2.5.0.linux-x64.tar.gz' + archive_source = 'https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-4.5.1.linux-x64.tar.gz' describe 'extract archive to install_dir' do it { is_expected.to contain_archive('/tmp/grafana.tar.gz').with_ensure('present') } diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index 3882833de..f60ee4a59 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -1,24 +1,15 @@ -require 'beaker-rspec/spec_helper' -require 'beaker-rspec/helpers/serverspec' +require 'beaker-rspec' +require 'beaker/puppet_install_helper' +require 'beaker/module_install_helper' -hosts.each do |_host| # rubocop: disable RSpec/IteratedExpectation - # Install Puppet - install_puppet -end +run_puppet_install_helper +install_module +install_module_dependencies -RSpec.configure do |c| - # Project root - proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..')) +# Install additional modules for soft deps +install_module_from_forge('puppetlabs-apt', '>= 4.1.0 < 5.0.0') +RSpec.configure do |c| # Readable test descriptions c.formatter = :documentation - - # Configure all nodes in nodeset - c.before :suite do - # Install module and dependencies - puppet_module_install(source: proj_root, module_name: 'grafana') - hosts.each do |host| - on host, puppet('module', 'install', 'puppetlabs-stdlib'), acceptable_exit_codes: [0, 1] - end - end end