From 4354b79622fc36e40014102af5065a99ab7dab23 Mon Sep 17 00:00:00 2001 From: fnoop Date: Thu, 21 Sep 2017 08:39:59 +0100 Subject: [PATCH] Update puppet-grafana to 4.1.0rc0, #576 --- .../base/manifests/packages.pp | 2 +- .../puppet-modules/grafana/.fixtures.yml | 1 - manifests/puppet-modules/grafana/.msync.yml | 2 +- manifests/puppet-modules/grafana/.rubocop.yml | 77 ++++++++--------- manifests/puppet-modules/grafana/.sync.yml | 3 + manifests/puppet-modules/grafana/.travis.yml | 24 ++++-- manifests/puppet-modules/grafana/CHANGELOG.md | 85 +++++++++++++++---- manifests/puppet-modules/grafana/Gemfile | 12 +-- manifests/puppet-modules/grafana/README.md | 58 +++++++++++-- manifests/puppet-modules/grafana/Rakefile | 7 +- .../grafana/lib/puppet/provider/grafana.rb | 14 +-- .../provider/grafana_dashboard/grafana.rb | 11 --- .../provider/grafana_datasource/grafana.rb | 12 --- .../lib/puppet/type/grafana_dashboard.rb | 11 --- .../lib/puppet/type/grafana_datasource.rb | 12 --- .../puppet-modules/grafana/manifests/init.pp | 57 +++++++------ .../grafana/manifests/install.pp | 16 ++-- .../grafana/manifests/params.pp | 5 +- .../grafana/manifests/plugin.pp | 10 --- .../puppet-modules/grafana/metadata.json | 23 ++--- .../grafana/spec/acceptance/class_spec.rb | 2 +- .../nodesets/docker/ubuntu-14.04.yml | 2 +- .../nodesets/docker/ubuntu-16.04.yml | 2 +- .../grafana/spec/classes/grafana_spec.rb | 47 +++++----- .../grafana/spec/defines/plugin_spec.rb | 20 ----- .../grafana/spec/spec_helper_acceptance.rb | 27 ++---- 26 files changed, 276 insertions(+), 266 deletions(-) delete mode 100644 manifests/puppet-modules/grafana/manifests/plugin.pp delete mode 100644 manifests/puppet-modules/grafana/spec/defines/plugin_spec.rb diff --git a/manifests/maverick-modules/base/manifests/packages.pp b/manifests/maverick-modules/base/manifests/packages.pp index 4bcdf771..682537d2 100644 --- a/manifests/maverick-modules/base/manifests/packages.pp +++ b/manifests/maverick-modules/base/manifests/packages.pp @@ -31,7 +31,7 @@ ensure_packages(["linux-firmware"]) } elsif $operatingsystem == "Debian" { ensure_packages(["firmware-linux", "firmware-atheros", "firmware-brcm80211", "firmware-realtek"]) - if $::operatingsystemmajrelease == 9 { + if $::operatingsystemmajrelease == "9" { ensure_packages(["firmware-misc-nonfree", "firmware-linux-nonfree"]) } else { ensure_packages(["firmware-ralink"]) diff --git a/manifests/puppet-modules/grafana/.fixtures.yml b/manifests/puppet-modules/grafana/.fixtures.yml index d478d5be..88216cdb 100644 --- a/manifests/puppet-modules/grafana/.fixtures.yml +++ b/manifests/puppet-modules/grafana/.fixtures.yml @@ -3,7 +3,6 @@ fixtures: stdlib: "https://github.com/puppetlabs/puppetlabs-stdlib.git" archive: "https://github.com/voxpupuli/puppet-archive.git" docker: "https://github.com/garethr/garethr-docker.git" - wget: "https://github.com/maestrodev/puppet-wget.git" apt: "https://github.com/puppetlabs/puppetlabs-apt.git" symlinks: grafana: "#{source_dir}" diff --git a/manifests/puppet-modules/grafana/.msync.yml b/manifests/puppet-modules/grafana/.msync.yml index 4abde220..0a4a57db 100644 --- a/manifests/puppet-modules/grafana/.msync.yml +++ b/manifests/puppet-modules/grafana/.msync.yml @@ -1 +1 @@ -modulesync_config_version: '0.21.3' +modulesync_config_version: '1.1.0' diff --git a/manifests/puppet-modules/grafana/.rubocop.yml b/manifests/puppet-modules/grafana/.rubocop.yml index d92e4e45..b1a95213 100644 --- a/manifests/puppet-modules/grafana/.rubocop.yml +++ b/manifests/puppet-modules/grafana/.rubocop.yml @@ -51,7 +51,7 @@ Lint/AmbiguousOperator: Lint/AssignmentInCondition: Enabled: True -Style/SpaceBeforeComment: +Layout/SpaceBeforeComment: Enabled: True Style/AndOr: @@ -119,7 +119,7 @@ Lint/UselessAssignment: Lint/Void: Enabled: True -Style/AccessModifierIndentation: +Layout/AccessModifierIndentation: Enabled: True Style/AccessorMethodName: @@ -128,13 +128,13 @@ Style/AccessorMethodName: Style/Alias: Enabled: True -Style/AlignArray: +Layout/AlignArray: Enabled: True -Style/AlignHash: +Layout/AlignHash: Enabled: True -Style/AlignParameters: +Layout/AlignParameters: Enabled: True Metrics/BlockNesting: @@ -152,7 +152,7 @@ Style/BracesAroundHashParameters: Style/CaseEquality: Enabled: True -Style/CaseIndentation: +Layout/CaseIndentation: Enabled: True Style/CharacterLiteral: @@ -186,64 +186,64 @@ Style/WordArray: Style/UnneededPercentQ: Enabled: True -Style/Tab: +Layout/Tab: Enabled: True -Style/SpaceBeforeSemicolon: +Layout/SpaceBeforeSemicolon: Enabled: True -Style/TrailingBlankLines: +Layout/TrailingBlankLines: Enabled: True -Style/SpaceInsideBlockBraces: +Layout/SpaceInsideBlockBraces: Enabled: True -Style/SpaceInsideBrackets: +Layout/SpaceInsideBrackets: Enabled: True -Style/SpaceInsideHashLiteralBraces: +Layout/SpaceInsideHashLiteralBraces: Enabled: True -Style/SpaceInsideParens: +Layout/SpaceInsideParens: Enabled: True -Style/LeadingCommentSpace: +Layout/LeadingCommentSpace: Enabled: True -Style/SpaceBeforeFirstArg: +Layout/SpaceBeforeFirstArg: Enabled: True -Style/SpaceAfterColon: +Layout/SpaceAfterColon: Enabled: True -Style/SpaceAfterComma: +Layout/SpaceAfterComma: Enabled: True -Style/SpaceAfterMethodName: +Layout/SpaceAfterMethodName: Enabled: True -Style/SpaceAfterNot: +Layout/SpaceAfterNot: Enabled: True -Style/SpaceAfterSemicolon: +Layout/SpaceAfterSemicolon: Enabled: True -Style/SpaceAroundEqualsInParameterDefault: +Layout/SpaceAroundEqualsInParameterDefault: Enabled: True -Style/SpaceAroundOperators: +Layout/SpaceAroundOperators: Enabled: True -Style/SpaceBeforeBlockBraces: +Layout/SpaceBeforeBlockBraces: Enabled: True -Style/SpaceBeforeComma: +Layout/SpaceBeforeComma: Enabled: True Style/CollectionMethods: Enabled: True -Style/CommentIndentation: +Layout/CommentIndentation: Enabled: True Style/ColonMethodCall: @@ -268,7 +268,7 @@ Style/DefWithParentheses: Style/PreferredHashMethods: Enabled: True -Style/DotPosition: +Layout/DotPosition: EnforcedStyle: trailing Style/DoubleNegation: @@ -277,25 +277,25 @@ Style/DoubleNegation: Style/EachWithObject: Enabled: True -Style/EmptyLineBetweenDefs: +Layout/EmptyLineBetweenDefs: Enabled: True -Style/IndentArray: +Layout/IndentArray: Enabled: True -Style/IndentHash: +Layout/IndentHash: Enabled: True -Style/IndentationConsistency: +Layout/IndentationConsistency: Enabled: True -Style/IndentationWidth: +Layout/IndentationWidth: Enabled: True -Style/EmptyLines: +Layout/EmptyLines: Enabled: True -Style/EmptyLinesAroundAccessModifier: +Layout/EmptyLinesAroundAccessModifier: Enabled: True Style/EmptyLiteral: @@ -314,7 +314,7 @@ Style/MethodDefParentheses: Style/LineEndConcatenation: Enabled: True -Style/TrailingWhitespace: +Layout/TrailingWhitespace: Enabled: True Style/StringLiterals: @@ -466,9 +466,6 @@ Metrics/ParameterLists: Lint/RequireParentheses: Enabled: True -Style/SpaceBeforeFirstArg: - Enabled: True - Style/ModuleFunction: Enabled: True @@ -484,7 +481,7 @@ Style/Encoding: Style/BlockDelimiters: Enabled: True -Style/MultilineBlockLayout: +Layout/MultilineBlockLayout: Enabled: True # 'Complexity' is very relative @@ -498,7 +495,7 @@ Metrics/PerceivedComplexity: Lint/UselessAssignment: Enabled: True -Style/ClosingParenthesisIndentation: +Layout/ClosingParenthesisIndentation: Enabled: True # RSpec @@ -527,7 +524,7 @@ RSpec/NestedGroups: Enabled: False # this is broken on ruby1.9 -Style/IndentHeredoc: +Layout/IndentHeredoc: Enabled: False # disable Yaml safe_load. This is needed to support ruby2.0.0 development envs diff --git a/manifests/puppet-modules/grafana/.sync.yml b/manifests/puppet-modules/grafana/.sync.yml index 928d81f7..578b586c 100644 --- a/manifests/puppet-modules/grafana/.sync.yml +++ b/manifests/puppet-modules/grafana/.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/manifests/puppet-modules/grafana/.travis.yml b/manifests/puppet-modules/grafana/.travis.yml index 3784ed44..7392419f 100644 --- a/manifests/puppet-modules/grafana/.travis.yml +++ b/manifests/puppet-modules/grafana/.travis.yml @@ -15,24 +15,30 @@ 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 - - rvm: 2.2.7 - bundler_args: --without system_tests development - env: PUPPET_VERSION="~> 4.0" CHECK=test - - rvm: 2.3.4 - bundler_args: --without system_tests development - env: PUPPET_VERSION="~> 4.0" CHECK=test - rvm: 2.4.1 bundler_args: --without system_tests development - env: PUPPET_VERSION="~> 4.0" CHECK=test + env: PUPPET_VERSION="~> 5.0" CHECK=test - rvm: 2.4.1 bundler_args: --without system_tests development - env: PUPPET_VERSION="~> 4.0" CHECK=rubocop + env: PUPPET_VERSION="~> 5.0" CHECK=rubocop - rvm: 2.4.1 bundler_args: --without system_tests development - env: PUPPET_VERSION="~> 4.0" CHECK=build DEPLOY_TO_FORGE=yes + env: PUPPET_VERSION="~> 5.0" CHECK=build DEPLOY_TO_FORGE=yes branches: only: - master diff --git a/manifests/puppet-modules/grafana/CHANGELOG.md b/manifests/puppet-modules/grafana/CHANGELOG.md index 70cd7f6b..c915e327 100644 --- a/manifests/puppet-modules/grafana/CHANGELOG.md +++ b/manifests/puppet-modules/grafana/CHANGELOG.md @@ -1,33 +1,83 @@ -# Releasing v3.0.0 (2017-03-29) +# Changelog + +All notable changes to this project will be documented in this file. +Each new release typically also includes the latest modulesync defaults. +These should not affect the functionality of the module. + +## [v4.0.0](https://github.com/voxpupuli/puppet-grafana/tree/v4.0.0) (2017-09-20) +[Full Changelog](https://github.com/voxpupuli/puppet-grafana/compare/v3.0.0...v4.0.0) + +**Implemented enhancements:** + +- BREAKING: Switch to Puppet Data Types \(ldap\_cfg is now undef when disabled\) [\#66](https://github.com/voxpupuli/puppet-grafana/pull/66) ([wyardley](https://github.com/wyardley)) +- BREAKING: Create grafana\_plugin resource type and change grafana::plugins [\#63](https://github.com/voxpupuli/puppet-grafana/pull/63) ([wyardley](https://github.com/wyardley)) +- BREAKING: Update default Grafana version to 4.5.1 and improve acceptance tests [\#61](https://github.com/voxpupuli/puppet-grafana/pull/61) ([wyardley](https://github.com/wyardley)) +- grafana\_user custom resource [\#60](https://github.com/voxpupuli/puppet-grafana/pull/60) ([atward](https://github.com/atward)) +- Support newer versions of puppetlabs/apt module [\#53](https://github.com/voxpupuli/puppet-grafana/pull/53) ([ghoneycutt](https://github.com/ghoneycutt)) +- Support custom plugins [\#44](https://github.com/voxpupuli/puppet-grafana/pull/44) ([bastelfreak](https://github.com/bastelfreak)) + +**Fixed bugs:** + +- gpg key error on CentOS 7 with default params [\#59](https://github.com/voxpupuli/puppet-grafana/issues/59) +- wget called even if not necessary [\#54](https://github.com/voxpupuli/puppet-grafana/issues/54) +- Fix typo in provider [\#58](https://github.com/voxpupuli/puppet-grafana/pull/58) ([atward](https://github.com/atward)) + +**Closed issues:** + +- install\_method 'docker" ignores all other configurations [\#51](https://github.com/voxpupuli/puppet-grafana/issues/51) +- Usable for Grafana 4.x? [\#37](https://github.com/voxpupuli/puppet-grafana/issues/37) +- Remove docker dependency [\#22](https://github.com/voxpupuli/puppet-grafana/issues/22) + +**Merged pull requests:** + +- Update README.md [\#67](https://github.com/voxpupuli/puppet-grafana/pull/67) ([wyardley](https://github.com/wyardley)) +- Get rid of the dependency on 'wget' module in favor of puppet-archive [\#65](https://github.com/voxpupuli/puppet-grafana/pull/65) ([wyardley](https://github.com/wyardley)) +- Remove licenses from the top of files [\#64](https://github.com/voxpupuli/puppet-grafana/pull/64) ([wyardley](https://github.com/wyardley)) +- Always use jessie apt repo when osfamily is Debian. [\#41](https://github.com/voxpupuli/puppet-grafana/pull/41) ([furhouse](https://github.com/furhouse)) + +## [v3.0.0](https://github.com/voxpupuli/puppet-grafana/tree/v3.0.0) (2017-03-29) +[Full Changelog](https://github.com/voxpupuli/puppet-grafana/compare/v2.6.3...v3.0.0) **Implemented enhancements:** -- Implement package\_ensure param for Arch Linux [\#34](https://github.com/voxpupuli/puppet-grafana/pull/34) ([bastelfreak](https://github.com/bastelfreak)) +- implement package\_ensure param for archlinux [\#34](https://github.com/voxpupuli/puppet-grafana/pull/34) ([bastelfreak](https://github.com/bastelfreak)) **Fixed bugs:** +- implement package\\_ensure param for archlinux [\#34](https://github.com/voxpupuli/puppet-grafana/pull/34) ([bastelfreak](https://github.com/bastelfreak)) - FIX configuration file ownership [\#30](https://github.com/voxpupuli/puppet-grafana/pull/30) ([cassianoleal](https://github.com/cassianoleal)) **Closed issues:** -- Configured Grafana Debian repo should contain current distribution [\#27](https://github.com/voxpupuli/puppet-grafana/issues/27) +- Configured grafana debian repo should contain current distribution [\#27](https://github.com/voxpupuli/puppet-grafana/issues/27) - Error while creating dashboard [\#25](https://github.com/voxpupuli/puppet-grafana/issues/25) **Merged pull requests:** +- Bump version, Update changelog [\#38](https://github.com/voxpupuli/puppet-grafana/pull/38) ([dhoppe](https://github.com/dhoppe)) - Debian and RedHat based operating systems should use the repository by default [\#36](https://github.com/voxpupuli/puppet-grafana/pull/36) ([dhoppe](https://github.com/dhoppe)) -- Add support for Arch Linux [\#32](https://github.com/voxpupuli/puppet-grafana/pull/32) ([bastelfreak](https://github.com/bastelfreak)) +- Add support for archlinux [\#32](https://github.com/voxpupuli/puppet-grafana/pull/32) ([bastelfreak](https://github.com/bastelfreak)) - Fix grafana\_dashboards [\#31](https://github.com/voxpupuli/puppet-grafana/pull/31) ([cassianoleal](https://github.com/cassianoleal)) -- Supoort jessie for install method repo [\#28](https://github.com/voxpupuli/puppet-grafana/pull/28) ([roock](https://github.com/roock)) +- supoort jessie for install method repo [\#28](https://github.com/voxpupuli/puppet-grafana/pull/28) ([roock](https://github.com/roock)) - Use operatinsystemmajrelease fact in repo url [\#24](https://github.com/voxpupuli/puppet-grafana/pull/24) ([mirekys](https://github.com/mirekys)) - The puppet 4-only release will start at 3.0.0 [\#21](https://github.com/voxpupuli/puppet-grafana/pull/21) ([rnelson0](https://github.com/rnelson0)) -# Releasing v2.6.1 (2017-01-18) +## [v2.6.3](https://github.com/voxpupuli/puppet-grafana/tree/v2.6.3) (2017-01-18) +[Full Changelog](https://github.com/voxpupuli/puppet-grafana/compare/v2.6.2...v2.6.3) + +## [v2.6.2](https://github.com/voxpupuli/puppet-grafana/tree/v2.6.2) (2017-01-18) +[Full Changelog](https://github.com/voxpupuli/puppet-grafana/compare/v2.6.1...v2.6.2) + +**Merged pull requests:** + +- release 2.6.2 \(optimistic, i know ;\) [\#20](https://github.com/voxpupuli/puppet-grafana/pull/20) ([igalic](https://github.com/igalic)) + +## v2.6.1 (2017-01-18) Just a notice: The next release will be a major one without Puppet 3 support! This is the last Release that supports it! -# Releasing v2.6.0 (2017-01-18) +## Releasing v2.6.0 (2017-01-18) **Enhancements** @@ -53,7 +103,7 @@ This is the last Release that supports it! * Rubocop and ruby-lint style-fixes! * test with puppet > 4.x -# 2.5.0 (2015-10-31) +## 2.5.0 (2015-10-31) **Enhancements** - Support for [Grafana 2.5](http://grafana.org/blog/2015/10/28/Grafana-2-5-Released.html). This is just a version bump to reflect that Grafana 2.5 is now installed by default @@ -67,7 +117,7 @@ This is the last Release that supports it! - [PR #59](https://github.com/bfraser/puppet-grafana/pull/59) More specific version requirements in ```metadata.json``` due to use of ```contain``` function - [PR #61](https://github.com/bfraser/puppet-grafana/pull/61) Fixed typos in ```metadata.json``` -# 2.1.0 (2015-08-07) +## 2.1.0 (2015-08-07) **Enhancements** - Support for [Grafana 2.1](http://grafana.org/blog/2015/08/04/Grafana-2-1-Released.html) @@ -84,7 +134,7 @@ This is the last Release that supports it! **Behind The Scenes** - Use 40 character GPG key ID for packagecloud apt repository -# 2.0.2 (2015-04-30) +## 2.0.2 (2015-04-30) **Enhancements** - Support for Grafana 2.0. Users of Grafana 1.x should stick to version 1.x of the Puppet module @@ -96,7 +146,7 @@ This is the last Release that supports it! - Update module operatingsystem support, tags, Puppet requirements - Tests for 'archive' and 'package' install methods -# 1.0.1 (2015-02-27) +## 1.0.1 (2015-02-27) **Enhancements** - New parameter for Grafana admin password @@ -111,7 +161,7 @@ This is the last Release that supports it! - Allow Travis to fail on Ruby 1.8.7 - More Puppet versions are tested by Travis -# 1.0.0 (2014-12-16) +## 1.0.0 (2014-12-16) **Enhancements** - Add max_search_results parameter @@ -127,7 +177,7 @@ This is the last Release that supports it! - Removal of vagrant-wrapper gem - Fancy badges for build status -# 0.2.2 (2014-10-27) +## 0.2.2 (2014-10-27) **Enhancements** - Add default_route parameter to manage start dashboard @@ -138,7 +188,7 @@ This is the last Release that supports it! **Behind The Scenes** - [Issue #9](https://github.com/bfraser/puppet-grafana/issues/9) Remove stdlib inclusion from manifest -# 0.2.1 (2014-10-14) +## 0.2.1 (2014-10-14) **Enhancements** - Support for multiple datasources @@ -149,11 +199,14 @@ This is the last Release that supports it! - Add stdlib as a module dependency - Add operating system compatibility -# 0.1.3 (2014-07-03) +## 0.1.3 (2014-07-03) **Enhancements** - Added support for InfluxDB -# 0.1.2 (2014-06-30) +## 0.1.2 (2014-06-30) First release on the Puppet Forge + + +\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)* \ No newline at end of file diff --git a/manifests/puppet-modules/grafana/Gemfile b/manifests/puppet-modules/grafana/Gemfile index 425e4941..2579f05d 100644 --- a/manifests/puppet-modules/grafana/Gemfile +++ b/manifests/puppet-modules/grafana/Gemfile @@ -11,11 +11,10 @@ def location_for(place, fake_version = nil) end group :test do - gem 'puppetlabs_spec_helper', '~> 2.1.1', :require => false + gem 'puppetlabs_spec_helper', '~> 2.2.0', :require => false gem 'rspec-puppet', '~> 2.5', :require => false gem 'rspec-puppet-facts', :require => false gem 'rspec-puppet-utils', :require => false - gem 'puppet-lint-absolute_classname-check', :require => false gem 'puppet-lint-leading_zero-check', :require => false gem 'puppet-lint-trailing_comma-check', :require => false gem 'puppet-lint-version_comparison-check', :require => false @@ -24,10 +23,10 @@ group :test do gem 'puppet-lint-variable_contains_upcase', :require => false gem 'metadata-json-lint', :require => false gem 'puppet-blacksmith', :require => false - gem 'voxpupuli-release', :require => false, :git => 'https://github.com/voxpupuli/voxpupuli-release-gem.git' + gem 'voxpupuli-release', :require => false, :git => 'https://github.com/voxpupuli/voxpupuli-release-gem' gem 'puppet-strings', '~> 1.0', :require => false gem 'redcarpet', :require => false - gem 'rubocop', '~> 0.48.0', :require => false if RUBY_VERSION >= '2.3.0' + gem 'rubocop', '~> 0.49.1', :require => false if RUBY_VERSION >= '2.3.0' gem 'rubocop-rspec', '~> 1.15.0', :require => false if RUBY_VERSION >= '2.3.0' gem 'mocha', '>= 1.2.1', :require => false gem 'coveralls', :require => false @@ -43,7 +42,7 @@ group :development do gem 'travis', :require => false gem 'travis-lint', :require => false gem 'guard-rake', :require => false - gem 'overcommit', '~> 0.39.1', :require => false + gem 'overcommit', '>= 0.39.1', :require => false end group :system_tests do @@ -57,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 @@ -67,7 +67,7 @@ else gem 'facter', :require => false, :groups => [:test] end -ENV['PUPPET_VERSION'].nil? ? puppetversion = '~> 4.0' : puppetversion = ENV['PUPPET_VERSION'].to_s +ENV['PUPPET_VERSION'].nil? ? puppetversion = '~> 5.0' : puppetversion = ENV['PUPPET_VERSION'].to_s gem 'puppet', puppetversion, :require => false, :groups => [:test] # vim: syntax=ruby diff --git a/manifests/puppet-modules/grafana/README.md b/manifests/puppet-modules/grafana/README.md index 9b8a5a77..14e9532a 100644 --- a/manifests/puppet-modules/grafana/README.md +++ b/manifests/puppet-modules/grafana/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: @@ -262,6 +272,11 @@ Grafana repositories are enabled on your host. If true, the official Grafana repositories will be enabled. If false, the module assumes you are managing your own package repository and will not set one up for you. Defaults to true. +##### `plugins` + +Hash. This is a passthrough to call `create_resources()` on the +`grafana_plugin` resource type. + ##### `package_name` The name of the package managed with the 'package' install method. Defaults to @@ -323,7 +338,7 @@ Example: #### Custom Types and Providers -The module includes two custom types: `grafana_dashboard` and `grafana_datasource` +The module includes several custom types: ##### `grafana_dashboard` @@ -370,21 +385,52 @@ from the browser, or `proxy` to send requests via grafana. Authentication is optional, as is `database`; additional `json_data` can be provided to allow custom configuration options. -##### `grafana::plugin` +##### `grafana_plugin` -There exists a custom defined resource which wraps grafana-cli to install -plugins. Deinstallation isn't supported right now, also docker support -completely missing. Example usage: +An example is provided for convenience; for more details, please view the +puppet strings docs. ```puppet -grafana::plugin{'grafana-simple-json-datasource':} +grafana_plugin { 'grafana-simple-json-datasource': + ensure => present, +} ``` + +##### `grafana::user` + +Creates and manages a global grafana user via the API. + +```puppet +grafana_user { 'username': + grafana_url => 'http://localhost:3000', + grafana_user => 'admin', + grafana_password => '5ecretPassw0rd', + full_name => 'John Doe', + password => 'Us3r5ecret', + email => 'john@example.com', +} +``` + ## Limitations This module has been tested on Ubuntu 14.04, using each of the 'archive', 'docker' and 'package' installation methods. Other configurations should work with minimal, if any, additional effort. +## Development + +This module is a fork of +[bfraser/grafana](https://github.com/bfraser/puppet-grafana) maintained by [Vox +Pupuli](https://voxpupuli.org/). Vox Pupuli welcomes new contributions to this +module, especially those that include documentation and rspec tests. We are +happy to provide guidance if necessary. + +Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for more details. + +### Authors +* Bill Fraser +* Vox Pupuli Team + ## Copyright and License Copyright (C) 2015 Bill Fraser diff --git a/manifests/puppet-modules/grafana/Rakefile b/manifests/puppet-modules/grafana/Rakefile index 82c89608..ab9411ba 100644 --- a/manifests/puppet-modules/grafana/Rakefile +++ b/manifests/puppet-modules/grafana/Rakefile @@ -35,9 +35,10 @@ begin require 'github_changelog_generator/task' GitHubChangelogGenerator::RakeTask.new :changelog do |config| version = (Blacksmith::Modulefile.new).version - config.future_release = "v#{version}" - config.header = "# Change log\n\nAll notable changes to this project will be documented in this file.\nEach new release typically also includes the latest modulesync defaults.\nThese should not impact the functionality of the module." - config.exclude_labels = %w{duplicate question invalid wontfix modulesync} + config.future_release = "v#{version}" if version =~ /^\d+\.\d+.\d+$/ + config.header = "# Changelog\n\nAll notable changes to this project will be documented in this file.\nEach new release typically also includes the latest modulesync defaults.\nThese should not affect the functionality of the module." + config.exclude_labels = %w{duplicate question invalid wontfix wont-fix modulesync skip-changelog} + config.user = 'voxpupuli' end rescue LoadError end diff --git a/manifests/puppet-modules/grafana/lib/puppet/provider/grafana.rb b/manifests/puppet-modules/grafana/lib/puppet/provider/grafana.rb index 2229f852..6f198b5a 100644 --- a/manifests/puppet-modules/grafana/lib/puppet/provider/grafana.rb +++ b/manifests/puppet-modules/grafana/lib/puppet/provider/grafana.rb @@ -1,17 +1,5 @@ # Copyright 2015 Mirantis, Inc. # -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# require 'cgi' require 'json' require 'net/http' @@ -68,7 +56,7 @@ def send_request(operation = 'GET', path = '', data = nil, search_path = {}) end request.content_type = 'application/json' - if resource[:grafana_user] && resource[:grafana_user] + if resource[:grafana_user] && resource[:grafana_password] request.basic_auth resource[:grafana_user], resource[:grafana_password] end diff --git a/manifests/puppet-modules/grafana/lib/puppet/provider/grafana_dashboard/grafana.rb b/manifests/puppet-modules/grafana/lib/puppet/provider/grafana_dashboard/grafana.rb index fb215d98..3ac3a7d4 100644 --- a/manifests/puppet-modules/grafana/lib/puppet/provider/grafana_dashboard/grafana.rb +++ b/manifests/puppet-modules/grafana/lib/puppet/provider/grafana_dashboard/grafana.rb @@ -1,16 +1,5 @@ # Copyright 2015 Mirantis, Inc. # -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. require 'json' require File.expand_path(File.join(File.dirname(__FILE__), '..', 'grafana')) diff --git a/manifests/puppet-modules/grafana/lib/puppet/provider/grafana_datasource/grafana.rb b/manifests/puppet-modules/grafana/lib/puppet/provider/grafana_datasource/grafana.rb index 79d7d5de..6ac97ecd 100644 --- a/manifests/puppet-modules/grafana/lib/puppet/provider/grafana_datasource/grafana.rb +++ b/manifests/puppet-modules/grafana/lib/puppet/provider/grafana_datasource/grafana.rb @@ -1,17 +1,5 @@ # Copyright 2015 Mirantis, Inc. # -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# require 'json' require File.expand_path(File.join(File.dirname(__FILE__), '..', 'grafana')) diff --git a/manifests/puppet-modules/grafana/lib/puppet/type/grafana_dashboard.rb b/manifests/puppet-modules/grafana/lib/puppet/type/grafana_dashboard.rb index 96cdd9b9..d76d731f 100644 --- a/manifests/puppet-modules/grafana/lib/puppet/type/grafana_dashboard.rb +++ b/manifests/puppet-modules/grafana/lib/puppet/type/grafana_dashboard.rb @@ -1,16 +1,5 @@ # Copyright 2015 Mirantis, Inc. # -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. require 'json' Puppet::Type.newtype(:grafana_dashboard) do diff --git a/manifests/puppet-modules/grafana/lib/puppet/type/grafana_datasource.rb b/manifests/puppet-modules/grafana/lib/puppet/type/grafana_datasource.rb index 6cb41324..7f08cb1b 100644 --- a/manifests/puppet-modules/grafana/lib/puppet/type/grafana_datasource.rb +++ b/manifests/puppet-modules/grafana/lib/puppet/type/grafana_datasource.rb @@ -1,17 +1,5 @@ # Copyright 2015 Mirantis, Inc. # -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# Puppet::Type.newtype(:grafana_datasource) do @doc = 'Manage datasources in Grafana' diff --git a/manifests/puppet-modules/grafana/manifests/init.pp b/manifests/puppet-modules/grafana/manifests/init.pp index d68a3928..9897d981 100644 --- a/manifests/puppet-modules/grafana/manifests/init.pp +++ b/manifests/puppet-modules/grafana/manifests/init.pp @@ -62,6 +62,10 @@ # Set to 'testing' to install beta versions # Defaults to stable. # +# [*plugins*] +# A hash of plugins to be passed to `create_resources`, wraps around the +# `grafana_plugin` resource. +# # === Examples # # class { '::grafana': @@ -69,32 +73,35 @@ # } # class grafana ( - $archive_source = $::grafana::params::archive_source, - $cfg_location = $::grafana::params::cfg_location, - $cfg = $::grafana::params::cfg, - $ldap_cfg = $::grafana::params::ldap_cfg, - $container_cfg = $::grafana::params::container_cfg, - $container_params = $::grafana::params::container_params, - $data_dir = $::grafana::params::data_dir, - $install_dir = $::grafana::params::install_dir, - $install_method = $::grafana::params::install_method, - $manage_package_repo = $::grafana::params::manage_package_repo, - $package_name = $::grafana::params::package_name, - $package_source = $::grafana::params::package_source, - $repo_name = $::grafana::params::repo_name, - $rpm_iteration = $::grafana::params::rpm_iteration, - $service_name = $::grafana::params::service_name, - $version = $::grafana::params::version + Optional[String] $archive_source = undef, + String $cfg_location = $::grafana::params::cfg_location, + Hash $cfg = $::grafana::params::cfg, + Optional[Hash] $ldap_cfg = undef, + Boolean $container_cfg = $::grafana::params::container_cfg, + Hash $container_params = $::grafana::params::container_params, + String $data_dir = $::grafana::params::data_dir, + String $install_dir = $::grafana::params::install_dir, + String $install_method = $::grafana::params::install_method, + Boolean $manage_package_repo = $::grafana::params::manage_package_repo, + String $package_name = $::grafana::params::package_name, + Optional[String] $package_source = undef, + Enum['stable', 'testing'] $repo_name = $::grafana::params::repo_name, + String $rpm_iteration = $::grafana::params::rpm_iteration, + String $service_name = $::grafana::params::service_name, + String $version = $::grafana::params::version, + Hash $plugins = {} ) inherits grafana::params { - # validate parameters here - if !is_hash($cfg) { - fail('cfg parameter must be a hash') - } + contain grafana::install + contain grafana::config + contain grafana::service + + Class['grafana::install'] + -> Class['grafana::config'] + ~> Class['grafana::service'] + + create_resources(grafana_plugin, $plugins) + + Grafana_Plugin <| |> ~> Class['grafana::service'] - anchor { 'grafana::begin': } - -> class { '::grafana::install': } - -> class { '::grafana::config': } - ~> class { '::grafana::service': } - -> anchor { 'grafana::end': } } diff --git a/manifests/puppet-modules/grafana/manifests/install.pp b/manifests/puppet-modules/grafana/manifests/install.pp index db9a1ae0..46e16a4e 100644 --- a/manifests/puppet-modules/grafana/manifests/install.pp +++ b/manifests/puppet-modules/grafana/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, } } @@ -33,16 +34,15 @@ ensure => present, } - wget::fetch { 'grafana': - source => $real_package_source, - destination => '/var/tmp/grafana.deb', + archive { '/tmp/grafana.deb': + source => $real_package_source, } package { $::grafana::package_name: ensure => present, provider => 'dpkg', - source => '/var/tmp/grafana.deb', - require => [Wget::Fetch['grafana'],Package['libfontconfig1']], + source => '/tmp/grafana.deb', + require => [Archive['/tmp/grafana.deb'],Package['libfontconfig1']], } } 'RedHat': { diff --git a/manifests/puppet-modules/grafana/manifests/params.pp b/manifests/puppet-modules/grafana/manifests/params.pp index fb8aa07a..54ef4a05 100644 --- a/manifests/puppet-modules/grafana/manifests/params.pp +++ b/manifests/puppet-modules/grafana/manifests/params.pp @@ -4,7 +4,6 @@ # It sets variables according to platform # class grafana::params { - $archive_source = undef $cfg = {} $container_cfg = false $container_params = {} @@ -12,12 +11,10 @@ $docker_image = 'grafana/grafana' $docker_ports = '3000:3000' $install_dir = '/usr/share/grafana' - $ldap_cfg = false $package_name = 'grafana' - $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/manifests/puppet-modules/grafana/manifests/plugin.pp b/manifests/puppet-modules/grafana/manifests/plugin.pp deleted file mode 100644 index ff10a907..00000000 --- a/manifests/puppet-modules/grafana/manifests/plugin.pp +++ /dev/null @@ -1,10 +0,0 @@ -# defined resource to add plugins to grafana via CLI -# this won't work with the docker installation method -define grafana::plugin( - String $plugin = $title, -){ - exec{"install ${plugin}": - command => "/usr/bin/grafana-cli plugins install ${plugin}", - creates => "/var/lib/grafana/plugins/${plugin}", - } -} diff --git a/manifests/puppet-modules/grafana/metadata.json b/manifests/puppet-modules/grafana/metadata.json index 934975e7..7a16e181 100644 --- a/manifests/puppet-modules/grafana/metadata.json +++ b/manifests/puppet-modules/grafana/metadata.json @@ -1,6 +1,6 @@ { "name": "puppet-grafana", - "version": "3.0.0", + "version": "4.0.1-rc0", "author": "Vox Pupuli", "summary": "This module provides Grafana, a dashboard and graph editor for Graphite and InfluxDB.", "license": "Apache-2.0", @@ -8,22 +8,10 @@ "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" - }, { "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 +27,22 @@ { "operatingsystem": "Ubuntu", "operatingsystemrelease": [ - "14.04" + "14.04", + "16.04" ] }, { "operatingsystem": "RedHat", "operatingsystemrelease": [ + "6", "6" ] }, { "operatingsystem": "CentOS", "operatingsystemrelease": [ - "6" + "6", + "7" ] }, { @@ -61,7 +52,7 @@ "requirements": [ { "name": "puppet", - "version_requirement": ">= 4.6.1 < 5.0.0" + "version_requirement": ">= 4.7.1 < 6.0.0" } ], "tags": [ diff --git a/manifests/puppet-modules/grafana/spec/acceptance/class_spec.rb b/manifests/puppet-modules/grafana/spec/acceptance/class_spec.rb index 759ad09f..4e65250a 100644 --- a/manifests/puppet-modules/grafana/spec/acceptance/class_spec.rb +++ b/manifests/puppet-modules/grafana/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/manifests/puppet-modules/grafana/spec/acceptance/nodesets/docker/ubuntu-14.04.yml b/manifests/puppet-modules/grafana/spec/acceptance/nodesets/docker/ubuntu-14.04.yml index 54d5e5a5..ae453044 100644 --- a/manifests/puppet-modules/grafana/spec/acceptance/nodesets/docker/ubuntu-14.04.yml +++ b/manifests/puppet-modules/grafana/spec/acceptance/nodesets/docker/ubuntu-14.04.yml @@ -12,7 +12,7 @@ HOSTS: docker_image_commands: - 'rm /usr/sbin/policy-rc.d' - 'rm /sbin/initctl; dpkg-divert --rename --remove /sbin/initctl' - - 'apt-get install -y net-tools wget' + - 'apt-get install -y net-tools wget apt-transport-https' - 'locale-gen en_US.UTF-8' CONFIG: trace_limit: 200 diff --git a/manifests/puppet-modules/grafana/spec/acceptance/nodesets/docker/ubuntu-16.04.yml b/manifests/puppet-modules/grafana/spec/acceptance/nodesets/docker/ubuntu-16.04.yml index bac2d5b3..2d173c5b 100644 --- a/manifests/puppet-modules/grafana/spec/acceptance/nodesets/docker/ubuntu-16.04.yml +++ b/manifests/puppet-modules/grafana/spec/acceptance/nodesets/docker/ubuntu-16.04.yml @@ -10,7 +10,7 @@ HOSTS: docker_preserve_image: true docker_cmd: '["/sbin/init"]' docker_image_commands: - - 'apt-get install -y net-tools wget locales' + - 'apt-get install -y net-tools wget locales apt-transport-https' - 'locale-gen en_US.UTF-8' CONFIG: trace_limit: 200 diff --git a/manifests/puppet-modules/grafana/spec/classes/grafana_spec.rb b/manifests/puppet-modules/grafana/spec/classes/grafana_spec.rb index 4f1e152a..b6fb7c29 100644 --- a/manifests/puppet-modules/grafana/spec/classes/grafana_spec.rb +++ b/manifests/puppet-modules/grafana/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 @@ -47,9 +45,13 @@ when 'Debian' download_location = '/tmp/grafana.deb' - describe 'use wget to fetch the package to a temporary location' do - it { is_expected.to contain_wget__fetch('grafana').with_destination(download_location) } - it { is_expected.to contain_wget__fetch('grafana').that_comes_before('Package[grafana]') } + describe 'use archive to fetch the package to a temporary location' do + it do + is_expected.to contain_archive('/tmp/grafana.deb').with_source( + 'https://s3-us-west-2.amazonaws.com/grafana-releases/release/builds/grafana_4.5.1_amd64.deb' + ) + end + it { is_expected.to contain_archive('/tmp/grafana.deb').that_comes_before('Package[grafana]') } end describe 'install dependencies first' do @@ -71,6 +73,21 @@ end end + context 'with some plugins passed in' do + let(:params) do + { + plugins: + { + 'grafana-wizzle' => { 'ensure' => 'present' }, + 'grafana-woozle' => { 'ensure' => 'absent' } + } + } + end + + it { is_expected.to contain_grafana_plugin('grafana-wizzle').with(ensure: 'present') } + it { is_expected.to contain_grafana_plugin('grafana-woozle').with(ensure: 'absent').that_notifies('Class[grafana::service]') } + end + context 'with parameter install_method is set to repo' do let(:params) do { @@ -91,7 +108,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 +121,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 +168,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') } @@ -208,16 +225,6 @@ context 'invalid parameters' do context 'cfg' do - describe 'should raise an error when cfg parameter is not a hash' do - let(:params) do - { - cfg: [] - } - end - - it { expect { is_expected.to contain_package('grafana') }.to raise_error(Puppet::Error, %r{cfg parameter must be a hash}) } - end - describe 'should not raise an error when cfg parameter is a hash' do let(:params) do { diff --git a/manifests/puppet-modules/grafana/spec/defines/plugin_spec.rb b/manifests/puppet-modules/grafana/spec/defines/plugin_spec.rb deleted file mode 100644 index 6b1fb995..00000000 --- a/manifests/puppet-modules/grafana/spec/defines/plugin_spec.rb +++ /dev/null @@ -1,20 +0,0 @@ -require 'spec_helper' - -describe 'grafana::plugin', type: :define do - on_supported_os.each do |os, facts| - context "on #{os} " do - let :facts do - facts - end - - let :title do - 'grafana-simple-json-datasource' - end - - context 'with all defaults' do - it { is_expected.to compile.with_all_deps } - it { is_expected.to contain_exec("install #{title}") } - end - end - end -end diff --git a/manifests/puppet-modules/grafana/spec/spec_helper_acceptance.rb b/manifests/puppet-modules/grafana/spec/spec_helper_acceptance.rb index 3882833d..f60ee4a5 100644 --- a/manifests/puppet-modules/grafana/spec/spec_helper_acceptance.rb +++ b/manifests/puppet-modules/grafana/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