From 8f9f9bd946c70598ac0da3615a1fd051896d5126 Mon Sep 17 00:00:00 2001 From: brutus333 Date: Tue, 27 Dec 2016 12:46:15 +0200 Subject: [PATCH 01/28] Updating README.md --- README.md | 6 ------ 1 file changed, 6 deletions(-) diff --git a/README.md b/README.md index fad9ce8aa..89358c4b0 100644 --- a/README.md +++ b/README.md @@ -3,12 +3,6 @@ [![Puppet Forge](https://img.shields.io/puppetforge/v/brutus777/prometheus.svg)](https://forge.puppetlabs.com/brutus777/prometheus) [![Puppet Forge](https://img.shields.io/puppetforge/f/brutus777/prometheus.svg)](https://forge.puppetlabs.com/brutus777/prometheus) -## Deprecation notice - -I'm moving this module to voxpopuli repository: https://github.com/voxpupuli/puppet-prometheus - -Please do not issue any additional PR here. - ## Compatibility | Prometheus Version | Recommended Puppet Module Version | From aa48f5420e794d3357e6d2276a069c3ed8a0a1fb Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Wed, 4 Jan 2017 18:55:16 +0100 Subject: [PATCH 02/28] modulesync 0.16.7 --- .github/CONTRIBUTING.md | 100 ++++ .github/ISSUE_TEMPLATE.md | 26 + .github/PULL_REQUEST_TEMPLATE.md | 8 + .gitignore | 15 +- .msync.yml | 1 + .rspec | 2 + .rubocop.yml | 520 ++++++++++++++++++ .travis.yml | 87 +-- .yardopts | 1 + Gemfile | 83 ++- Rakefile | 57 +- spec/acceptance/nodesets/centos-511-x64.yml | 15 + spec/acceptance/nodesets/centos-66-x64-pe.yml | 17 + spec/acceptance/nodesets/centos-66-x64.yml | 15 + spec/acceptance/nodesets/centos-72-x64.yml | 15 + spec/acceptance/nodesets/debian-78-x64.yml | 15 + spec/acceptance/nodesets/debian-82-x64.yml | 15 + spec/acceptance/nodesets/docker/centos-5.yml | 19 + spec/acceptance/nodesets/docker/centos-6.yml | 20 + spec/acceptance/nodesets/docker/centos-7.yml | 18 + spec/acceptance/nodesets/docker/debian-7.yml | 19 + spec/acceptance/nodesets/docker/debian-8.yml | 20 + .../nodesets/docker/ubuntu-12.04.yml | 19 + .../nodesets/docker/ubuntu-14.04.yml | 21 + .../nodesets/docker/ubuntu-16.04.yml | 19 + spec/acceptance/nodesets/fedora-24-x64.yml | 15 + spec/acceptance/nodesets/fedora-25-x64.yml | 18 + .../nodesets/ubuntu-server-1204-x64.yml | 15 + .../nodesets/ubuntu-server-1404-x64.yml | 15 + .../nodesets/ubuntu-server-1604-x64.yml | 15 + spec/classes/coverage_spec.rb | 4 + spec/default_facts.yml | 14 + spec/spec_helper.rb | 32 +- 33 files changed, 1183 insertions(+), 92 deletions(-) create mode 100644 .github/CONTRIBUTING.md create mode 100644 .github/ISSUE_TEMPLATE.md create mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 .msync.yml create mode 100644 .rspec create mode 100644 .rubocop.yml create mode 100644 .yardopts create mode 100644 spec/acceptance/nodesets/centos-511-x64.yml create mode 100644 spec/acceptance/nodesets/centos-66-x64-pe.yml create mode 100644 spec/acceptance/nodesets/centos-66-x64.yml create mode 100644 spec/acceptance/nodesets/centos-72-x64.yml create mode 100644 spec/acceptance/nodesets/debian-78-x64.yml create mode 100644 spec/acceptance/nodesets/debian-82-x64.yml create mode 100644 spec/acceptance/nodesets/docker/centos-5.yml create mode 100644 spec/acceptance/nodesets/docker/centos-6.yml create mode 100644 spec/acceptance/nodesets/docker/centos-7.yml create mode 100644 spec/acceptance/nodesets/docker/debian-7.yml create mode 100644 spec/acceptance/nodesets/docker/debian-8.yml create mode 100644 spec/acceptance/nodesets/docker/ubuntu-12.04.yml create mode 100644 spec/acceptance/nodesets/docker/ubuntu-14.04.yml create mode 100644 spec/acceptance/nodesets/docker/ubuntu-16.04.yml create mode 100644 spec/acceptance/nodesets/fedora-24-x64.yml create mode 100644 spec/acceptance/nodesets/fedora-25-x64.yml create mode 100644 spec/acceptance/nodesets/ubuntu-server-1204-x64.yml create mode 100644 spec/acceptance/nodesets/ubuntu-server-1404-x64.yml create mode 100644 spec/acceptance/nodesets/ubuntu-server-1604-x64.yml create mode 100644 spec/classes/coverage_spec.rb create mode 100644 spec/default_facts.yml diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md new file mode 100644 index 000000000..5574191a6 --- /dev/null +++ b/.github/CONTRIBUTING.md @@ -0,0 +1,100 @@ +This module has grown over time based on a range of contributions from +people using it. If you follow these contributing guidelines your patch +will likely make it into a release a little quicker. + +## Contributing + +Please note that this project is released with a Contributor Code of Conduct. +By participating in this project you agree to abide by its terms. +[Contributor Code of Conduct](https://voxpupuli.org/coc/). + +1. Fork the repo. + +1. Create a separate branch for your change. + +1. Run the tests. We only take pull requests with passing tests, and + documentation. + +1. Add a test for your change. Only refactoring and documentation + changes require no new tests. If you are adding functionality + or fixing a bug, please add a test. + +1. Squash your commits down into logical components. Make sure to rebase + against the current master. + +1. Push the branch to your fork and submit a pull request. + +Please be prepared to repeat some of these steps as our contributors review +your code. + +## Dependencies + +The testing and development tools have a bunch of dependencies, +all managed by [bundler](http://bundler.io/) according to the +[Puppet support matrix](http://docs.puppetlabs.com/guides/platforms.html#ruby-versions). + +By default the tests use a baseline version of Puppet. + +If you have Ruby 2.x or want a specific version of Puppet, +you must set an environment variable such as: + + export PUPPET_VERSION="~> 4.2.0" + +Install the dependencies like so... + + bundle install + +## Syntax and style + +The test suite will run [Puppet Lint](http://puppet-lint.com/) and +[Puppet Syntax](https://github.com/gds-operations/puppet-syntax) to +check various syntax and style things. You can run these locally with: + + bundle exec rake lint + bundle exec rake validate + +It will also run some [Rubocop](http://batsov.com/rubocop/) tests +against it. You can run those locally ahead of time with: + + bundle exec rake rubocop + +## Running the unit tests + +The unit test suite covers most of the code, as mentioned above please +add tests if you're adding new functionality. If you've not used +[rspec-puppet](http://rspec-puppet.com/) before then feel free to ask +about how best to test your new feature. + +To run your all the unit tests + + bundle exec rake spec SPEC_OPTS='--format documentation' + +To run a specific spec test set the `SPEC` variable: + + bundle exec rake spec SPEC=spec/foo_spec.rb + +To run the linter, the syntax checker and the unit tests: + + bundle exec rake test + +## Integration tests + +The unit tests just check the code runs, not that it does exactly what +we want on a real machine. For that we're using +[beaker](https://github.com/puppetlabs/beaker). + +This fires up a new virtual machine (using vagrant) and runs a series of +simple tests against it after applying the module. You can run this +with: + + bundle exec rake acceptance + +This will run the tests on an Ubuntu 12.04 virtual machine. You can also +run the integration tests against Centos 6.6 with. + + BEAKER_set=centos-66-x64 bundle exec rake acceptances + +If you don't want to have to recreate the virtual machine every time you +can use `BEAKER_DESTROY=no` and `BEAKER_PROVISION=no`. On the first run you will +at least need `BEAKER_PROVISION` set to yes (the default). The Vagrantfile +for the created virtual machines will be in `.vagrant/beaker_vagrant_fies`. diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 000000000..593e7aa83 --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,26 @@ + + +## Affected Puppet, Ruby, OS and module versions/distributions + +- Puppet: +- Ruby: +- Distribution: +- Module version: + +## How to reproduce (e.g Puppet code you use) + +## What are you seeing + +## What behaviour did you expect instead + +## Output log + +## Any additional information you'd like to impart diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 000000000..66f80444c --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,8 @@ + diff --git a/.gitignore b/.gitignore index 1612d7f11..82426da6e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,15 @@ +pkg/ Gemfile.lock -spec/fixtures/modules/* +Gemfile.local +vendor/ +.vendor/ +spec/fixtures/manifests/ +spec/fixtures/modules/ +.vagrant/ +.bundle/ +coverage/ +log/ +.idea/ +*.iml +.*.sw? +.yardoc/ diff --git a/.msync.yml b/.msync.yml new file mode 100644 index 000000000..d505802eb --- /dev/null +++ b/.msync.yml @@ -0,0 +1 @@ +modulesync_config_version: '0.16.7' diff --git a/.rspec b/.rspec new file mode 100644 index 000000000..8c18f1abd --- /dev/null +++ b/.rspec @@ -0,0 +1,2 @@ +--format documentation +--color diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 000000000..0e2866701 --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,520 @@ +require: rubocop-rspec +AllCops: + TargetRubyVersion: 1.9 + Include: + - ./**/*.rb + Exclude: + - files/**/* + - vendor/**/* + - .vendor/**/* + - pkg/**/* + - spec/fixtures/**/* +Lint/ConditionPosition: + Enabled: True + +Lint/ElseLayout: + Enabled: True + +Lint/UnreachableCode: + Enabled: True + +Lint/UselessComparison: + Enabled: True + +Lint/EnsureReturn: + Enabled: True + +Lint/HandleExceptions: + Enabled: True + +Lint/LiteralInCondition: + Enabled: True + +Lint/ShadowingOuterLocalVariable: + Enabled: True + +Lint/LiteralInInterpolation: + Enabled: True + +Style/HashSyntax: + Enabled: True + +Style/RedundantReturn: + Enabled: True + +Lint/AmbiguousOperator: + Enabled: True + +Lint/AssignmentInCondition: + Enabled: True + +Style/SpaceBeforeComment: + Enabled: True + +Style/AndOr: + Enabled: True + +Style/RedundantSelf: + Enabled: True + +Metrics/BlockLength: + Enabled: False + +# Method length is not necessarily an indicator of code quality +Metrics/MethodLength: + Enabled: False + +# Module length is not necessarily an indicator of code quality +Metrics/ModuleLength: + Enabled: False + +Style/WhileUntilModifier: + Enabled: True + +Lint/AmbiguousRegexpLiteral: + Enabled: True + +Lint/Eval: + Enabled: True + +Lint/BlockAlignment: + Enabled: True + +Lint/DefEndAlignment: + Enabled: True + +Lint/EndAlignment: + Enabled: True + +Lint/DeprecatedClassMethods: + Enabled: True + +Lint/Loop: + Enabled: True + +Lint/ParenthesesAsGroupedExpression: + Enabled: True + +Lint/RescueException: + Enabled: True + +Lint/StringConversionInInterpolation: + Enabled: True + +Lint/UnusedBlockArgument: + Enabled: True + +Lint/UnusedMethodArgument: + Enabled: True + +Lint/UselessAccessModifier: + Enabled: True + +Lint/UselessAssignment: + Enabled: True + +Lint/Void: + Enabled: True + +Style/AccessModifierIndentation: + Enabled: True + +Style/AccessorMethodName: + Enabled: True + +Style/Alias: + Enabled: True + +Style/AlignArray: + Enabled: True + +Style/AlignHash: + Enabled: True + +Style/AlignParameters: + Enabled: True + +Metrics/BlockNesting: + Enabled: True + +Style/AsciiComments: + Enabled: True + +Style/Attr: + Enabled: True + +Style/BracesAroundHashParameters: + Enabled: True + +Style/CaseEquality: + Enabled: True + +Style/CaseIndentation: + Enabled: True + +Style/CharacterLiteral: + Enabled: True + +Style/ClassAndModuleCamelCase: + Enabled: True + +Style/ClassAndModuleChildren: + Enabled: False + +Style/ClassCheck: + Enabled: True + +# Class length is not necessarily an indicator of code quality +Metrics/ClassLength: + Enabled: False + +Style/ClassMethods: + Enabled: True + +Style/ClassVars: + Enabled: True + +Style/WhenThen: + Enabled: True + +Style/WordArray: + Enabled: True + +Style/UnneededPercentQ: + Enabled: True + +Style/Tab: + Enabled: True + +Style/SpaceBeforeSemicolon: + Enabled: True + +Style/TrailingBlankLines: + Enabled: True + +Style/SpaceInsideBlockBraces: + Enabled: True + +Style/SpaceInsideBrackets: + Enabled: True + +Style/SpaceInsideHashLiteralBraces: + Enabled: True + +Style/SpaceInsideParens: + Enabled: True + +Style/LeadingCommentSpace: + Enabled: True + +Style/SpaceBeforeFirstArg: + Enabled: True + +Style/SpaceAfterColon: + Enabled: True + +Style/SpaceAfterComma: + Enabled: True + +Style/SpaceAfterMethodName: + Enabled: True + +Style/SpaceAfterNot: + Enabled: True + +Style/SpaceAfterSemicolon: + Enabled: True + +Style/SpaceAroundEqualsInParameterDefault: + Enabled: True + +Style/SpaceAroundOperators: + Enabled: True + +Style/SpaceBeforeBlockBraces: + Enabled: True + +Style/SpaceBeforeComma: + Enabled: True + +Style/CollectionMethods: + Enabled: True + +Style/CommentIndentation: + Enabled: True + +Style/ColonMethodCall: + Enabled: True + +Style/CommentAnnotation: + Enabled: True + +# 'Complexity' is very relative +Metrics/CyclomaticComplexity: + Enabled: False + +Style/ConstantName: + Enabled: True + +Style/Documentation: + Enabled: False + +Style/DefWithParentheses: + Enabled: True + +Style/PreferredHashMethods: + Enabled: True + +Style/DotPosition: + EnforcedStyle: trailing + +Style/DoubleNegation: + Enabled: True + +Style/EachWithObject: + Enabled: True + +Style/EmptyLineBetweenDefs: + Enabled: True + +Style/IndentArray: + Enabled: True + +Style/IndentHash: + Enabled: True + +Style/IndentationConsistency: + Enabled: True + +Style/IndentationWidth: + Enabled: True + +Style/EmptyLines: + Enabled: True + +Style/EmptyLinesAroundAccessModifier: + Enabled: True + +Style/EmptyLiteral: + Enabled: True + +# Configuration parameters: AllowURI, URISchemes. +Metrics/LineLength: + Enabled: False + +Style/MethodCallParentheses: + Enabled: True + +Style/MethodDefParentheses: + Enabled: True + +Style/LineEndConcatenation: + Enabled: True + +Style/TrailingWhitespace: + Enabled: True + +Style/StringLiterals: + Enabled: True + +Style/TrailingCommaInArguments: + Enabled: True + +Style/TrailingCommaInLiteral: + Enabled: True + +Style/GlobalVars: + Enabled: True + +Style/GuardClause: + Enabled: True + +Style/IfUnlessModifier: + Enabled: True + +Style/MultilineIfThen: + Enabled: True + +Style/NegatedIf: + Enabled: True + +Style/NegatedWhile: + Enabled: True + +Style/Next: + Enabled: True + +Style/SingleLineBlockParams: + Enabled: True + +Style/SingleLineMethods: + Enabled: True + +Style/SpecialGlobalVars: + Enabled: True + +Style/TrivialAccessors: + Enabled: True + +Style/UnlessElse: + Enabled: True + +Style/VariableInterpolation: + Enabled: True + +Style/VariableName: + Enabled: True + +Style/WhileUntilDo: + Enabled: True + +Style/EvenOdd: + Enabled: True + +Style/FileName: + Enabled: True + +Style/For: + Enabled: True + +Style/Lambda: + Enabled: True + +Style/MethodName: + Enabled: True + +Style/MultilineTernaryOperator: + Enabled: True + +Style/NestedTernaryOperator: + Enabled: True + +Style/NilComparison: + Enabled: True + +Style/FormatString: + Enabled: True + +Style/MultilineBlockChain: + Enabled: True + +Style/Semicolon: + Enabled: True + +Style/SignalException: + Enabled: True + +Style/NonNilCheck: + Enabled: True + +Style/Not: + Enabled: True + +Style/NumericLiterals: + Enabled: True + +Style/OneLineConditional: + Enabled: True + +Style/OpMethod: + Enabled: True + +Style/ParenthesesAroundCondition: + Enabled: True + +Style/PercentLiteralDelimiters: + Enabled: True + +Style/PerlBackrefs: + Enabled: True + +Style/PredicateName: + Enabled: True + +Style/RedundantException: + Enabled: True + +Style/SelfAssignment: + Enabled: True + +Style/Proc: + Enabled: True + +Style/RaiseArgs: + Enabled: True + +Style/RedundantBegin: + Enabled: True + +Style/RescueModifier: + Enabled: True + +# based on https://github.com/voxpupuli/modulesync_config/issues/168 +Style/RegexpLiteral: + EnforcedStyle: percent_r + Enabled: True + +Lint/UnderscorePrefixedVariableName: + Enabled: True + +Metrics/ParameterLists: + Enabled: False + +Lint/RequireParentheses: + Enabled: True + +Style/SpaceBeforeFirstArg: + Enabled: True + +Style/ModuleFunction: + Enabled: True + +Lint/Debugger: + Enabled: True + +Style/IfWithSemicolon: + Enabled: True + +Style/Encoding: + Enabled: True + +Style/BlockDelimiters: + Enabled: True + +Style/MultilineBlockLayout: + Enabled: True + +# 'Complexity' is very relative +Metrics/AbcSize: + Enabled: False + +# 'Complexity' is very relative +Metrics/PerceivedComplexity: + Enabled: False + +Lint/UselessAssignment: + Enabled: True + +Style/ClosingParenthesisIndentation: + Enabled: True + +# RSpec + +# We don't use rspec in this way +RSpec/DescribeClass: + Enabled: False + +# Example length is not necessarily an indicator of code quality +RSpec/ExampleLength: + Enabled: False + +RSpec/NamedSubject: + Enabled: False + +# disabled for now since they cause a lot of issues +# these issues aren't easy to fix +RSpec/RepeatedDescription: + Enabled: False + +RSpec/NestedGroups: + Enabled: False diff --git a/.travis.yml b/.travis.yml index 20180011a..6214a5548 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,45 +1,54 @@ --- -language: ruby -bundler_args: --without development -before_install: rm Gemfile.lock || true sudo: false +language: ruby cache: bundler -rvm: - - 1.9.3 - - 2.0.0 - - 2.1.0 -script: bundle exec rake test -env: - - PUPPET_VERSION="~> 3.1.0" - - PUPPET_VERSION="~> 3.3.0" - - PUPPET_VERSION="~> 3.7.4" FUTURE_PARSER=yes - - PUPPET_VERSION="~> 3.8.4" - - PUPPET_VERSION="~> 3.8.4" FUTURE_PARSER=yes - - PUPPET_VERSION="~> 4.0.0" - - PUPPET_VERSION="~> 4.1.0" +bundler_args: --without system_tests development +before_install: + - bundle -v + - rm Gemfile.lock || true + - gem update --system + - gem update bundler + - gem --version + - bundle -v +script: + - 'bundle exec rake $CHECK' matrix: - exclude: - - rvm: 1.9.3 - env: PUPPET_VERSION="~> 2.7.0" - - rvm: 2.0.0 - env: PUPPET_VERSION="~> 2.7.0" - - rvm: 2.0.0 - env: PUPPET_VERSION="~> 3.1.0" - - rvm: 2.1.0 - env: PUPPET_VERSION="~> 2.7.0" - - rvm: 2.1.0 - env: PUPPET_VERSION="~> 3.1.0" - - rvm: 2.1.0 - env: PUPPET_VERSION="~> 3.2.0" - - rvm: 2.1.0 - env: PUPPET_VERSION="~> 3.3.0" - - rvm: 2.1.0 - env: PUPPET_VERSION="~> 3.4.0" + fast_finish: true + include: - rvm: 1.9.3 - env: PUPPET_VERSION="~> 4.0.0" - - rvm: 2.0.0 - env: PUPPET_VERSION="~> 4.0.0" + env: PUPPET_VERSION="~> 3.0" STRICT_VARIABLES="yes" CHECK=test - rvm: 1.9.3 - env: PUPPET_VERSION="~> 4.1.0" - - rvm: 2.0.0 - env: PUPPET_VERSION="~> 4.1.0" + env: PUPPET_VERSION="~> 3.0" STRICT_VARIABLES="yes" FUTURE_PARSER="yes" CHECK=test + - rvm: 2.1.9 + env: PUPPET_VERSION="~> 3.0" STRICT_VARIABLES="yes" CHECK=test + - rvm: 2.1.9 + env: PUPPET_VERSION="~> 4.0" CHECK=test + - rvm: 2.2.6 + env: PUPPET_VERSION="~> 4.0" CHECK=test + - rvm: 2.3.3 + env: PUPPET_VERSION="~> 4.0" CHECK=build DEPLOY_TO_FORGE=yes + - rvm: 2.3.3 + env: PUPPET_VERSION="~> 4.0" CHECK=rubocop + - rvm: 2.3.3 + env: PUPPET_VERSION="~> 4.0" CHECK=test + - rvm: 2.4.0 + env: PUPPET_VERSION="~> 4.0" CHECK=test + allow_failures: + - rvm: 2.4.0 +branches: + only: + - master + - /^v\d/ +notifications: + email: false +deploy: + provider: puppetforge + user: puppet + password: + secure: "" + on: + tags: true + # all_branches is required to use tags + all_branches: true + # Only publish the build marked with "DEPLOY_TO_FORGE" + condition: "$DEPLOY_TO_FORGE = yes" diff --git a/.yardopts b/.yardopts new file mode 100644 index 000000000..29c933bcf --- /dev/null +++ b/.yardopts @@ -0,0 +1 @@ +--markup markdown diff --git a/Gemfile b/Gemfile index aadf97296..0fa24c662 100644 --- a/Gemfile +++ b/Gemfile @@ -1,19 +1,66 @@ -source "https://rubygems.org" - -group :development,:test do - gem "json" - # Pin for 1.8.7 compatibility for now - gem "rake", '< 11.0.0' - gem "puppet", ENV['PUPPET_VERSION'] || '~> 3.7.0' - gem "puppet-lint" - - # Pin for 1.8.7 compatibility for now - gem "rspec", '< 3.2.0' - gem "rspec-core", "3.1.7" - gem "rspec-puppet", "~> 2.1" - - gem "puppet-syntax" - gem "puppetlabs_spec_helper" - gem "hiera" - gem "hiera-puppet-helper" +source ENV['GEM_SOURCE'] || "https://rubygems.org" + +def location_for(place, fake_version = nil) + if place =~ /^(git[:@][^#]*)#(.*)/ + [fake_version, { :git => $1, :branch => $2, :require => false }].compact + elsif place =~ /^file:\/\/(.*)/ + ['>= 0', { :path => File.expand_path($1), :require => false }] + else + [place, { :require => false }] + end +end + +group :test do + gem 'puppetlabs_spec_helper', '~> 1.2.2', :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 + gem 'puppet-lint-classes_and_types_beginning_with_digits-check', :require => false + gem 'puppet-lint-unquoted_string-check', :require => false + 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 'puppet-strings', '~> 1.0.0', :require => false + gem 'rubocop-rspec', '~> 1.9.0', :require => false if RUBY_VERSION >= '2.3.0' + gem 'json_pure', '<= 2.0.1', :require => false if RUBY_VERSION < '2.0.0' + gem 'mocha', '>= 1.2.1', :require => false + gem 'coveralls', :require => false if RUBY_VERSION >= '2.0.0' + gem 'simplecov-console', :require => false if RUBY_VERSION >= '2.0.0' +end + +group :development do + gem 'travis', :require => false + gem 'travis-lint', :require => false + gem 'guard-rake', :require => false +end + +group :system_tests do + if beaker_version = ENV['BEAKER_VERSION'] + gem 'beaker', *location_for(beaker_version) + end + if beaker_rspec_version = ENV['BEAKER_RSPEC_VERSION'] + gem 'beaker-rspec', *location_for(beaker_rspec_version) + else + gem 'beaker-rspec', :require => false + end + gem 'serverspec', :require => false + gem 'beaker-puppet_install_helper', :require => false end + + + +if facterversion = ENV['FACTER_GEM_VERSION'] + gem 'facter', facterversion.to_s, :require => false, :groups => [:test] +else + gem 'facter', :require => false, :groups => [:test] +end + +ENV['PUPPET_VERSION'].nil? ? puppetversion = '~> 4.0' : puppetversion = ENV['PUPPET_VERSION'].to_s +gem 'puppet', puppetversion, :require => false, :groups => [:test] + +# vim: syntax=ruby diff --git a/Rakefile b/Rakefile index bc5cdb974..d00f2470a 100644 --- a/Rakefile +++ b/Rakefile @@ -1,42 +1,33 @@ -require 'rubygems' -require 'bundler/setup' require 'puppetlabs_spec_helper/rake_tasks' -require 'puppet-lint/tasks/puppet-lint' -require 'puppet-syntax/tasks/puppet-syntax' +require 'puppet_blacksmith/rake_tasks' +require 'voxpupuli/release/rake_tasks' +require 'puppet-strings/tasks' -# These two gems aren't always present, for instance -# on Travis with --without development -begin - require 'puppet_blacksmith/rake_tasks' -rescue LoadError -end - -PuppetLint.configuration.send("disable_80chars") -PuppetLint.configuration.log_format = "%{path}:%{linenumber}:%{check}:%{KIND}:%{message}" -PuppetLint.configuration.fail_on_warnings = false - -# Forsake support for Puppet 2.6.2 for the benefit of cleaner code. -# http://puppet-lint.com/checks/class_parameter_defaults/ -PuppetLint.configuration.send('disable_class_parameter_defaults') -# http://puppet-lint.com/checks/class_inherits_from_params_class/ +PuppetLint.configuration.log_format = '%{path}:%{line}:%{check}:%{KIND}:%{message}' +PuppetLint.configuration.fail_on_warnings = true +PuppetLint.configuration.send('relative') +PuppetLint.configuration.send('disable_140chars') PuppetLint.configuration.send('disable_class_inherits_from_params_class') +PuppetLint.configuration.send('disable_documentation') +PuppetLint.configuration.send('disable_single_quote_string_with_variables') -exclude_paths = [ - "pkg/**/*", - "vendor/**/*", - "spec/**/*", -] +exclude_paths = %w( + pkg/**/* + vendor/**/* + .vendor/**/* + spec/**/* +) PuppetLint.configuration.ignore_paths = exclude_paths PuppetSyntax.exclude_paths = exclude_paths -#desc "Run acceptance tests" -#RSpec::Core::RakeTask.new(:acceptance) do |t| -# t.pattern = 'spec/acceptance' -#end +desc 'Run acceptance tests' +RSpec::Core::RakeTask.new(:acceptance) do |t| + t.pattern = 'spec/acceptance' +end -desc "Run syntax, lint, and spec tests." -task :test => [ - :syntax, - :lint, - :spec, +desc 'Run tests metadata_lint, release_checks' +task test: [ + :metadata_lint, + :release_checks, ] +# vim: syntax=ruby diff --git a/spec/acceptance/nodesets/centos-511-x64.yml b/spec/acceptance/nodesets/centos-511-x64.yml new file mode 100644 index 000000000..089d646a5 --- /dev/null +++ b/spec/acceptance/nodesets/centos-511-x64.yml @@ -0,0 +1,15 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +HOSTS: + centos-511-x64: + roles: + - master + platform: el-5-x86_64 + box: puppetlabs/centos-5.11-64-nocm + hypervisor: vagrant +CONFIG: + type: foss +... +# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/centos-66-x64-pe.yml b/spec/acceptance/nodesets/centos-66-x64-pe.yml new file mode 100644 index 000000000..1e7aea6d4 --- /dev/null +++ b/spec/acceptance/nodesets/centos-66-x64-pe.yml @@ -0,0 +1,17 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +HOSTS: + centos-66-x64: + roles: + - master + - database + - dashboard + platform: el-6-x86_64 + box: puppetlabs/centos-6.6-64-puppet-enterprise + hypervisor: vagrant +CONFIG: + type: pe +... +# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/centos-66-x64.yml b/spec/acceptance/nodesets/centos-66-x64.yml new file mode 100644 index 000000000..42455e7ae --- /dev/null +++ b/spec/acceptance/nodesets/centos-66-x64.yml @@ -0,0 +1,15 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +HOSTS: + centos-66-x64: + roles: + - master + platform: el-6-x86_64 + box: puppetlabs/centos-6.6-64-nocm + hypervisor: vagrant +CONFIG: + type: foss +... +# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/centos-72-x64.yml b/spec/acceptance/nodesets/centos-72-x64.yml new file mode 100644 index 000000000..85af89d3f --- /dev/null +++ b/spec/acceptance/nodesets/centos-72-x64.yml @@ -0,0 +1,15 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +HOSTS: + centos-72-x64: + roles: + - master + platform: el-7-x86_64 + box: puppetlabs/centos-7.2-64-nocm + hypervisor: vagrant +CONFIG: + type: foss +... +# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/debian-78-x64.yml b/spec/acceptance/nodesets/debian-78-x64.yml new file mode 100644 index 000000000..6ef6de8c8 --- /dev/null +++ b/spec/acceptance/nodesets/debian-78-x64.yml @@ -0,0 +1,15 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +HOSTS: + debian-78-x64: + roles: + - master + platform: debian-7-amd64 + box: puppetlabs/debian-7.8-64-nocm + hypervisor: vagrant +CONFIG: + type: foss +... +# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/debian-82-x64.yml b/spec/acceptance/nodesets/debian-82-x64.yml new file mode 100644 index 000000000..9897a8fc7 --- /dev/null +++ b/spec/acceptance/nodesets/debian-82-x64.yml @@ -0,0 +1,15 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +HOSTS: + debian-82-x64: + roles: + - master + platform: debian-8-amd64 + box: puppetlabs/debian-8.2-64-nocm + hypervisor: vagrant +CONFIG: + type: foss +... +# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/docker/centos-5.yml b/spec/acceptance/nodesets/docker/centos-5.yml new file mode 100644 index 000000000..c17bc3d00 --- /dev/null +++ b/spec/acceptance/nodesets/docker/centos-5.yml @@ -0,0 +1,19 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +HOSTS: + centos-5-x64: + platform: el-5-x86_64 + hypervisor: docker + image: centos:5 + docker_preserve_image: true + docker_cmd: '["/sbin/init"]' + docker_image_commands: + - 'yum install -y crontabs initscripts iproute openssl sysvinit-tools tar wget which' + - 'sed -i -e "/mingetty/d" /etc/inittab' +CONFIG: + trace_limit: 200 + masterless: true +... +# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/docker/centos-6.yml b/spec/acceptance/nodesets/docker/centos-6.yml new file mode 100644 index 000000000..d93f884cb --- /dev/null +++ b/spec/acceptance/nodesets/docker/centos-6.yml @@ -0,0 +1,20 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +HOSTS: + centos-6-x64: + platform: el-6-x86_64 + hypervisor: docker + image: centos:6 + docker_preserve_image: true + docker_cmd: '["/sbin/init"]' + docker_image_commands: + - 'rm -rf /var/run/network/*' + - 'yum install -y crontabs initscripts iproute openssl sysvinit-tools tar wget which' + - 'rm /etc/init/tty.conf' +CONFIG: + trace_limit: 200 + masterless: true +... +# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/docker/centos-7.yml b/spec/acceptance/nodesets/docker/centos-7.yml new file mode 100644 index 000000000..886b1eeb3 --- /dev/null +++ b/spec/acceptance/nodesets/docker/centos-7.yml @@ -0,0 +1,18 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +HOSTS: + centos-7-x64: + platform: el-7-x86_64 + hypervisor: docker + image: centos:7 + docker_preserve_image: true + docker_cmd: '["/usr/sbin/init"]' + docker_image_commands: + - 'yum install -y crontabs initscripts iproute openssl sysvinit-tools tar wget which' +CONFIG: + trace_limit: 200 + masterless: true +... +# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/docker/debian-7.yml b/spec/acceptance/nodesets/docker/debian-7.yml new file mode 100644 index 000000000..071acbf90 --- /dev/null +++ b/spec/acceptance/nodesets/docker/debian-7.yml @@ -0,0 +1,19 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +HOSTS: + debian-7-x64: + platform: debian-7-amd64 + hypervisor: docker + image: debian:7 + docker_preserve_image: true + docker_cmd: '["/sbin/init"]' + docker_image_commands: + - 'echo deb http://ftp.debian.org/debian wheezy-backports main >> /etc/apt/sources.list' + - 'apt-get update && apt-get install -y cron locales-all net-tools wget' +CONFIG: + trace_limit: 200 + masterless: true +... +# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/docker/debian-8.yml b/spec/acceptance/nodesets/docker/debian-8.yml new file mode 100644 index 000000000..500bee522 --- /dev/null +++ b/spec/acceptance/nodesets/docker/debian-8.yml @@ -0,0 +1,20 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +HOSTS: + debian-8-x64: + platform: debian-8-amd64 + hypervisor: docker + image: debian:8 + docker_preserve_image: true + docker_cmd: '["/sbin/init"]' + docker_image_commands: + - 'echo deb http://ftp.debian.org/debian jessie-backports main >> /etc/apt/sources.list' + - 'apt-get update && apt-get install -y cron locales-all net-tools wget' + - 'rm -f /usr/sbin/policy-rc.d' +CONFIG: + trace_limit: 200 + masterless: true +... +# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/docker/ubuntu-12.04.yml b/spec/acceptance/nodesets/docker/ubuntu-12.04.yml new file mode 100644 index 000000000..ab77cda48 --- /dev/null +++ b/spec/acceptance/nodesets/docker/ubuntu-12.04.yml @@ -0,0 +1,19 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +HOSTS: + ubuntu-1204-x64: + platform: ubuntu-12.04-amd64 + hypervisor: docker + image: ubuntu:12.04 + docker_preserve_image: true + docker_cmd: '["/sbin/init"]' + docker_image_commands: + - 'apt-get install -y net-tools wget' + - 'locale-gen en_US.UTF-8' +CONFIG: + trace_limit: 200 + masterless: true +... +# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/docker/ubuntu-14.04.yml b/spec/acceptance/nodesets/docker/ubuntu-14.04.yml new file mode 100644 index 000000000..54d5e5a5b --- /dev/null +++ b/spec/acceptance/nodesets/docker/ubuntu-14.04.yml @@ -0,0 +1,21 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +HOSTS: + ubuntu-1404-x64: + platform: ubuntu-14.04-amd64 + hypervisor: docker + image: ubuntu:14.04 + docker_preserve_image: true + docker_cmd: '["/sbin/init"]' + 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' + - 'locale-gen en_US.UTF-8' +CONFIG: + trace_limit: 200 + masterless: true +... +# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/docker/ubuntu-16.04.yml b/spec/acceptance/nodesets/docker/ubuntu-16.04.yml new file mode 100644 index 000000000..92a93cb73 --- /dev/null +++ b/spec/acceptance/nodesets/docker/ubuntu-16.04.yml @@ -0,0 +1,19 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +HOSTS: + ubuntu-1604-x64: + platform: ubuntu-16.04-amd64 + hypervisor: docker + image: ubuntu:16.04 + docker_preserve_image: true + docker_cmd: '["/sbin/init"]' + docker_image_commands: + - 'apt-get install -y net-tools wget' + - 'locale-gen en_US.UTF-8' +CONFIG: + trace_limit: 200 + masterless: true +... +# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/fedora-24-x64.yml b/spec/acceptance/nodesets/fedora-24-x64.yml new file mode 100644 index 000000000..820b62d26 --- /dev/null +++ b/spec/acceptance/nodesets/fedora-24-x64.yml @@ -0,0 +1,15 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +HOSTS: + fedora-24-x64: + roles: + - master + platform: fedora-24-x86_64 + box: fedora/24-cloud-base + hypervisor: vagrant +CONFIG: + type: aio +... +# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/fedora-25-x64.yml b/spec/acceptance/nodesets/fedora-25-x64.yml new file mode 100644 index 000000000..c3a3cbf59 --- /dev/null +++ b/spec/acceptance/nodesets/fedora-25-x64.yml @@ -0,0 +1,18 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +# +# platform is fedora 24 because there is no +# puppet-agent for fedora 25 by 2016-12-30 +HOSTS: + fedora-25-x64: + roles: + - master + platform: fedora-24-x86_64 + box: fedora/25-cloud-base + hypervisor: vagrant +CONFIG: + type: aio +... +# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/ubuntu-server-1204-x64.yml b/spec/acceptance/nodesets/ubuntu-server-1204-x64.yml new file mode 100644 index 000000000..29102c565 --- /dev/null +++ b/spec/acceptance/nodesets/ubuntu-server-1204-x64.yml @@ -0,0 +1,15 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +HOSTS: + ubuntu-server-1204-x64: + roles: + - master + platform: ubuntu-12.04-amd64 + box: puppetlabs/ubuntu-12.04-64-nocm + hypervisor: vagrant +CONFIG: + type: foss +... +# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml b/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml new file mode 100644 index 000000000..054e65880 --- /dev/null +++ b/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml @@ -0,0 +1,15 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +HOSTS: + ubuntu-server-1404-x64: + roles: + - master + platform: ubuntu-14.04-amd64 + box: puppetlabs/ubuntu-14.04-64-nocm + hypervisor: vagrant +CONFIG: + type: foss +... +# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/ubuntu-server-1604-x64.yml b/spec/acceptance/nodesets/ubuntu-server-1604-x64.yml new file mode 100644 index 000000000..bc85e0e84 --- /dev/null +++ b/spec/acceptance/nodesets/ubuntu-server-1604-x64.yml @@ -0,0 +1,15 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +HOSTS: + ubuntu-server-1604-x64: + roles: + - master + platform: ubuntu-16.04-amd64 + box: puppetlabs/ubuntu-16.04-64-nocm + hypervisor: vagrant +CONFIG: + type: foss +... +# vim: syntax=yaml diff --git a/spec/classes/coverage_spec.rb b/spec/classes/coverage_spec.rb new file mode 100644 index 000000000..de446548b --- /dev/null +++ b/spec/classes/coverage_spec.rb @@ -0,0 +1,4 @@ +require 'rspec-puppet' + +at_exit { RSpec::Puppet::Coverage.report! } +# vim: syntax=ruby diff --git a/spec/default_facts.yml b/spec/default_facts.yml new file mode 100644 index 000000000..13c416576 --- /dev/null +++ b/spec/default_facts.yml @@ -0,0 +1,14 @@ +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +# +# use default_module_facts.yaml for module specific +# facts. +# +# Hint if using with rspec-puppet-facts ("on_supported_os.each"): +# if a same named fact exists in facterdb it will be overridden. +--- +concat_basedir: "/tmp" +ipaddress: "172.16.254.254" +is_pe: false +macaddress: "AA:AA:AA:AA:AA:AA" diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index dc7e9f4a0..32709c814 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,2 +1,32 @@ -require 'rubygems' require 'puppetlabs_spec_helper/module_spec_helper' +require 'rspec-puppet-facts' +include RspecPuppetFacts + +if Dir.exist?(File.expand_path('../../lib', __FILE__)) && RUBY_VERSION !~ %r{^1.9} + require 'coveralls' + require 'simplecov' + require 'simplecov-console' + SimpleCov.formatters = [ + SimpleCov::Formatter::HTMLFormatter, + SimpleCov::Formatter::Console, + Coveralls::SimpleCov::Formatter + ] + SimpleCov.start do + track_files 'lib/**/*.rb' + add_filter '/spec' + add_filter '/vendor' + add_filter '/.vendor' + end +end + +RSpec.configure do |c| + default_facts = { + puppetversion: Puppet.version, + facterversion: Facter.version + } + default_facts.merge!(YAML.load(File.read(File.expand_path('../default_facts.yml', __FILE__)))) if File.exist?(File.expand_path('../default_facts.yml', __FILE__)) + default_facts.merge!(YAML.load(File.read(File.expand_path('../default_module_facts.yml', __FILE__)))) if File.exist?(File.expand_path('../default_module_facts.yml', __FILE__)) + c.default_facts = default_facts +end + +# vim: syntax=ruby From 62f93296b8d8174bcec074bb09167754782a786a Mon Sep 17 00:00:00 2001 From: Dennis Hoppe Date: Thu, 5 Jan 2017 22:38:46 +0100 Subject: [PATCH 03/28] Add Travis CI credentials --- .sync.yml | 3 +++ .travis.yml | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 .sync.yml diff --git a/.sync.yml b/.sync.yml new file mode 100644 index 000000000..55f7b62d7 --- /dev/null +++ b/.sync.yml @@ -0,0 +1,3 @@ +--- +.travis.yml: + secure: "JquGPtLafZM/F6sNke12hW2VlKIn5yKfTXh/iAVIOLG/GLi2Om7enhvxl81nuyu1qjeXqMla+6WUKqWHu1s5odzI6JRjaWjdikxwcwuU464h3Fg8r3/enDlZtL6VWbLGQf0pqiaNNKlRl/2P9dYTCx8cbgAUPTqNIGY1Hf/V0oSIXRV1L3DbtDa0Qt5e3WOC0oAHYjoMLDFx/LhAUoFH6h5VGmM2hiuw641OE1PdZcdzkD64xFUpOSuFP7hknNyeGMftr+ZtwH3oymKHhpeH4IYJIiuI74+HEUtSzNsh+8Ok35gRZz3hgab4YmGjbJIVR2BiMIIghbD41Izcp2FmH4mMqkfJx5slLv/uoAtVeyyOgFOz9rcGuGlQE6mFXDeAWTNeXMQdnTEZGiwj7/sKYzbfdRKiPquGqr//so7RiN+0QwO+9MJoQuwZDhIsHsr1EEJhkA9kLy/gZpOD54Ef4w3EcRzu76grxRMzEgwLTOYFKVKIuXUY4y0u6SV/uJeoi80Ke5fCwfGRG/U1heWto2sns5LhEkV+nfH31iM5BLzMLYukuTgX9CJRje22+s/gL8bvXvD6LCQ0bckzZI8Pq+g1w41iILXRYJ7kJsjFszdDG8pQPk1rM5ZNHl+CNq1u7wXEci2ND0b9WQu2QDcOH8eGtasPaVFX+2LBhpaw0k0=" diff --git a/.travis.yml b/.travis.yml index 6214a5548..403642a9c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -45,7 +45,7 @@ deploy: provider: puppetforge user: puppet password: - secure: "" + secure: "JquGPtLafZM/F6sNke12hW2VlKIn5yKfTXh/iAVIOLG/GLi2Om7enhvxl81nuyu1qjeXqMla+6WUKqWHu1s5odzI6JRjaWjdikxwcwuU464h3Fg8r3/enDlZtL6VWbLGQf0pqiaNNKlRl/2P9dYTCx8cbgAUPTqNIGY1Hf/V0oSIXRV1L3DbtDa0Qt5e3WOC0oAHYjoMLDFx/LhAUoFH6h5VGmM2hiuw641OE1PdZcdzkD64xFUpOSuFP7hknNyeGMftr+ZtwH3oymKHhpeH4IYJIiuI74+HEUtSzNsh+8Ok35gRZz3hgab4YmGjbJIVR2BiMIIghbD41Izcp2FmH4mMqkfJx5slLv/uoAtVeyyOgFOz9rcGuGlQE6mFXDeAWTNeXMQdnTEZGiwj7/sKYzbfdRKiPquGqr//so7RiN+0QwO+9MJoQuwZDhIsHsr1EEJhkA9kLy/gZpOD54Ef4w3EcRzu76grxRMzEgwLTOYFKVKIuXUY4y0u6SV/uJeoi80Ke5fCwfGRG/U1heWto2sns5LhEkV+nfH31iM5BLzMLYukuTgX9CJRje22+s/gL8bvXvD6LCQ0bckzZI8Pq+g1w41iILXRYJ7kJsjFszdDG8pQPk1rM5ZNHl+CNq1u7wXEci2ND0b9WQu2QDcOH8eGtasPaVFX+2LBhpaw0k0=" on: tags: true # all_branches is required to use tags From a1a64811e1abd448cb6bb0df76a3931c80f0a475 Mon Sep 17 00:00:00 2001 From: brutus333 Date: Tue, 10 Jan 2017 12:21:54 +0200 Subject: [PATCH 04/28] Build fixes (#3) * Fixed Apache license identifier * Robocop fixes * Fixing trailing comma * Fixed relative class name * Fixed relative classes name * Trying to fix rspec test cases * Changing allowed failures in travis.yml --- .travis.yml | 4 +- examples/init.pp | 5 ++ manifests/config.pp | 8 ++-- manifests/daemon.pp | 2 +- manifests/install.pp | 2 +- metadata.json | 4 +- spec/classes/node_exporter_spec.rb | 51 ++++++++------------- spec/classes/statsd_exporter_spec.rb | 0 spec/defines/daemon_spec.rb | 68 ---------------------------- spec/fixtures/manifests/site.pp | 0 tests/init.pp | 5 -- 11 files changed, 34 insertions(+), 115 deletions(-) create mode 100644 examples/init.pp delete mode 100644 spec/classes/statsd_exporter_spec.rb delete mode 100644 spec/defines/daemon_spec.rb delete mode 100644 spec/fixtures/manifests/site.pp delete mode 100644 tests/init.pp diff --git a/.travis.yml b/.travis.yml index 403642a9c..7779d470c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,12 +15,10 @@ script: matrix: fast_finish: true include: - - rvm: 1.9.3 - env: PUPPET_VERSION="~> 3.0" STRICT_VARIABLES="yes" CHECK=test - rvm: 1.9.3 env: PUPPET_VERSION="~> 3.0" STRICT_VARIABLES="yes" FUTURE_PARSER="yes" CHECK=test - rvm: 2.1.9 - env: PUPPET_VERSION="~> 3.0" STRICT_VARIABLES="yes" CHECK=test + env: PUPPET_VERSION="~> 3.0" STRICT_VARIABLES="yes" FUTURE_PARSER="yes" CHECK=test - rvm: 2.1.9 env: PUPPET_VERSION="~> 4.0" CHECK=test - rvm: 2.2.6 diff --git a/examples/init.pp b/examples/init.pp new file mode 100644 index 000000000..7901748ac --- /dev/null +++ b/examples/init.pp @@ -0,0 +1,5 @@ +include ::prometheus +include ::prometheus::node_exporter +include ::prometheus::alertmanager +include ::prometheus::alerts +include ::prometheus::statsd_exporter diff --git a/manifests/config.pp b/manifests/config.pp index ed54c4bae..41adae38b 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -44,7 +44,7 @@ mode => '0555', owner => 'root', group => 'root', - content => template('prometheus/prometheus.sysv.erb') + content => template('prometheus/prometheus.sysv.erb'), } } 'debian' : { @@ -52,7 +52,7 @@ mode => '0555', owner => 'root', group => 'root', - content => template('prometheus/prometheus.debian.erb') + content => template('prometheus/prometheus.debian.erb'), } } 'sles' : { @@ -60,7 +60,7 @@ mode => '0555', owner => 'root', group => 'root', - content => template('prometheus/prometheus.sles.erb') + content => template('prometheus/prometheus.sles.erb'), } } 'launchd' : { @@ -68,7 +68,7 @@ mode => '0644', owner => 'root', group => 'wheel', - content => template('prometheus/prometheus.launchd.erb') + content => template('prometheus/prometheus.launchd.erb'), } } default : { diff --git a/manifests/daemon.pp b/manifests/daemon.pp index 108a0dbb8..97aac1dbc 100644 --- a/manifests/daemon.pp +++ b/manifests/daemon.pp @@ -23,7 +23,7 @@ ) { case $install_method { 'url': { - include staging + include ::staging $staging_file = "${name}-${version}.${download_extension}" $binary = "${::staging::path}/${name}-${version}.${os}-${arch}/${name}" staging::file { $staging_file: diff --git a/manifests/install.pp b/manifests/install.pp index c64548fc4..d35668617 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -15,7 +15,7 @@ } case $::prometheus::install_method { 'url': { - include staging + include ::staging staging::file { "prometheus-${prometheus::version}.${prometheus::download_extension}": source => $prometheus::real_download_url, } -> diff --git a/metadata.json b/metadata.json index 3e71145fd..77558686f 100644 --- a/metadata.json +++ b/metadata.json @@ -2,7 +2,7 @@ "author": "Virgil Chereches", "dependencies": [{"name":"puppetlabs/stdlib","version_requirement":">= 4.6.0 <5.0.0"}, {"name":"nanliu/staging","version_requirement":">=0.4.0 <2.0.0"}], - "license": "Apache 2.0", + "license": "Apache-2.0", "name": "brutus777-prometheus", "operatingsystem_support": [ { @@ -19,5 +19,5 @@ "source": "https://github.com/brutus333/puppet-prometheus", "summary": "Prometheus Puppet module", "tags": [], - "version": "0.2.00" + "version": "0.2.0" } diff --git a/spec/classes/node_exporter_spec.rb b/spec/classes/node_exporter_spec.rb index 1bda49abd..e5ed2b7e5 100644 --- a/spec/classes/node_exporter_spec.rb +++ b/spec/classes/node_exporter_spec.rb @@ -1,37 +1,26 @@ require 'spec_helper' -describe "prometheus::node_exporter" do - let :default_facts do - { - 'operatingsystem' => 'CentOS', - 'osfamily' => 'Redhat', - 'operatingsystemrelease' => '7.0', - 'architecture' => 'amd64', - 'kernel' => 'Linux', - } - end - - context 'uses the correct binary path for version' do - let(:facts) { default_facts } - - let(:params) { {:version => '0.10.0', :arch => 'amd64', :os => 'linux'} } - - it do - should contain_file('/usr/local/bin/node_exporter').with({ - 'target' => '/opt/staging/node_exporter-0.10.0.linux-amd64/node_exporter' - }) - end - end - - context 'uses the correct binary path for version' do - let(:facts) { default_facts } - - let(:params) { {:version => '0.10.0', :arch => 'amd64', :os => 'linux'} } +describe 'prometheus::node_exporter' do + on_supported_os.each do |os, facts| + context "on #{os}" do + let(:facts) do + facts.merge( + staging_http_get: 'curl' + ) + end - it do - should contain_file('/usr/local/bin/node_exporter').with({ - 'target' => '/opt/staging/node_exporter-0.10.0.linux-amd64/node_exporter' - }) + context 'with version specified' do + let(:params) do + { + version: '0.13.0', + arch: 'amd64', + os: 'linux' + } + end + describe 'install correct binary' do + it { is_expected.to contain_file('/usr/local/bin/node_exporter').with('target' => '/opt/staging/node_exporter-0.13.0.linux-amd64/node_exporter') } + end + end end end end diff --git a/spec/classes/statsd_exporter_spec.rb b/spec/classes/statsd_exporter_spec.rb deleted file mode 100644 index e69de29bb..000000000 diff --git a/spec/defines/daemon_spec.rb b/spec/defines/daemon_spec.rb deleted file mode 100644 index 63cadf95e..000000000 --- a/spec/defines/daemon_spec.rb +++ /dev/null @@ -1,68 +0,0 @@ -require 'spec_helper' - -describe "prometheus::daemon" do - let :title do - 'node_exporter' - end - - let :default_params do - { - install_method: 'url', - version: '0.13.0', - download_extension: 'tar.gz', - os: 'linux', - arch: 'amd64', - bin_dir: '/usr/local/bin', - notify_service: true, - manage_user: true, - user: 'node_exporter', - extra_groups: [], - group: 'node_exporter', - manage_group: true, - purge: true, - options: '', - init_style: 'systemd', - service_ensure: true, - service_enable: true, - manage_service: true, - real_download_url: "https://github.com/prometheus/node_exporter/releases/download/v0.13.0/node_exporter-0.13.0.linux-amd64.tar.gz", - package_name: 'node_exporter', - package_ensure: false, - } - end - - context 'should define a service' do - let(:params) { default_params } - - it do - should contain_service('node_exporter').with({ - 'ensure' => true, - 'enable' => true, - }) - end - end - - context 'should create a link to the downloaded binary' do - let(:params) { default_params } - - it do - should contain_file('/usr/local/bin/node_exporter').with({ - 'ensure' => 'link', - 'target' => '/opt/staging/node_exporter-0.13.0.linux-amd64/node_exporter' - }) - end - end - - context 'should create a user and group' do - let(:params) { default_params } - - it do - should contain_user('node_exporter').with({ - 'ensure' => 'present', - }) - should contain_group('node_exporter').with({ - 'ensure' => 'present', - }) - end - end -end diff --git a/spec/fixtures/manifests/site.pp b/spec/fixtures/manifests/site.pp deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/init.pp b/tests/init.pp deleted file mode 100644 index 22e0869b8..000000000 --- a/tests/init.pp +++ /dev/null @@ -1,5 +0,0 @@ -include prometheus -include prometheus::node_exporter -include prometheus::alertmanager -include prometheus::alerts -include prometheus::statsd_exporter From 6824b3b612e17e305c43e73a3a5442a5e643c57a Mon Sep 17 00:00:00 2001 From: Alexander Fisher Date: Wed, 11 Jan 2017 18:38:52 +0000 Subject: [PATCH 05/28] Change 'staging' dependency to 'puppet/staging' --- .fixtures.yml | 2 +- metadata.json | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.fixtures.yml b/.fixtures.yml index 07ec5c0da..c57d09d38 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -1,6 +1,6 @@ fixtures: repositories: stdlib: "https://github.com/puppetlabs/puppetlabs-stdlib" - staging: "https://github.com/nanliu/puppet-staging" + staging: "https://github.com/voxpupuli/puppet-staging" symlinks: "prometheus": "#{source_dir}" diff --git a/metadata.json b/metadata.json index 77558686f..49eace5dc 100644 --- a/metadata.json +++ b/metadata.json @@ -1,7 +1,15 @@ { "author": "Virgil Chereches", - "dependencies": [{"name":"puppetlabs/stdlib","version_requirement":">= 4.6.0 <5.0.0"}, - {"name":"nanliu/staging","version_requirement":">=0.4.0 <2.0.0"}], + "dependencies": [ + { + "name":"puppetlabs/stdlib", + "version_requirement":">= 4.6.0 <5.0.0" + }, + { + "name":"puppet/staging", + "version_requirement":">=1.0.7 <3.0.0" + } + ], "license": "Apache-2.0", "name": "brutus777-prometheus", "operatingsystem_support": [ From 43b7251a06a2587403008cca59cd91f82012c238 Mon Sep 17 00:00:00 2001 From: "james.powis" Date: Sun, 22 Jan 2017 17:59:58 -0700 Subject: [PATCH 06/28] Fixing forge badges to voxpupuli namespace --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 89358c4b0..77940169b 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # puppet-prometheus -[![Puppet Forge](https://img.shields.io/puppetforge/e/brutus777/prometheus.svg)](https://forge.puppetlabs.com/brutus777/prometheus) -[![Puppet Forge](https://img.shields.io/puppetforge/v/brutus777/prometheus.svg)](https://forge.puppetlabs.com/brutus777/prometheus) -[![Puppet Forge](https://img.shields.io/puppetforge/f/brutus777/prometheus.svg)](https://forge.puppetlabs.com/brutus777/prometheus) +[![Puppet Forge](https://img.shields.io/puppetforge/e/puppet/prometheus.svg)](https://forge.puppetlabs.com/puppet/prometheus) +[![Puppet Forge](https://img.shields.io/puppetforge/v/puppet/prometheus.svg)](https://forge.puppetlabs.com/puppet/prometheus) +[![Puppet Forge](https://img.shields.io/puppetforge/f/puppet/prometheus.svg)](https://forge.puppetlabs.com/puppet/prometheus) ## Compatibility From 1c39be9de1c94fc40a2b95b85bc2678b4639f187 Mon Sep 17 00:00:00 2001 From: Jon Ward Date: Tue, 31 Jan 2017 17:19:12 +0000 Subject: [PATCH 07/28] Add a class for the HAProxy exporter (#10) --- .rubocop.yml | 2 +- manifests/haproxy_exporter.pp | 136 ++++++++++++++++++++++++++ manifests/params.pp | 9 ++ spec/classes/haproxy_exporter_spec.rb | 26 +++++ spec/spec_helper.rb | 4 +- 5 files changed, 174 insertions(+), 3 deletions(-) create mode 100644 manifests/haproxy_exporter.pp create mode 100644 spec/classes/haproxy_exporter_spec.rb diff --git a/.rubocop.yml b/.rubocop.yml index 0e2866701..f2136f3c5 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -302,7 +302,7 @@ Style/EmptyLiteral: Metrics/LineLength: Enabled: False -Style/MethodCallParentheses: +Style/MethodCallWithoutArgsParentheses: Enabled: True Style/MethodDefParentheses: diff --git a/manifests/haproxy_exporter.pp b/manifests/haproxy_exporter.pp new file mode 100644 index 000000000..da397d85c --- /dev/null +++ b/manifests/haproxy_exporter.pp @@ -0,0 +1,136 @@ +# Class: prometheus::haproxy_exporter +# +# This module manages prometheus haproxy_exporter +# +# Parameters: +# [*arch*] +# Architecture (amd64 or i386) +# +# [*bin_dir*] +# Directory where binaries are located +# +# [*cnf_scrape_uri*] +# The URI to obtain HAProxy stats from +# +# [*download_extension*] +# Extension for the release binary archive +# +# [*download_url*] +# Complete URL corresponding to the where the release binary archive can be downloaded +# +# [*download_url_base*] +# Base URL for the binary archive +# +# [*extra_groups*] +# Extra groups to add the binary user to +# +# [*extra_options*] +# Extra options added to the startup command +# +# [*group*] +# Group under which the binary is running +# +# [*init_style*] +# Service startup scripts style (e.g. rc, upstart or systemd) +# +# [*install_method*] +# Installation method: url or package (only url is supported currently) +# +# [*manage_group*] +# Whether to create a group for or rely on external code for that +# +# [*manage_service*] +# Should puppet manage the service? (default true) +# +# [*manage_user*] +# Whether to create user or rely on external code for that +# +# [*os*] +# Operating system (linux is the only one supported) +# +# [*package_ensure*] +# If package, then use this for package ensure default 'latest' +# +# [*package_name*] +# The binary package name - not available yet +# +# [*purge_config_dir*] +# Purge config files no longer generated by Puppet +# +# [*restart_on_change*] +# Should puppet restart the service on configuration change? (default true) +# +# [*service_enable*] +# Whether to enable the service from puppet (default true) +# +# [*service_ensure*] +# State ensured for the service (default 'running') +# +# [*user*] +# User which runs the service +# +# [*version*] +# The binary release version +class prometheus::haproxy_exporter( + $arch = $::prometheus::params::arch, + $bin_dir = $::prometheus::params::bin_dir, + $cnf_scrape_uri = $::prometheus::params::haproxy_exporter_cnf_scrape_uri, + $download_extension = $::prometheus::params::haproxy_exporter_download_extension, + $download_url = undef, + $download_url_base = $::prometheus::params::haproxy_exporter_download_url_base, + $extra_groups = $::prometheus::params::haproxy_exporter_extra_groups, + $extra_options = '', + $group = $::prometheus::params::haproxy_exporter_group, + $init_style = $::prometheus::params::init_style, + $install_method = $::prometheus::params::install_method, + $manage_group = true, + $manage_service = true, + $manage_user = true, + $os = $::prometheus::params::os, + $package_ensure = $::prometheus::params::haproxy_exporter_package_ensure, + $package_name = $::prometheus::params::haproxy_exporter_package_name, + $purge_config_dir = true, + $restart_on_change = true, + $service_enable = true, + $service_ensure = 'running', + $user = $::prometheus::params::haproxy_exporter_user, + $version = $::prometheus::params::haproxy_exporter_version, +) inherits prometheus::params { + + $real_download_url = pick($download_url,"${download_url_base}/download/v${version}/${package_name}-${version}.${os}-${arch}.${download_extension}") + validate_bool($purge_config_dir) + validate_bool($manage_user) + validate_bool($manage_service) + validate_bool($restart_on_change) + $notify_service = $restart_on_change ? { + true => Service['haproxy_exporter'], + default => undef, + } + + $options = "-haproxy.scrape-uri=\"${cnf_scrape_uri}\" ${extra_options}" + + prometheus::daemon { 'haproxy_exporter': + install_method => $install_method, + version => $version, + download_extension => $download_extension, + os => $os, + arch => $arch, + real_download_url => $real_download_url, + bin_dir => $bin_dir, + notify_service => $notify_service, + package_name => $package_name, + package_ensure => $package_ensure, + manage_user => $manage_user, + user => $user, + extra_groups => $extra_groups, + group => $group, + manage_group => $manage_group, + purge => $purge_config_dir, + options => $options, + init_style => $init_style, + service_ensure => $service_ensure, + service_enable => $service_enable, + manage_service => $manage_service, + } + +} diff --git a/manifests/params.pp b/manifests/params.pp index a991a2764..fa4bc8e52 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -29,6 +29,15 @@ $group = 'prometheus' $install_method = 'url' $localstorage = '/var/lib/prometheus' + $haproxy_exporter_cnf_scrape_uri = 'http://localhost:1234/haproxy?stats;csv' + $haproxy_exporter_download_extension = 'tar.gz' + $haproxy_exporter_download_url_base = 'https://github.com/prometheus/haproxy_exporter/releases' + $haproxy_exporter_extra_groups = [] + $haproxy_exporter_group = 'haproxy-exporter' + $haproxy_exporter_package_ensure = 'latest' + $haproxy_exporter_package_name = 'haproxy_exporter' + $haproxy_exporter_user = 'haproxy-user' + $haproxy_exporter_version = '0.7.1' $mysqld_exporter_cnf_config_path = '/etc/.my.cnf' $mysqld_exporter_cnf_host = 'localhost' $mysqld_exporter_cnf_password = 'password' diff --git a/spec/classes/haproxy_exporter_spec.rb b/spec/classes/haproxy_exporter_spec.rb new file mode 100644 index 000000000..9ae0a89d3 --- /dev/null +++ b/spec/classes/haproxy_exporter_spec.rb @@ -0,0 +1,26 @@ +require 'spec_helper' + +describe 'prometheus::haproxy_exporter' do + on_supported_os.each do |os, facts| + context "on #{os}" do + let(:facts) do + facts.merge( + staging_http_get: 'curl' + ) + end + + context 'with version specified' do + let(:params) do + { + version: '0.7.1', + arch: 'amd64', + os: 'linux' + } + end + describe 'install correct binary' do + it { is_expected.to contain_file('/usr/local/bin/haproxy_exporter').with('target' => '/opt/staging/haproxy_exporter-0.7.1.linux-amd64/haproxy_exporter') } + end + end + end + end +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 32709c814..ec02c1a63 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -24,8 +24,8 @@ puppetversion: Puppet.version, facterversion: Facter.version } - default_facts.merge!(YAML.load(File.read(File.expand_path('../default_facts.yml', __FILE__)))) if File.exist?(File.expand_path('../default_facts.yml', __FILE__)) - default_facts.merge!(YAML.load(File.read(File.expand_path('../default_module_facts.yml', __FILE__)))) if File.exist?(File.expand_path('../default_module_facts.yml', __FILE__)) + default_facts.merge!(YAML.safe_load(File.read(File.expand_path('../default_facts.yml', __FILE__)))) if File.exist?(File.expand_path('../default_facts.yml', __FILE__)) + default_facts.merge!(YAML.safe_load(File.read(File.expand_path('../default_module_facts.yml', __FILE__)))) if File.exist?(File.expand_path('../default_module_facts.yml', __FILE__)) c.default_facts = default_facts end From 98ee6c3bc52d839245ad51be17fa063ef1c82ded Mon Sep 17 00:00:00 2001 From: Dennis Hoppe Date: Sat, 4 Feb 2017 16:08:28 +0100 Subject: [PATCH 08/28] Update based on voxpupuli/modulesync_config 0.19.3 (#15) --- .gitignore | 3 +++ .msync.yml | 2 +- .pmtignore | 1 + .rubocop.yml | 6 +++++- .travis.yml | 15 +++++---------- .yardopts | 1 + Gemfile | 12 ++++++++---- Rakefile | 11 +++++++++++ spec/spec_helper.rb | 6 +++--- 9 files changed, 38 insertions(+), 19 deletions(-) create mode 100644 .pmtignore diff --git a/.gitignore b/.gitignore index 82426da6e..b5217490b 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,9 @@ spec/fixtures/modules/ coverage/ log/ .idea/ +.dependencies/ +.librarian/ +Puppetfile.lock *.iml .*.sw? .yardoc/ diff --git a/.msync.yml b/.msync.yml index d505802eb..b42c48761 100644 --- a/.msync.yml +++ b/.msync.yml @@ -1 +1 @@ -modulesync_config_version: '0.16.7' +modulesync_config_version: '0.19.3' diff --git a/.pmtignore b/.pmtignore new file mode 100644 index 000000000..77f12ae2e --- /dev/null +++ b/.pmtignore @@ -0,0 +1 @@ +docs/ diff --git a/.rubocop.yml b/.rubocop.yml index f2136f3c5..ef85ceb41 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -74,7 +74,7 @@ Style/WhileUntilModifier: Lint/AmbiguousRegexpLiteral: Enabled: True -Lint/Eval: +Security/Eval: Enabled: True Lint/BlockAlignment: @@ -518,3 +518,7 @@ RSpec/RepeatedDescription: RSpec/NestedGroups: Enabled: False + +# disable Yaml safe_load. This is needed to support ruby2.0.0 development envs +Security/YAMLLoad: + Enabled: false diff --git a/.travis.yml b/.travis.yml index 7779d470c..531ec6ba0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,6 @@ --- sudo: false +dist: trusty language: ruby cache: bundler bundler_args: --without system_tests development @@ -15,24 +16,18 @@ script: matrix: fast_finish: true include: - - rvm: 1.9.3 - env: PUPPET_VERSION="~> 3.0" STRICT_VARIABLES="yes" FUTURE_PARSER="yes" CHECK=test - - rvm: 2.1.9 - env: PUPPET_VERSION="~> 3.0" STRICT_VARIABLES="yes" FUTURE_PARSER="yes" CHECK=test - rvm: 2.1.9 env: PUPPET_VERSION="~> 4.0" CHECK=test - rvm: 2.2.6 env: PUPPET_VERSION="~> 4.0" CHECK=test - - rvm: 2.3.3 - env: PUPPET_VERSION="~> 4.0" CHECK=build DEPLOY_TO_FORGE=yes - - rvm: 2.3.3 - env: PUPPET_VERSION="~> 4.0" CHECK=rubocop - rvm: 2.3.3 env: PUPPET_VERSION="~> 4.0" CHECK=test - rvm: 2.4.0 env: PUPPET_VERSION="~> 4.0" CHECK=test - allow_failures: - - rvm: 2.4.0 + - rvm: 2.4.0 + env: PUPPET_VERSION="~> 4.0" CHECK=rubocop + - rvm: 2.4.0 + env: PUPPET_VERSION="~> 4.0" CHECK=build DEPLOY_TO_FORGE=yes branches: only: - master diff --git a/.yardopts b/.yardopts index 29c933bcf..3687f5184 100644 --- a/.yardopts +++ b/.yardopts @@ -1 +1,2 @@ --markup markdown +--output-dir docs/ diff --git a/Gemfile b/Gemfile index 0fa24c662..3bbbce90c 100644 --- a/Gemfile +++ b/Gemfile @@ -26,11 +26,15 @@ group :test do gem 'puppet-blacksmith', :require => false gem 'voxpupuli-release', :require => false, :git => 'https://github.com/voxpupuli/voxpupuli-release-gem.git' gem 'puppet-strings', '~> 1.0.0', :require => false - gem 'rubocop-rspec', '~> 1.9.0', :require => false if RUBY_VERSION >= '2.3.0' - gem 'json_pure', '<= 2.0.1', :require => false if RUBY_VERSION < '2.0.0' + gem 'redcarpet', :require => false + gem 'rubocop', '~> 0.47.0', :require => false if RUBY_VERSION >= '2.3.0' + gem 'rubocop-rspec', '~> 1.10.0', :require => false if RUBY_VERSION >= '2.3.0' gem 'mocha', '>= 1.2.1', :require => false - gem 'coveralls', :require => false if RUBY_VERSION >= '2.0.0' - gem 'simplecov-console', :require => false if RUBY_VERSION >= '2.0.0' + gem 'coveralls', :require => false + gem 'simplecov-console', :require => false + gem 'github_changelog_generator', '~> 1.13.0', :require => false if RUBY_VERSION < '2.2.2' + gem 'rack', '~> 1.0', :require => false if RUBY_VERSION < '2.2.2' + gem 'github_changelog_generator', :require => false if RUBY_VERSION >= '2.2.2' end group :development do diff --git a/Rakefile b/Rakefile index d00f2470a..2def02fad 100644 --- a/Rakefile +++ b/Rakefile @@ -30,4 +30,15 @@ task test: [ :metadata_lint, :release_checks, ] + +begin + require 'github_changelog_generator/task' + GitHubChangelogGenerator::RakeTask.new :changelog do |config| + version = (Blacksmith::Modulefile.new).version + config.future_release = "#{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} + end +rescue LoadError +end # vim: syntax=ruby diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index ec02c1a63..2aa9da74c 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -2,7 +2,7 @@ require 'rspec-puppet-facts' include RspecPuppetFacts -if Dir.exist?(File.expand_path('../../lib', __FILE__)) && RUBY_VERSION !~ %r{^1.9} +if Dir.exist?(File.expand_path('../../lib', __FILE__)) require 'coveralls' require 'simplecov' require 'simplecov-console' @@ -24,8 +24,8 @@ puppetversion: Puppet.version, facterversion: Facter.version } - default_facts.merge!(YAML.safe_load(File.read(File.expand_path('../default_facts.yml', __FILE__)))) if File.exist?(File.expand_path('../default_facts.yml', __FILE__)) - default_facts.merge!(YAML.safe_load(File.read(File.expand_path('../default_module_facts.yml', __FILE__)))) if File.exist?(File.expand_path('../default_module_facts.yml', __FILE__)) + default_facts.merge!(YAML.load(File.read(File.expand_path('../default_facts.yml', __FILE__)))) if File.exist?(File.expand_path('../default_facts.yml', __FILE__)) + default_facts.merge!(YAML.load(File.read(File.expand_path('../default_module_facts.yml', __FILE__)))) if File.exist?(File.expand_path('../default_module_facts.yml', __FILE__)) c.default_facts = default_facts end From ffa8a74b0802a1251d9ddad61f344fb7c29ffe60 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sun, 12 Feb 2017 01:18:22 +0100 Subject: [PATCH 09/28] modulesync 0.20.0 --- .gitignore | 1 + .msync.yml | 2 +- .pmtignore | 19 +++++++++++ Gemfile | 3 +- spec/acceptance/nodesets/centos-6-x64.yml | 15 ++++++++ spec/acceptance/nodesets/centos-7-x64.yml | 15 ++++++++ spec/acceptance/nodesets/docker/centos-7.yml | 2 +- .../nodesets/ec2/amazonlinux-2016091.yml | 31 +++++++++++++++++ .../nodesets/ec2/image_templates.yaml | 34 +++++++++++++++++++ spec/acceptance/nodesets/ec2/rhel-73-x64.yml | 29 ++++++++++++++++ .../nodesets/ec2/sles-12sp2-x64.yml | 29 ++++++++++++++++ .../nodesets/ec2/ubuntu-1604-x64.yml | 29 ++++++++++++++++ .../nodesets/ec2/windows-2016-base-x64.yml | 29 ++++++++++++++++ spec/acceptance/nodesets/fedora-25-x64.yml | 2 +- 14 files changed, 236 insertions(+), 4 deletions(-) create mode 100644 spec/acceptance/nodesets/centos-6-x64.yml create mode 100644 spec/acceptance/nodesets/centos-7-x64.yml create mode 100644 spec/acceptance/nodesets/ec2/amazonlinux-2016091.yml create mode 100644 spec/acceptance/nodesets/ec2/image_templates.yaml create mode 100644 spec/acceptance/nodesets/ec2/rhel-73-x64.yml create mode 100644 spec/acceptance/nodesets/ec2/sles-12sp2-x64.yml create mode 100644 spec/acceptance/nodesets/ec2/ubuntu-1604-x64.yml create mode 100644 spec/acceptance/nodesets/ec2/windows-2016-base-x64.yml diff --git a/.gitignore b/.gitignore index b5217490b..0d629b0c1 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ spec/fixtures/manifests/ spec/fixtures/modules/ .vagrant/ .bundle/ +.ruby-version coverage/ log/ .idea/ diff --git a/.msync.yml b/.msync.yml index b42c48761..d03e57009 100644 --- a/.msync.yml +++ b/.msync.yml @@ -1 +1 @@ -modulesync_config_version: '0.19.3' +modulesync_config_version: '0.20.0' diff --git a/.pmtignore b/.pmtignore index 77f12ae2e..fb5895753 100644 --- a/.pmtignore +++ b/.pmtignore @@ -1 +1,20 @@ docs/ +pkg/ +Gemfile.lock +Gemfile.local +vendor/ +.vendor/ +spec/fixtures/manifests/ +spec/fixtures/modules/ +.vagrant/ +.bundle/ +.ruby-version +coverage/ +log/ +.idea/ +.dependencies/ +.librarian/ +Puppetfile.lock +*.iml +.*.sw? +.yardoc/ diff --git a/Gemfile b/Gemfile index 3bbbce90c..2270de7dc 100644 --- a/Gemfile +++ b/Gemfile @@ -11,7 +11,8 @@ def location_for(place, fake_version = nil) end group :test do - gem 'puppetlabs_spec_helper', '~> 1.2.2', :require => false + gem 'puppetlabs_spec_helper', '~> 2.0.1', :require => false + gem 'parallel_tests', :require => false gem 'rspec-puppet', '~> 2.5', :require => false gem 'rspec-puppet-facts', :require => false gem 'rspec-puppet-utils', :require => false diff --git a/spec/acceptance/nodesets/centos-6-x64.yml b/spec/acceptance/nodesets/centos-6-x64.yml new file mode 100644 index 000000000..16abc8f1c --- /dev/null +++ b/spec/acceptance/nodesets/centos-6-x64.yml @@ -0,0 +1,15 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +HOSTS: + centos-6-x64: + roles: + - master + platform: el-6-x86_64 + box: centos/6 + hypervisor: vagrant +CONFIG: + type: aio +... +# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/centos-7-x64.yml b/spec/acceptance/nodesets/centos-7-x64.yml new file mode 100644 index 000000000..e05a3ae16 --- /dev/null +++ b/spec/acceptance/nodesets/centos-7-x64.yml @@ -0,0 +1,15 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +HOSTS: + centos-7-x64: + roles: + - master + platform: el-7-x86_64 + box: centos/7 + hypervisor: vagrant +CONFIG: + type: aio +... +# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/docker/centos-7.yml b/spec/acceptance/nodesets/docker/centos-7.yml index 886b1eeb3..85e9d63c3 100644 --- a/spec/acceptance/nodesets/docker/centos-7.yml +++ b/spec/acceptance/nodesets/docker/centos-7.yml @@ -10,7 +10,7 @@ HOSTS: docker_preserve_image: true docker_cmd: '["/usr/sbin/init"]' docker_image_commands: - - 'yum install -y crontabs initscripts iproute openssl sysvinit-tools tar wget which' + - 'yum install -y crontabs initscripts iproute openssl sysvinit-tools tar wget which ss' CONFIG: trace_limit: 200 masterless: true diff --git a/spec/acceptance/nodesets/ec2/amazonlinux-2016091.yml b/spec/acceptance/nodesets/ec2/amazonlinux-2016091.yml new file mode 100644 index 000000000..3f064f0a9 --- /dev/null +++ b/spec/acceptance/nodesets/ec2/amazonlinux-2016091.yml @@ -0,0 +1,31 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +# +# Additional ~/.fog config file with AWS EC2 credentials +# required. +# +# see: https://github.com/puppetlabs/beaker/blob/master/docs/how_to/hypervisors/ec2.md +# +# Amazon Linux is not a RHEL clone. +# +HOSTS: + amazonlinux-2016091-x64: + roles: + - master + platform: centos-6-x86_64 + hypervisor: ec2 + # refers to image_tempaltes.yaml AMI[vmname] entry: + vmname: amazonlinux-2016091-eu-central-1 + # refers to image_tempaltes.yaml entry inside AMI[vmname][:image]: + snapshot: aio + # t2.micro is free tier eligible (https://aws.amazon.com/en/free/): + amisize: t2.micro + # required so that beaker sanitizes sshd_config and root authorized_keys: + user: ec2-user +CONFIG: + type: aio + :ec2_yaml: spec/acceptance/nodesets/ec2/image_templates.yaml +... +# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/ec2/image_templates.yaml b/spec/acceptance/nodesets/ec2/image_templates.yaml new file mode 100644 index 000000000..9a277d812 --- /dev/null +++ b/spec/acceptance/nodesets/ec2/image_templates.yaml @@ -0,0 +1,34 @@ +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +# +# see also: https://github.com/puppetlabs/beaker/blob/master/docs/how_to/hypervisors/ec2.md +# +# Hint: image IDs (ami-*) for the same image are different per location. +# +AMI: + # Amazon Linux AMI 2016.09.1 (HVM), SSD Volume Type + amazonlinux-2016091-eu-central-1: + :image: + :aio: ami-af0fc0c0 + :region: eu-central-1 + # Red Hat Enterprise Linux 7.3 (HVM), SSD Volume Type + rhel-73-eu-central-1: + :image: + :aio: ami-e4c63e8b + :region: eu-central-1 + # SUSE Linux Enterprise Server 12 SP2 (HVM), SSD Volume Type + sles-12sp2-eu-central-1: + :image: + :aio: ami-c425e4ab + :region: eu-central-1 + # Ubuntu Server 16.04 LTS (HVM), SSD Volume Type + ubuntu-1604-eu-central-1: + :image: + :aio: ami-fe408091 + :region: eu-central-1 + # Microsoft Windows Server 2016 Base + windows-2016-base-eu-central-1: + :image: + :aio: ami-88ec20e7 + :region: eu-central-1 diff --git a/spec/acceptance/nodesets/ec2/rhel-73-x64.yml b/spec/acceptance/nodesets/ec2/rhel-73-x64.yml new file mode 100644 index 000000000..cd0521e7c --- /dev/null +++ b/spec/acceptance/nodesets/ec2/rhel-73-x64.yml @@ -0,0 +1,29 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +# +# Additional ~/.fog config file with AWS EC2 credentials +# required. +# +# see: https://github.com/puppetlabs/beaker/blob/master/docs/how_to/hypervisors/ec2.md +# +HOSTS: + rhel-73-x64: + roles: + - master + platform: el-7-x86_64 + hypervisor: ec2 + # refers to image_tempaltes.yaml AMI[vmname] entry: + vmname: rhel-73-eu-central-1 + # refers to image_tempaltes.yaml entry inside AMI[vmname][:image]: + snapshot: aio + # t2.micro is free tier eligible (https://aws.amazon.com/en/free/): + amisize: t2.micro + # required so that beaker sanitizes sshd_config and root authorized_keys: + user: ec2-user +CONFIG: + type: aio + :ec2_yaml: spec/acceptance/nodesets/ec2/image_templates.yaml +... +# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/ec2/sles-12sp2-x64.yml b/spec/acceptance/nodesets/ec2/sles-12sp2-x64.yml new file mode 100644 index 000000000..a14bea6cd --- /dev/null +++ b/spec/acceptance/nodesets/ec2/sles-12sp2-x64.yml @@ -0,0 +1,29 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +# +# Additional ~/.fog config file with AWS EC2 credentials +# required. +# +# see: https://github.com/puppetlabs/beaker/blob/master/docs/how_to/hypervisors/ec2.md +# +HOSTS: + sles-12sp2-x64: + roles: + - master + platform: sles-12-x86_64 + hypervisor: ec2 + # refers to image_tempaltes.yaml AMI[vmname] entry: + vmname: sles-12sp2-eu-central-1 + # refers to image_tempaltes.yaml entry inside AMI[vmname][:image]: + snapshot: aio + # t2.micro is free tier eligible (https://aws.amazon.com/en/free/): + amisize: t2.micro + # required so that beaker sanitizes sshd_config and root authorized_keys: + user: ec2-user +CONFIG: + type: aio + :ec2_yaml: spec/acceptance/nodesets/ec2/image_templates.yaml +... +# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/ec2/ubuntu-1604-x64.yml b/spec/acceptance/nodesets/ec2/ubuntu-1604-x64.yml new file mode 100644 index 000000000..21ce560ac --- /dev/null +++ b/spec/acceptance/nodesets/ec2/ubuntu-1604-x64.yml @@ -0,0 +1,29 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +# +# Additional ~/.fog config file with AWS EC2 credentials +# required. +# +# see: https://github.com/puppetlabs/beaker/blob/master/docs/how_to/hypervisors/ec2.md +# +HOSTS: + ubuntu-1604-x64: + roles: + - master + platform: ubuntu-16.04-amd64 + hypervisor: ec2 + # refers to image_tempaltes.yaml AMI[vmname] entry: + vmname: ubuntu-1604-eu-central-1 + # refers to image_tempaltes.yaml entry inside AMI[vmname][:image]: + snapshot: aio + # t2.micro is free tier eligible (https://aws.amazon.com/en/free/): + amisize: t2.micro + # required so that beaker sanitizes sshd_config and root authorized_keys: + user: ubuntu +CONFIG: + type: aio + :ec2_yaml: spec/acceptance/nodesets/ec2/image_templates.yaml +... +# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/ec2/windows-2016-base-x64.yml b/spec/acceptance/nodesets/ec2/windows-2016-base-x64.yml new file mode 100644 index 000000000..36bd9891f --- /dev/null +++ b/spec/acceptance/nodesets/ec2/windows-2016-base-x64.yml @@ -0,0 +1,29 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +# +# Additional ~/.fog config file with AWS EC2 credentials +# required. +# +# see: https://github.com/puppetlabs/beaker/blob/master/docs/how_to/hypervisors/ec2.md +# +HOSTS: + windows-2016-base-x64: + roles: + - master + platform: windows-2016-64 + hypervisor: ec2 + # refers to image_tempaltes.yaml AMI[vmname] entry: + vmname: windows-2016-base-eu-central-1 + # refers to image_tempaltes.yaml entry inside AMI[vmname][:image]: + snapshot: aio + # t2.micro is free tier eligible (https://aws.amazon.com/en/free/): + amisize: t2.micro + # required so that beaker sanitizes sshd_config and root authorized_keys: + user: ec2-user +CONFIG: + type: aio + :ec2_yaml: spec/acceptance/nodesets/ec2/image_templates.yaml +... +# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/fedora-25-x64.yml b/spec/acceptance/nodesets/fedora-25-x64.yml index c3a3cbf59..60ae01179 100644 --- a/spec/acceptance/nodesets/fedora-25-x64.yml +++ b/spec/acceptance/nodesets/fedora-25-x64.yml @@ -9,7 +9,7 @@ HOSTS: fedora-25-x64: roles: - master - platform: fedora-24-x86_64 + platform: fedora-25-x86_64 box: fedora/25-cloud-base hypervisor: vagrant CONFIG: From 8c5cc83c836c638a0c6a26e7f022fbd7c1735d45 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sun, 12 Feb 2017 01:35:18 +0100 Subject: [PATCH 10/28] delete unneeded spec.opts file --- spec/spec.opts | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 spec/spec.opts diff --git a/spec/spec.opts b/spec/spec.opts deleted file mode 100644 index 91cd6427e..000000000 --- a/spec/spec.opts +++ /dev/null @@ -1,6 +0,0 @@ ---format -s ---colour ---loadby -mtime ---backtrace From 956087609b3ffc7efe76c27bc58d206b6fe7df71 Mon Sep 17 00:00:00 2001 From: Dennis Hoppe Date: Fri, 3 Feb 2017 21:56:21 +0100 Subject: [PATCH 11/28] Add missing license --- LICENSE | 202 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 202 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 000000000..8f71f43fe --- /dev/null +++ b/LICENSE @@ -0,0 +1,202 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + 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. + From 0ac6b922ac7201248bd5ad13824d1f760651fb8c Mon Sep 17 00:00:00 2001 From: Dennis Hoppe Date: Fri, 3 Feb 2017 22:19:47 +0100 Subject: [PATCH 12/28] Add missing values --- metadata.json | 64 ++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 46 insertions(+), 18 deletions(-) diff --git a/metadata.json b/metadata.json index 49eace5dc..ba3211f29 100644 --- a/metadata.json +++ b/metadata.json @@ -1,31 +1,59 @@ { - "author": "Virgil Chereches", + "name": "puppet-prometheus", + "version": "0.2.0", + "author": "Vox Pupuli", + "summary": "This module installs, configures and manages the Prometheus service.", + "license": "Apache-2.0", + "source": "https://github.com/voxpupuli/puppet-prometheus.git", + "project_page": "https://github.com/voxpupuli/puppet-prometheus", + "issue_url": "https://github.com/voxpupuli/puppet-prometheus/issues", "dependencies": [ - { - "name":"puppetlabs/stdlib", - "version_requirement":">= 4.6.0 <5.0.0" - }, { "name":"puppet/staging", "version_requirement":">=1.0.7 <3.0.0" + }, + { + "name":"puppetlabs/stdlib", + "version_requirement":">= 4.6.0 <5.0.0" } ], - "license": "Apache-2.0", - "name": "brutus777-prometheus", "operatingsystem_support": [ - { + { + "operatingsystem": "Debian", + "operatingsystemrelease": [ + "7", + "8" + ] + }, + { + "operatingsystem": "Ubuntu", + "operatingsystemrelease": [ + "14.04", + "16.04" + ] + }, + { + "operatingsystem": "CentOS", "operatingsystemrelease": [ - "5", "6", "7" - ], - "operatingsystem": "RedHat" + ] + }, + { + "operatingsystem": "RedHat", + "operatingsystemrelease": [ + "6", + "7" + ] + } + ], + "requirements": [ + { + "name": "puppet", + "version_requirements": "=> 4.6.1 < 5.0.0" } - ], - "project_page": "https://github.com/brutus333/puppet-prometheus", - "requirements": [], - "source": "https://github.com/brutus333/puppet-prometheus", - "summary": "Prometheus Puppet module", - "tags": [], - "version": "0.2.0" + ], + "tags": [ + "prometheus" + ] } From 1949521fbb37942c9e08d926167f51a35c357bf1 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sat, 11 Mar 2017 01:08:19 +0100 Subject: [PATCH 13/28] modulesync 0.20.1 --- .msync.yml | 2 +- Rakefile | 2 +- spec/acceptance/nodesets/docker/centos-7.yml | 1 + spec/acceptance/nodesets/docker/debian-8.yml | 1 + spec/acceptance/nodesets/ec2/amazonlinux-2016091.yml | 2 +- spec/acceptance/nodesets/ec2/image_templates.yaml | 2 +- spec/acceptance/nodesets/ec2/rhel-73-x64.yml | 2 +- spec/acceptance/nodesets/ec2/sles-12sp2-x64.yml | 2 +- spec/acceptance/nodesets/ec2/ubuntu-1604-x64.yml | 2 +- spec/acceptance/nodesets/ec2/windows-2016-base-x64.yml | 2 +- 10 files changed, 10 insertions(+), 8 deletions(-) diff --git a/.msync.yml b/.msync.yml index d03e57009..a8e6a4ee7 100644 --- a/.msync.yml +++ b/.msync.yml @@ -1 +1 @@ -modulesync_config_version: '0.20.0' +modulesync_config_version: '0.20.1' diff --git a/Rakefile b/Rakefile index 2def02fad..82c896088 100644 --- a/Rakefile +++ b/Rakefile @@ -35,7 +35,7 @@ begin require 'github_changelog_generator/task' GitHubChangelogGenerator::RakeTask.new :changelog do |config| version = (Blacksmith::Modulefile.new).version - config.future_release = "#{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} end diff --git a/spec/acceptance/nodesets/docker/centos-7.yml b/spec/acceptance/nodesets/docker/centos-7.yml index 85e9d63c3..41e924b50 100644 --- a/spec/acceptance/nodesets/docker/centos-7.yml +++ b/spec/acceptance/nodesets/docker/centos-7.yml @@ -11,6 +11,7 @@ HOSTS: docker_cmd: '["/usr/sbin/init"]' docker_image_commands: - 'yum install -y crontabs initscripts iproute openssl sysvinit-tools tar wget which ss' + - 'systemctl mask getty@tty1.service' CONFIG: trace_limit: 200 masterless: true diff --git a/spec/acceptance/nodesets/docker/debian-8.yml b/spec/acceptance/nodesets/docker/debian-8.yml index 500bee522..7a1f35c37 100644 --- a/spec/acceptance/nodesets/docker/debian-8.yml +++ b/spec/acceptance/nodesets/docker/debian-8.yml @@ -13,6 +13,7 @@ HOSTS: - 'echo deb http://ftp.debian.org/debian jessie-backports main >> /etc/apt/sources.list' - 'apt-get update && apt-get install -y cron locales-all net-tools wget' - 'rm -f /usr/sbin/policy-rc.d' + - 'systemctl mask getty@tty1.service getty-static.service' CONFIG: trace_limit: 200 masterless: true diff --git a/spec/acceptance/nodesets/ec2/amazonlinux-2016091.yml b/spec/acceptance/nodesets/ec2/amazonlinux-2016091.yml index 3f064f0a9..19dd43ed7 100644 --- a/spec/acceptance/nodesets/ec2/amazonlinux-2016091.yml +++ b/spec/acceptance/nodesets/ec2/amazonlinux-2016091.yml @@ -2,7 +2,7 @@ # This file is managed via modulesync # https://github.com/voxpupuli/modulesync # https://github.com/voxpupuli/modulesync_config -# +# # Additional ~/.fog config file with AWS EC2 credentials # required. # diff --git a/spec/acceptance/nodesets/ec2/image_templates.yaml b/spec/acceptance/nodesets/ec2/image_templates.yaml index 9a277d812..e50593ee0 100644 --- a/spec/acceptance/nodesets/ec2/image_templates.yaml +++ b/spec/acceptance/nodesets/ec2/image_templates.yaml @@ -7,7 +7,7 @@ # Hint: image IDs (ami-*) for the same image are different per location. # AMI: - # Amazon Linux AMI 2016.09.1 (HVM), SSD Volume Type + # Amazon Linux AMI 2016.09.1 (HVM), SSD Volume Type amazonlinux-2016091-eu-central-1: :image: :aio: ami-af0fc0c0 diff --git a/spec/acceptance/nodesets/ec2/rhel-73-x64.yml b/spec/acceptance/nodesets/ec2/rhel-73-x64.yml index cd0521e7c..7fac8236a 100644 --- a/spec/acceptance/nodesets/ec2/rhel-73-x64.yml +++ b/spec/acceptance/nodesets/ec2/rhel-73-x64.yml @@ -2,7 +2,7 @@ # This file is managed via modulesync # https://github.com/voxpupuli/modulesync # https://github.com/voxpupuli/modulesync_config -# +# # Additional ~/.fog config file with AWS EC2 credentials # required. # diff --git a/spec/acceptance/nodesets/ec2/sles-12sp2-x64.yml b/spec/acceptance/nodesets/ec2/sles-12sp2-x64.yml index a14bea6cd..8542154df 100644 --- a/spec/acceptance/nodesets/ec2/sles-12sp2-x64.yml +++ b/spec/acceptance/nodesets/ec2/sles-12sp2-x64.yml @@ -2,7 +2,7 @@ # This file is managed via modulesync # https://github.com/voxpupuli/modulesync # https://github.com/voxpupuli/modulesync_config -# +# # Additional ~/.fog config file with AWS EC2 credentials # required. # diff --git a/spec/acceptance/nodesets/ec2/ubuntu-1604-x64.yml b/spec/acceptance/nodesets/ec2/ubuntu-1604-x64.yml index 21ce560ac..9cf59d59e 100644 --- a/spec/acceptance/nodesets/ec2/ubuntu-1604-x64.yml +++ b/spec/acceptance/nodesets/ec2/ubuntu-1604-x64.yml @@ -2,7 +2,7 @@ # This file is managed via modulesync # https://github.com/voxpupuli/modulesync # https://github.com/voxpupuli/modulesync_config -# +# # Additional ~/.fog config file with AWS EC2 credentials # required. # diff --git a/spec/acceptance/nodesets/ec2/windows-2016-base-x64.yml b/spec/acceptance/nodesets/ec2/windows-2016-base-x64.yml index 36bd9891f..0932e29c8 100644 --- a/spec/acceptance/nodesets/ec2/windows-2016-base-x64.yml +++ b/spec/acceptance/nodesets/ec2/windows-2016-base-x64.yml @@ -2,7 +2,7 @@ # This file is managed via modulesync # https://github.com/voxpupuli/modulesync # https://github.com/voxpupuli/modulesync_config -# +# # Additional ~/.fog config file with AWS EC2 credentials # required. # From db976b21298bfcd29dde8781b206290eff8c161f Mon Sep 17 00:00:00 2001 From: Joshua Spence Date: Mon, 30 Jan 2017 08:40:15 +1100 Subject: [PATCH 14/28] Add sane default values for `prometheus::daemon` Adds some sane default values for parameters of `prometheus::daemon`. This makes it easier to use this class with the default values. --- manifests/daemon.pp | 274 ++++++++++++++++++++++---------------------- 1 file changed, 138 insertions(+), 136 deletions(-) diff --git a/manifests/daemon.pp b/manifests/daemon.pp index 97aac1dbc..ca605b9df 100644 --- a/manifests/daemon.pp +++ b/manifests/daemon.pp @@ -1,165 +1,167 @@ define prometheus::daemon ( - $install_method, $version, - $download_extension, - $os, - $arch, $real_download_url, - $bin_dir, $notify_service, - $package_name, - $package_ensure, - $manage_user, $user, - $extra_groups, $group, - $manage_group, - $purge, - $options, - $init_style, - $service_ensure, - $service_enable, - $manage_service, - ) { - case $install_method { - 'url': { - include ::staging - $staging_file = "${name}-${version}.${download_extension}" - $binary = "${::staging::path}/${name}-${version}.${os}-${arch}/${name}" - staging::file { $staging_file: - source => $real_download_url, - } -> - staging::extract { $staging_file: - target => $::staging::path, - creates => $binary, - } -> - file { $binary: - owner => 'root', - group => 0, # 0 instead of root because OS X uses "wheel". - mode => '0555', - } -> - file { "${bin_dir}/${name}": - ensure => link, - notify => $notify_service, - target => $binary, - } + + $install_method = $prometheus::params::install_method, + $download_extension = $prometheus::params::download_extension, + $os = $prometheus::params::os, + $arch = $prometheus::params::arch, + $bin_dir = $prometheus::params::bin_dir, + $package_name = undef, + $package_ensure = undef, + $manage_user = true, + $extra_groups = [], + $manage_group = true, + $purge = true, + $options = '', + $init_style = $prometheus::params::init_style, + $service_ensure = 'running', + $service_enable = true, + $manage_service = true, +) { + + case $install_method { + 'url': { + include ::staging + $staging_file = "${name}-${version}.${download_extension}" + $binary = "${::staging::path}/${name}-${version}.${os}-${arch}/${name}" + staging::file { $staging_file: + source => $real_download_url, + } -> + staging::extract { $staging_file: + target => $::staging::path, + creates => $binary, + } -> + file { $binary: + owner => 'root', + group => 0, # 0 instead of root because OS X uses "wheel". + mode => '0555', + } -> + file { "${bin_dir}/${name}": + ensure => link, + notify => $notify_service, + target => $binary, } - 'package': { - package { $package_name: - ensure => $package_ensure, - } - if $manage_user { - User[$user] -> Package[$package_name] - } + } + 'package': { + package { $package_name: + ensure => $package_ensure, } - 'none': {} - default: { - fail("The provided install method ${install_method} is invalid") + if $manage_user { + User[$user] -> Package[$package_name] } } - if $manage_user { - ensure_resource('user', [ $user ], { - ensure => 'present', - system => true, - groups => $extra_groups, - }) - - if $manage_group { - Group[$group] -> User[$user] - } + 'none': {} + default: { + fail("The provided install method ${install_method} is invalid") } + } + if $manage_user { + ensure_resource('user', [ $user ], { + ensure => 'present', + system => true, + groups => $extra_groups, + }) + if $manage_group { - ensure_resource('group', [ $group ], { - ensure => 'present', - system => true, - }) + Group[$group] -> User[$user] } + } + if $manage_group { + ensure_resource('group', [ $group ], { + ensure => 'present', + system => true, + }) + } - if $init_style { + if $init_style { - case $init_style { - 'upstart' : { - file { "/etc/init/${name}.conf": - mode => '0444', - owner => 'root', - group => 'root', - content => template('prometheus/daemon.upstart.erb'), - notify => $notify_service, - } - file { "/etc/init.d/${name}": - ensure => link, - target => '/lib/init/upstart-job', - owner => 'root', - group => 'root', - mode => '0755', - } + case $init_style { + 'upstart' : { + file { "/etc/init/${name}.conf": + mode => '0444', + owner => 'root', + group => 'root', + content => template('prometheus/daemon.upstart.erb'), + notify => $notify_service, } - 'systemd' : { - file { "/etc/systemd/system/${name}.service": - mode => '0644', - owner => 'root', - group => 'root', - content => template('prometheus/daemon.systemd.erb'), - }~> - exec { "${name}-systemd-reload": - command => 'systemctl daemon-reload', - path => [ '/usr/bin', '/bin', '/usr/sbin' ], - refreshonly => true, - notify => $notify_service, - } + file { "/etc/init.d/${name}": + ensure => link, + target => '/lib/init/upstart-job', + owner => 'root', + group => 'root', + mode => '0755', } - 'sysv' : { - file { "/etc/init.d/${name}": - mode => '0555', - owner => 'root', - group => 'root', - content => template('prometheus/daemon.sysv.erb'), - } + } + 'systemd' : { + file { "/etc/systemd/system/${name}.service": + mode => '0644', + owner => 'root', + group => 'root', + content => template('prometheus/daemon.systemd.erb'), + }~> + exec { "${name}-systemd-reload": + command => 'systemctl daemon-reload', + path => [ '/usr/bin', '/bin', '/usr/sbin' ], + refreshonly => true, + notify => $notify_service, } - 'debian' : { - file { "/etc/init.d/${name}": - mode => '0555', - owner => 'root', - group => 'root', - content => template('prometheus/daemon.debian.erb'), - notify => $notify_service, - } + } + 'sysv' : { + file { "/etc/init.d/${name}": + mode => '0555', + owner => 'root', + group => 'root', + content => template('prometheus/daemon.sysv.erb'), } - 'sles' : { - file { "/etc/init.d/${name}": - mode => '0555', - owner => 'root', - group => 'root', - content => template('prometheus/daemon.sles.erb'), - notify => $notify_service, - } + } + 'debian' : { + file { "/etc/init.d/${name}": + mode => '0555', + owner => 'root', + group => 'root', + content => template('prometheus/daemon.debian.erb'), + notify => $notify_service, } - 'launchd' : { - file { "/Library/LaunchDaemons/io.${name}.daemon.plist": - mode => '0644', - owner => 'root', - group => 'wheel', - content => template('prometheus/daemon.launchd.erb'), - notify => $notify_service, - } + } + 'sles' : { + file { "/etc/init.d/${name}": + mode => '0555', + owner => 'root', + group => 'root', + content => template('prometheus/daemon.sles.erb'), + notify => $notify_service, } - default : { - fail("I don't know how to create an init script for style ${init_style}") + } + 'launchd' : { + file { "/Library/LaunchDaemons/io.${name}.daemon.plist": + mode => '0644', + owner => 'root', + group => 'wheel', + content => template('prometheus/daemon.launchd.erb'), + notify => $notify_service, } } + default : { + fail("I don't know how to create an init script for style ${init_style}") + } } + } - $init_selector = $init_style ? { - 'launchd' => "io.${name}.daemon", - default => $name, - } + $init_selector = $init_style ? { + 'launchd' => "io.${name}.daemon", + default => $name, + } - if $manage_service == true { - service { $name: - ensure => $service_ensure, - name => $init_selector, - enable => $service_enable, - } + if $manage_service == true { + service { $name: + ensure => $service_ensure, + name => $init_selector, + enable => $service_enable, } } +} From f996627f346da4e3c272307f08dc76630f6dc88a Mon Sep 17 00:00:00 2001 From: Florian Date: Mon, 13 Mar 2017 10:33:39 +0100 Subject: [PATCH 15/28] process-exporter (#14) --- manifests/params.pp | 9 ++ manifests/process_exporter.pp | 144 ++++++++++++++++++++++++++++ templates/process-exporter.yaml.erb | 2 + 3 files changed, 155 insertions(+) create mode 100644 manifests/process_exporter.pp create mode 100644 templates/process-exporter.yaml.erb diff --git a/manifests/params.pp b/manifests/params.pp index fa4bc8e52..4139ecdd8 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -38,6 +38,15 @@ $haproxy_exporter_package_name = 'haproxy_exporter' $haproxy_exporter_user = 'haproxy-user' $haproxy_exporter_version = '0.7.1' + $process_exporter_download_extension = 'tar.gz' + $process_exporter_download_url_base = 'https://github.com/ncabatoff/process-exporter/releases' + $process_exporter_extra_groups = [] + $process_exporter_group = 'process-exporter' + $process_exporter_package_ensure = 'latest' + $process_exporter_package_name = 'process-exporter' + $process_exporter_user = 'process-exporter' + $process_exporter_version = '0.1.0' + $process_exporter_config_path = '/etc/process-exporter.yaml' $mysqld_exporter_cnf_config_path = '/etc/.my.cnf' $mysqld_exporter_cnf_host = 'localhost' $mysqld_exporter_cnf_password = 'password' diff --git a/manifests/process_exporter.pp b/manifests/process_exporter.pp new file mode 100644 index 000000000..cd82610da --- /dev/null +++ b/manifests/process_exporter.pp @@ -0,0 +1,144 @@ +# Class: prometheus::process_exporter +# +# This module manages prometheus process_exporter +# +# Parameters: +# [*arch*] +# Architecture (amd64 or i386) +# +# [*bin_dir*] +# Directory where binaries are located +# +# [*download_extension*] +# Extension for the release binary archive +# +# [*download_url*] +# Complete URL corresponding to the where the release binary archive can be downloaded +# +# [*download_url_base*] +# Base URL for the binary archive +# +# [*extra_groups*] +# Extra groups to add the binary user to +# +# [*extra_options*] +# Extra options added to the startup command +# +# [*group*] +# Group under which the binary is running +# +# [*init_style*] +# Service startup scripts style (e.g. rc, upstart or systemd) +# +# [*install_method*] +# Installation method: url or package (only url is supported currently) +# +# [*manage_group*] +# Whether to create a group for or rely on external code for that +# +# [*manage_service*] +# Should puppet manage the service? (default true) +# +# [*manage_user*] +# Whether to create user or rely on external code for that +# +# [*os*] +# Operating system (linux is the only one supported) +# +# [*package_ensure*] +# If package, then use this for package ensure default 'latest' +# +# [*package_name*] +# The binary package name - not available yet +# +# [*purge_config_dir*] +# Purge config files no longer generated by Puppet +# +# [*restart_on_change*] +# Should puppet restart the service on configuration change? (default true) +# +# [*service_enable*] +# Whether to enable the service from puppet (default true) +# +# [*service_ensure*] +# State ensured for the service (default 'running') +# +# [*user*] +# User which runs the service +# +# [*version*] +# The binary release version +class prometheus::process_exporter( + $arch = $::prometheus::params::arch, + $bin_dir = $::prometheus::params::bin_dir, + $download_extension = $::prometheus::params::process_exporter_download_extension, + $download_url = undef, + $download_url_base = $::prometheus::params::process_exporter_download_url_base, + $extra_groups = $::prometheus::params::process_exporter_extra_groups, + $extra_options = '', + $config_mode = $::prometheus::params::config_mode, + $group = $::prometheus::params::process_exporter_group, + $init_style = $::prometheus::params::init_style, + $install_method = $::prometheus::params::install_method, + $manage_group = true, + $manage_service = true, + $manage_user = true, + $os = $::prometheus::params::os, + $package_ensure = $::prometheus::params::process_exporter_package_ensure, + $package_name = $::prometheus::params::process_exporter_package_name, + $purge_config_dir = true, + $restart_on_change = true, + $service_enable = true, + $service_ensure = 'running', + $user = $::prometheus::params::process_exporter_user, + $version = $::prometheus::params::process_exporter_version, + $config_path = $::prometheus::params::process_exporter_config_path, + $watched_processes = [] +) inherits prometheus::params { + + $real_download_url = pick($download_url,"${download_url_base}/download/v${version}/${package_name}-${version}.${os}-${arch}.${download_extension}") + validate_bool($purge_config_dir) + validate_bool($manage_user) + validate_bool($manage_service) + validate_bool($restart_on_change) + $notify_service = $restart_on_change ? { + true => Service['process-exporter'], + default => undef, + } + + file { $config_path: + ensure => 'file', + mode => $config_mode, + owner => $user, + group => $group, + content => template('prometheus/process-exporter.yaml.erb'), + notify => $notify_service, + } + + $options = "-config.path=${config_path} ${extra_options}" + + prometheus::daemon { 'process-exporter': + install_method => $install_method, + version => $version, + download_extension => $download_extension, + os => $os, + arch => $arch, + real_download_url => $real_download_url, + bin_dir => $bin_dir, + notify_service => $notify_service, + package_name => $package_name, + package_ensure => $package_ensure, + manage_user => $manage_user, + user => $user, + extra_groups => $extra_groups, + group => $group, + manage_group => $manage_group, + purge => $purge_config_dir, + options => $options, + init_style => $init_style, + service_ensure => $service_ensure, + service_enable => $service_enable, + manage_service => $manage_service, + } + +} diff --git a/templates/process-exporter.yaml.erb b/templates/process-exporter.yaml.erb new file mode 100644 index 000000000..e7c9dbfda --- /dev/null +++ b/templates/process-exporter.yaml.erb @@ -0,0 +1,2 @@ +<% require 'yaml' -%> +<%= {"process_names" => @watched_processes}.to_yaml %> From f969e4e6d6b2b03caeb94f64ee720e0a9242aec4 Mon Sep 17 00:00:00 2001 From: brutus333 Date: Mon, 13 Mar 2017 12:50:43 +0200 Subject: [PATCH 16/28] Update metadata.json (#20) * Update metadata.json * Added process_exporter * Update README.md --- README.md | 1 + examples/init.pp | 1 + metadata.json | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 77940169b..8adaaf7f8 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,7 @@ This module automates the install and configuration of Prometheus monitoring too * Installs a configuration file for prometheus daemon (/etc/prometheus/prometheus.yaml) or for alertmanager (/etc/prometheus/alert.rules) * Manages the services via upstart, sysv, or systemd * Optionally creates alert rules +* The following exporters are currently implemented: node_exporter, statsd_exporter, process_exporter, haproxy_exporter, mysqld_exporter ## Usage diff --git a/examples/init.pp b/examples/init.pp index 7901748ac..5aa5a78f4 100644 --- a/examples/init.pp +++ b/examples/init.pp @@ -3,3 +3,4 @@ include ::prometheus::alertmanager include ::prometheus::alerts include ::prometheus::statsd_exporter +include ::prometheus::process_exporter diff --git a/metadata.json b/metadata.json index ba3211f29..a4dccf3d3 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppet-prometheus", - "version": "0.2.0", + "version": "0.2.4", "author": "Vox Pupuli", "summary": "This module installs, configures and manages the Prometheus service.", "license": "Apache-2.0", From d671842fdf0c8b83bbb72f428e122d2eedd86f6d Mon Sep 17 00:00:00 2001 From: Dennis Hoppe Date: Sun, 26 Mar 2017 11:04:51 +0200 Subject: [PATCH 17/28] Update to latest available versions --- manifests/params.pp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/manifests/params.pp b/manifests/params.pp index 4139ecdd8..cfc498997 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -16,7 +16,7 @@ $alertmanager_storage_path='/var/lib/alertmanager' $alertmanager_templates = [ "${alertmanager_config_dir}/*.tmpl" ] $alertmanager_user = 'alertmanager' - $alertmanager_version = '0.3.0' + $alertmanager_version = '0.5.1' $alerts = [] $bin_dir = '/usr/local/bin' $config_dir = '/etc/prometheus' @@ -68,7 +68,7 @@ $node_exporter_package_ensure = 'latest' $node_exporter_package_name = 'node_exporter' $node_exporter_user = 'node-exporter' - $node_exporter_version = '0.13.0' + $node_exporter_version = '0.14.0' $package_ensure = 'latest' $package_name = 'prometheus' $rule_files = [ "${config_dir}/alert.rules" ] @@ -85,7 +85,7 @@ $statsd_exporter_user = 'statsd-exporter' $statsd_exporter_version = '0.3.0' $user = 'prometheus' - $version = '1.0.1' + $version = '1.5.2' case $::architecture { 'x86_64', 'amd64': { $arch = 'amd64' } 'i386': { $arch = '386' } From f59f5292a14915e21970858e17543de12aabca02 Mon Sep 17 00:00:00 2001 From: Dennis Hoppe Date: Sun, 26 Mar 2017 11:59:12 +0200 Subject: [PATCH 18/28] Migrate to archive module --- .fixtures.yml | 2 +- README.md | 2 +- manifests/daemon.pp | 21 ++++++++++----------- manifests/install.pp | 26 ++++++++++++-------------- metadata.json | 4 ++-- spec/classes/haproxy_exporter_spec.rb | 6 ++---- spec/classes/node_exporter_spec.rb | 6 ++---- 7 files changed, 30 insertions(+), 37 deletions(-) diff --git a/.fixtures.yml b/.fixtures.yml index c57d09d38..2fd3ba85c 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -1,6 +1,6 @@ fixtures: repositories: + archive: "https://github.com/voxpupuli/puppet-archive" stdlib: "https://github.com/puppetlabs/puppetlabs-stdlib" - staging: "https://github.com/voxpupuli/puppet-staging" symlinks: "prometheus": "#{source_dir}" diff --git a/README.md b/README.md index 8adaaf7f8..47dc5096e 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ On the server (for prometheus version >= 1.0.0): class { 'prometheus': version => '1.0.0', scrape_configs => [ {'job_name'=>'prometheus','scrape_interval'=> '30s','scrape_timeout'=>'30s','static_configs'=> [{'targets'=>['localhost:9090'], 'labels'=> { 'alias'=>'Prometheus'}}]}], - extra_options => '-alertmanager.url http://localhost:9093 -web.console.templates=/opt/staging/prometheus-1.0.0.linux-amd64/consoles -web.console.libraries=/opt/staging/prometheus-1.0.0.linux-amd64/console_libraries', + extra_options => '-alertmanager.url http://localhost:9093 -web.console.templates=/opt/prometheus-1.0.0.linux-amd64/consoles -web.console.libraries=/opt/prometheus-1.0.0.linux-amd64/console_libraries', localstorage => '/prometheus/prometheus', } ``` diff --git a/manifests/daemon.pp b/manifests/daemon.pp index ca605b9df..cb0efe5a3 100644 --- a/manifests/daemon.pp +++ b/manifests/daemon.pp @@ -25,17 +25,16 @@ case $install_method { 'url': { - include ::staging - $staging_file = "${name}-${version}.${download_extension}" - $binary = "${::staging::path}/${name}-${version}.${os}-${arch}/${name}" - staging::file { $staging_file: - source => $real_download_url, + archive { "/tmp/${name}-${version}.${download_extension}": + ensure => present, + extract => true, + extract_path => '/opt', + source => $real_download_url, + checksum_verify => false, + creates => "/opt/${name}-${version}.${os}-${arch}/${name}", + cleanup => true, } -> - staging::extract { $staging_file: - target => $::staging::path, - creates => $binary, - } -> - file { $binary: + file { "/opt/${name}-${version}.${os}-${arch}/${name}": owner => 'root', group => 0, # 0 instead of root because OS X uses "wheel". mode => '0555', @@ -43,7 +42,7 @@ file { "${bin_dir}/${name}": ensure => link, notify => $notify_service, - target => $binary, + target => "/opt/${name}-${version}.${os}-${arch}/${name}", } } 'package': { diff --git a/manifests/install.pp b/manifests/install.pp index d35668617..1e587b5df 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -15,26 +15,24 @@ } case $::prometheus::install_method { 'url': { - include ::staging - staging::file { "prometheus-${prometheus::version}.${prometheus::download_extension}": - source => $prometheus::real_download_url, - } -> - file { "${::staging::path}/prometheus-${prometheus::version}": - ensure => directory, - } -> - staging::extract { "prometheus-${prometheus::version}.${prometheus::download_extension}": - target => $::staging::path, - creates => "${::staging::path}/prometheus-${prometheus::version}.${prometheus::os}-${prometheus::arch}/prometheus", + archive { "/tmp/prometheus-${prometheus::version}.${prometheus::download_extension}": + ensure => present, + extract => true, + extract_path => '/opt', + source => $prometheus::real_download_url, + checksum_verify => false, + creates => "/opt/prometheus-${prometheus::version}.${prometheus::os}-${prometheus::arch}/prometheus", + cleanup => true, } -> file { - "${::staging::path}/prometheus-${prometheus::version}.${prometheus::os}-${prometheus::arch}/prometheus": + "/opt/prometheus-${prometheus::version}.${prometheus::os}-${prometheus::arch}/prometheus": owner => 'root', group => 0, # 0 instead of root because OS X uses "wheel". mode => '0555'; "${::prometheus::bin_dir}/prometheus": ensure => link, notify => $::prometheus::notify_service, - target => "${::staging::path}/prometheus-${prometheus::version}.${prometheus::os}-${prometheus::arch}/prometheus"; + target => "/opt/prometheus-${prometheus::version}.${prometheus::os}-${prometheus::arch}/prometheus"; $::prometheus::shared_dir: ensure => directory, owner => $::prometheus::user, @@ -43,11 +41,11 @@ "${::prometheus::shared_dir}/consoles": ensure => link, notify => $::prometheus::notify_service, - target => "${::staging::path}/prometheus-${prometheus::version}.${prometheus::os}-${prometheus::arch}/consoles"; + target => "/opt/prometheus-${prometheus::version}.${prometheus::os}-${prometheus::arch}/consoles"; "${::prometheus::shared_dir}/console_libraries": ensure => link, notify => $::prometheus::notify_service, - target => "${::staging::path}/prometheus-${prometheus::version}.${prometheus::os}-${prometheus::arch}/console_libraries"; + target => "/opt/prometheus-${prometheus::version}.${prometheus::os}-${prometheus::arch}/console_libraries"; } } 'package': { diff --git a/metadata.json b/metadata.json index a4dccf3d3..4539ebfb4 100644 --- a/metadata.json +++ b/metadata.json @@ -9,8 +9,8 @@ "issue_url": "https://github.com/voxpupuli/puppet-prometheus/issues", "dependencies": [ { - "name":"puppet/staging", - "version_requirement":">=1.0.7 <3.0.0" + "name":"puppet/archive", + "version_requirement":">=1.3.0 <2.0.0" }, { "name":"puppetlabs/stdlib", diff --git a/spec/classes/haproxy_exporter_spec.rb b/spec/classes/haproxy_exporter_spec.rb index 9ae0a89d3..ceb0ed781 100644 --- a/spec/classes/haproxy_exporter_spec.rb +++ b/spec/classes/haproxy_exporter_spec.rb @@ -4,9 +4,7 @@ on_supported_os.each do |os, facts| context "on #{os}" do let(:facts) do - facts.merge( - staging_http_get: 'curl' - ) + facts end context 'with version specified' do @@ -18,7 +16,7 @@ } end describe 'install correct binary' do - it { is_expected.to contain_file('/usr/local/bin/haproxy_exporter').with('target' => '/opt/staging/haproxy_exporter-0.7.1.linux-amd64/haproxy_exporter') } + it { is_expected.to contain_file('/usr/local/bin/haproxy_exporter').with('target' => '/opt/haproxy_exporter-0.7.1.linux-amd64/haproxy_exporter') } end end end diff --git a/spec/classes/node_exporter_spec.rb b/spec/classes/node_exporter_spec.rb index e5ed2b7e5..05159e22f 100644 --- a/spec/classes/node_exporter_spec.rb +++ b/spec/classes/node_exporter_spec.rb @@ -4,9 +4,7 @@ on_supported_os.each do |os, facts| context "on #{os}" do let(:facts) do - facts.merge( - staging_http_get: 'curl' - ) + facts end context 'with version specified' do @@ -18,7 +16,7 @@ } end describe 'install correct binary' do - it { is_expected.to contain_file('/usr/local/bin/node_exporter').with('target' => '/opt/staging/node_exporter-0.13.0.linux-amd64/node_exporter') } + it { is_expected.to contain_file('/usr/local/bin/node_exporter').with('target' => '/opt/node_exporter-0.13.0.linux-amd64/node_exporter') } end end end From 2d07395a144718ed41913a0b61858a5cd8704193 Mon Sep 17 00:00:00 2001 From: Dennis Hoppe Date: Sun, 26 Mar 2017 17:50:05 +0200 Subject: [PATCH 19/28] Bump version --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index 4539ebfb4..694147e3c 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppet-prometheus", - "version": "0.2.4", + "version": "1.0.0", "author": "Vox Pupuli", "summary": "This module installs, configures and manages the Prometheus service.", "license": "Apache-2.0", From 50f8dc4d9e1f233e43d927959d12ec448852cc08 Mon Sep 17 00:00:00 2001 From: Dennis Hoppe Date: Sun, 26 Mar 2017 17:44:57 +0200 Subject: [PATCH 20/28] Use same namespace for Prometheus and its components --- manifests/config.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/config.pp b/manifests/config.pp index 41adae38b..b257eba79 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -27,7 +27,7 @@ } } 'systemd' : { - file { '/lib/systemd/system/prometheus.service': + file { '/etc/systemd/system/prometheus.service': mode => '0644', owner => 'root', group => 'root', From de074ec1080bc5344e8d69be67f73f89edb0bde5 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Fri, 31 Mar 2017 10:40:54 +0200 Subject: [PATCH 21/28] puppet-lint: fix arrow_on_right_operand_line --- manifests/config.pp | 8 ++++---- manifests/daemon.pp | 12 ++++++------ manifests/init.pp | 15 +++++++-------- manifests/install.pp | 4 ++-- 4 files changed, 19 insertions(+), 20 deletions(-) diff --git a/manifests/config.pp b/manifests/config.pp index b257eba79..ef5a0083a 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -32,8 +32,8 @@ owner => 'root', group => 'root', content => template('prometheus/prometheus.systemd.erb'), - }~> - exec { 'prometheus-systemd-reload': + } + ~> exec { 'prometheus-systemd-reload': command => 'systemctl daemon-reload', path => [ '/usr/bin', '/bin', '/usr/sbin' ], refreshonly => true, @@ -83,8 +83,8 @@ group => $prometheus::group, purge => $purge, recurse => $purge, - } -> - file { 'prometheus.yaml': + } + -> file { 'prometheus.yaml': ensure => present, path => "${prometheus::config_dir}/prometheus.yaml", owner => $prometheus::user, diff --git a/manifests/daemon.pp b/manifests/daemon.pp index cb0efe5a3..a59d09664 100644 --- a/manifests/daemon.pp +++ b/manifests/daemon.pp @@ -33,13 +33,13 @@ checksum_verify => false, creates => "/opt/${name}-${version}.${os}-${arch}/${name}", cleanup => true, - } -> - file { "/opt/${name}-${version}.${os}-${arch}/${name}": + } + -> file { "/opt/${name}-${version}.${os}-${arch}/${name}": owner => 'root', group => 0, # 0 instead of root because OS X uses "wheel". mode => '0555', - } -> - file { "${bin_dir}/${name}": + } + -> file { "${bin_dir}/${name}": ensure => link, notify => $notify_service, target => "/opt/${name}-${version}.${os}-${arch}/${name}", @@ -102,8 +102,8 @@ owner => 'root', group => 'root', content => template('prometheus/daemon.systemd.erb'), - }~> - exec { "${name}-systemd-reload": + } + ~> exec { "${name}-systemd-reload": command => 'systemctl daemon-reload', path => [ '/usr/bin', '/bin', '/usr/sbin' ], refreshonly => true, diff --git a/manifests/init.pp b/manifests/init.pp index ca14dcf6c..0443aa53a 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -164,21 +164,20 @@ } anchor {'prometheus_first': } - -> - class { '::prometheus::install': } -> - class { '::prometheus::config': + -> class { '::prometheus::install': } + -> class { '::prometheus::config': global_config => $global_config, rule_files => $rule_files, scrape_configs => $scrape_configs, purge => $purge_config_dir, notify => $notify_service, config_template => $config_template, - } -> - class { '::prometheus::alerts': + } + -> class { '::prometheus::alerts': location => $config_dir, alerts => $alerts, notify => $notify_service, - } -> - class { '::prometheus::run_service': } -> - anchor {'prometheus_last': } + } + -> class { '::prometheus::run_service': } + -> anchor {'prometheus_last': } } diff --git a/manifests/install.pp b/manifests/install.pp index 1e587b5df..125308c0d 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -23,8 +23,8 @@ checksum_verify => false, creates => "/opt/prometheus-${prometheus::version}.${prometheus::os}-${prometheus::arch}/prometheus", cleanup => true, - } -> - file { + } + -> file { "/opt/prometheus-${prometheus::version}.${prometheus::os}-${prometheus::arch}/prometheus": owner => 'root', group => 0, # 0 instead of root because OS X uses "wheel". From 20e66d90cf9bd22340f2d4f3819ca5e238dc5f1a Mon Sep 17 00:00:00 2001 From: Niko Smeds Date: Tue, 18 Apr 2017 15:30:05 -0700 Subject: [PATCH 22/28] Reload alertmanager when config file changes --- manifests/alertmanager.pp | 1 + 1 file changed, 1 insertion(+) diff --git a/manifests/alertmanager.pp b/manifests/alertmanager.pp index 5e6b4be21..4573ac312 100644 --- a/manifests/alertmanager.pp +++ b/manifests/alertmanager.pp @@ -193,6 +193,7 @@ group => $group, mode => $config_mode, content => template('prometheus/alertmanager.yaml.erb'), + notify => Service['alertmanager'], require => File[$config_dir], } From 3ae81b3b3adf958db1aa371678d941f55581d1e2 Mon Sep 17 00:00:00 2001 From: Steven Aerts Date: Wed, 10 May 2017 09:24:41 +0200 Subject: [PATCH 23/28] Support alerting configuration for prometheus --- manifests/init.pp | 13 +++++++++++-- manifests/params.pp | 2 ++ templates/prometheus.yaml.erb | 10 +++++++++- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 0443aa53a..f484c8a95 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -97,6 +97,12 @@ # [*scrape_configs*] # Prometheus scrape configs # +# [*alert_relabel_config*] +# Prometheus alert relabel config under alerting +# +# [*alertmanagers_config*] +# Prometheus managers config under alerting +# # Actions: # # Requires: see Modulefile @@ -136,8 +142,9 @@ $global_config = $::prometheus::params::global_config, $rule_files = $::prometheus::params::rule_files, $scrape_configs = $::prometheus::params::scrape_configs, - $alerts = $::prometheus::params::alerts - + $alerts = $::prometheus::params::alerts, + $alert_relabel_config = $::prometheus::params::alert_relabel_config, + $alertmanagers_config = $::prometheus::params::alertmanagers_config, ) inherits prometheus::params { if( versioncmp($::prometheus::version, '1.0.0') == -1 ){ $real_download_url = pick($download_url, @@ -155,6 +162,8 @@ validate_hash($global_config) validate_array($rule_files) validate_array($scrape_configs) + validate_array($alert_relabel_config) + validate_array($alertmanagers_config) $config_hash_real = deep_merge($config_defaults, $config_hash) validate_hash($config_hash_real) diff --git a/manifests/params.pp b/manifests/params.pp index cfc498997..0d8c680e6 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -1,6 +1,8 @@ # Class prometheus::params # Include default parameters for prometheus class class prometheus::params { + $alert_relabel_config = [] + $alertmanagers_config = [] $alertmanager_config_dir = '/etc/alertmanager' $alertmanager_config_file = "${alertmanager_config_dir}/alertmanager.yaml" $alertmanager_download_extension = 'tar.gz' diff --git a/templates/prometheus.yaml.erb b/templates/prometheus.yaml.erb index c7e9a30ec..9c06bc334 100644 --- a/templates/prometheus.yaml.erb +++ b/templates/prometheus.yaml.erb @@ -2,5 +2,13 @@ <% global_config = scope.lookupvar('::prometheus::global_config') -%> <% rule_files = scope.lookupvar('::prometheus::rule_files') -%> <% scrape_configs = scope.lookupvar('::prometheus::scrape_configs') -%> -<% full_config = { 'global'=>global_config, 'rule_files'=>rule_files, 'scrape_configs'=>scrape_configs } -%> +<% full_config = { + 'global'=>global_config, + 'rule_files'=>rule_files, + 'scrape_configs'=>scrape_configs, + 'alerting'=>{ + 'alert_relabel_configs'=>scope.lookupvar('::prometheus::alert_relabel_config'), + 'alertmanagers'=>scope.lookupvar('::prometheus::alertmanagers_config'), + } +} -%> <%= full_config.to_yaml -%> From fef32032cb7fe18391b6ad02d1b12e8bf0b8dcb0 Mon Sep 17 00:00:00 2001 From: Niko Smeds Date: Thu, 25 May 2017 14:23:24 -0700 Subject: [PATCH 24/28] Reload Prometheus service instead of restarting Reloading the Prometheus service is sufficient for configuration or alert changes. Currently restarting the service is causing Prometheus to enter `crash-recovery` mode on a regular basis. --- manifests/run_service.pp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/manifests/run_service.pp b/manifests/run_service.pp index ece7efba2..451e300a4 100644 --- a/manifests/run_service.pp +++ b/manifests/run_service.pp @@ -12,9 +12,11 @@ if $prometheus::manage_service == true { service { 'prometheus': - ensure => $prometheus::service_ensure, - name => $init_selector, - enable => $prometheus::service_enable, + ensure => $prometheus::service_ensure, + name => $init_selector, + enable => $prometheus::service_enable, + hasrestart => true, + restart => '/usr/bin/pkill -HUP prometheus', } } } From 566bed3c119680a4f4d92a188b24c88c7cf169cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20K=C3=B6rner?= Date: Tue, 30 May 2017 14:55:09 +0200 Subject: [PATCH 25/28] Add service_name parameter for alertmanager --- manifests/alertmanager.pp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/manifests/alertmanager.pp b/manifests/alertmanager.pp index 5e6b4be21..f8c8d6a76 100644 --- a/manifests/alertmanager.pp +++ b/manifests/alertmanager.pp @@ -114,6 +114,9 @@ # [*service_ensure*] # State ensured for the service (default 'running') # +# [*service_name*] +# Name of the alertmanager service (default 'alertmanager') +# # [*storage_path*] # The storage path to pass to the alertmanager. Defaults to '/var/lib/alertmanager' # @@ -153,6 +156,7 @@ $route = $::prometheus::params::alertmanager_route, $service_enable = true, $service_ensure = 'running', + $service_name = 'alertmanager', $storage_path = $::prometheus::params::alertmanager_storage_path, $templates = $::prometheus::params::alertmanager_templates, $user = $::prometheus::params::alertmanager_user, @@ -175,7 +179,7 @@ validate_hash($global) validate_hash($route) $notify_service = $restart_on_change ? { - true => Service['alertmanager'], + true => Service[$service_name], default => undef, } @@ -214,7 +218,7 @@ $options = "-config.file=${prometheus::alertmanager::config_file} ${prometheus::alertmanager::extra_options}" } - prometheus::daemon { 'alertmanager': + prometheus::daemon { $service_name: install_method => $install_method, version => $version, download_extension => $download_extension, From 6dfc009f9db204dfb3745c7949bc1133509b10c3 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Wed, 21 Jun 2017 13:47:03 +0200 Subject: [PATCH 26/28] Add param service_name (#40) Allow custom service name, e.g. Debian Package named service prometheus-node-exporter. --- manifests/node_exporter.pp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/manifests/node_exporter.pp b/manifests/node_exporter.pp index 94b4356f0..e1bcfce5c 100644 --- a/manifests/node_exporter.pp +++ b/manifests/node_exporter.pp @@ -67,6 +67,9 @@ # [*service_ensure*] # State ensured for the service (default 'running') # +# [*service_name*] +# Name of the node exporter service (default 'node_exporter') +# # [*user*] # User which runs the service # @@ -94,6 +97,7 @@ $restart_on_change = true, $service_enable = true, $service_ensure = 'running', + $service_name = 'node_exporter', $user = $::prometheus::params::node_exporter_user, $version = $::prometheus::params::node_exporter_version, ) inherits prometheus::params { @@ -111,14 +115,14 @@ validate_bool($restart_on_change) validate_array($collectors) $notify_service = $restart_on_change ? { - true => Service['node_exporter'], + true => Service[$service_name], default => undef, } $str_collectors = join($collectors, ',') $options = "-collectors.enabled=${str_collectors} ${extra_options}" - prometheus::daemon { 'node_exporter': + prometheus::daemon { $service_name : install_method => $install_method, version => $version, download_extension => $download_extension, From 407195d2955dbfb811c3f793a50e45a31ba3f920 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Wed, 21 Jun 2017 17:28:15 +0200 Subject: [PATCH 27/28] modulesync 0.21.3 --- .github/CONTRIBUTING.md | 4 ++ .gitignore | 1 + .msync.yml | 2 +- .overcommit.yml | 63 +++++++++++++++++++ .rspec_parallel | 1 + .rubocop.yml | 11 ++++ .travis.yml | 17 +++-- Gemfile | 17 ++--- spec/acceptance/nodesets/archlinux-2-x64.yml | 13 ++++ .../nodesets/docker/ubuntu-16.04.yml | 2 +- 10 files changed, 115 insertions(+), 16 deletions(-) create mode 100644 .overcommit.yml create mode 100644 .rspec_parallel create mode 100644 spec/acceptance/nodesets/archlinux-2-x64.yml diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 5574191a6..602f324b9 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -98,3 +98,7 @@ If you don't want to have to recreate the virtual machine every time you can use `BEAKER_DESTROY=no` and `BEAKER_PROVISION=no`. On the first run you will at least need `BEAKER_PROVISION` set to yes (the default). The Vagrantfile for the created virtual machines will be in `.vagrant/beaker_vagrant_fies`. + +The easiest way to debug in a docker container is to open a shell: + + docker exec -it -u root ${container_id_or_name} bash diff --git a/.gitignore b/.gitignore index 0d629b0c1..e9b3cf4bc 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,4 @@ Puppetfile.lock *.iml .*.sw? .yardoc/ +Guardfile diff --git a/.msync.yml b/.msync.yml index a8e6a4ee7..4abde2202 100644 --- a/.msync.yml +++ b/.msync.yml @@ -1 +1 @@ -modulesync_config_version: '0.20.1' +modulesync_config_version: '0.21.3' diff --git a/.overcommit.yml b/.overcommit.yml new file mode 100644 index 000000000..31699e747 --- /dev/null +++ b/.overcommit.yml @@ -0,0 +1,63 @@ +# Managed by https://github.com/voxpupuli/modulesync_configs +# +# Hooks are only enabled if you take action. +# +# To enable the hooks run: +# +# ``` +# bundle exec overcommit --install +# # ensure .overcommit.yml does not harm to you and then +# bundle exec overcommit --sign +# ``` +# +# (it will manage the .git/hooks directory): +# +# Examples howto skip a test for a commit or push: +# +# ``` +# SKIP=RuboCop git commit +# SKIP=PuppetLint git commit +# SKIP=RakeTask git push +# ``` +# +# Don't invoke overcommit at all: +# +# ``` +# OVERCOMMIT_DISABLE=1 git commit +# ``` +# +# Read more about overcommit: https://github.com/brigade/overcommit +# +# To manage this config yourself in your module add +# +# ``` +# .overcommit.yml: +# unmanaged: true +# ``` +# +# to your modules .sync.yml config +--- +PreCommit: + RuboCop: + enabled: true + description: 'Runs rubocop on modified files only' + command: ['bundle', 'exec', 'rubocop'] + PuppetLint: + enabled: true + description: 'Runs puppet-lint on modified files only' + command: ['bundle', 'exec', 'puppet-lint'] + YamlSyntax: + enabled: true + JsonSyntax: + enabled: true + TrailingWhitespace: + enabled: true + +PrePush: + RakeTarget: + enabled: true + description: 'Run rake targets' + targets: + - 'test' + - 'rubocop' + command: [ 'bundle', 'exec', 'rake' ] diff --git a/.rspec_parallel b/.rspec_parallel new file mode 100644 index 000000000..e4d136b75 --- /dev/null +++ b/.rspec_parallel @@ -0,0 +1 @@ +--format progress diff --git a/.rubocop.yml b/.rubocop.yml index ef85ceb41..d92e4e456 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -9,6 +9,9 @@ AllCops: - .vendor/**/* - pkg/**/* - spec/fixtures/**/* + - Gemfile + - Rakefile + - Guardfile Lint/ConditionPosition: Enabled: True @@ -500,6 +503,10 @@ Style/ClosingParenthesisIndentation: # RSpec +RSpec/BeforeAfterAll: + Exclude: + - spec/acceptance/**/* + # We don't use rspec in this way RSpec/DescribeClass: Enabled: False @@ -519,6 +526,10 @@ RSpec/RepeatedDescription: RSpec/NestedGroups: Enabled: False +# this is broken on ruby1.9 +Style/IndentHeredoc: + Enabled: False + # disable Yaml safe_load. This is needed to support ruby2.0.0 development envs Security/YAMLLoad: Enabled: false diff --git a/.travis.yml b/.travis.yml index 531ec6ba0..caa27c9e2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,6 @@ sudo: false dist: trusty language: ruby cache: bundler -bundler_args: --without system_tests development before_install: - bundle -v - rm Gemfile.lock || true @@ -17,16 +16,22 @@ matrix: fast_finish: true include: - rvm: 2.1.9 + bundler_args: --without system_tests development env: PUPPET_VERSION="~> 4.0" CHECK=test - - rvm: 2.2.6 + - rvm: 2.2.7 + bundler_args: --without system_tests development env: PUPPET_VERSION="~> 4.0" CHECK=test - - rvm: 2.3.3 + - rvm: 2.3.4 + bundler_args: --without system_tests development env: PUPPET_VERSION="~> 4.0" CHECK=test - - rvm: 2.4.0 + - rvm: 2.4.1 + bundler_args: --without system_tests development env: PUPPET_VERSION="~> 4.0" CHECK=test - - rvm: 2.4.0 + - rvm: 2.4.1 + bundler_args: --without system_tests development env: PUPPET_VERSION="~> 4.0" CHECK=rubocop - - rvm: 2.4.0 + - rvm: 2.4.1 + bundler_args: --without system_tests development env: PUPPET_VERSION="~> 4.0" CHECK=build DEPLOY_TO_FORGE=yes branches: only: diff --git a/Gemfile b/Gemfile index 2270de7dc..0914f7cbb 100644 --- a/Gemfile +++ b/Gemfile @@ -11,8 +11,7 @@ def location_for(place, fake_version = nil) end group :test do - gem 'puppetlabs_spec_helper', '~> 2.0.1', :require => false - gem 'parallel_tests', :require => false + gem 'puppetlabs_spec_helper', '~> 2.1.1', :require => false gem 'rspec-puppet', '~> 2.5', :require => false gem 'rspec-puppet-facts', :require => false gem 'rspec-puppet-utils', :require => false @@ -26,22 +25,24 @@ group :test do 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 'puppet-strings', '~> 1.0.0', :require => false + gem 'puppet-strings', '~> 1.0', :require => false gem 'redcarpet', :require => false - gem 'rubocop', '~> 0.47.0', :require => false if RUBY_VERSION >= '2.3.0' - gem 'rubocop-rspec', '~> 1.10.0', :require => false if RUBY_VERSION >= '2.3.0' + gem 'rubocop', '~> 0.48.0', :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 gem 'simplecov-console', :require => false gem 'github_changelog_generator', '~> 1.13.0', :require => false if RUBY_VERSION < '2.2.2' gem 'rack', '~> 1.0', :require => false if RUBY_VERSION < '2.2.2' gem 'github_changelog_generator', :require => false if RUBY_VERSION >= '2.2.2' + gem 'parallel_tests', :require => false end group :development do - gem 'travis', :require => false - gem 'travis-lint', :require => false - gem 'guard-rake', :require => false + gem 'travis', :require => false + gem 'travis-lint', :require => false + gem 'guard-rake', :require => false + gem 'overcommit', '~> 0.39.1', :require => false end group :system_tests do diff --git a/spec/acceptance/nodesets/archlinux-2-x64.yml b/spec/acceptance/nodesets/archlinux-2-x64.yml new file mode 100644 index 000000000..89b63003f --- /dev/null +++ b/spec/acceptance/nodesets/archlinux-2-x64.yml @@ -0,0 +1,13 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +HOSTS: + archlinux-2-x64: + roles: + - master + platform: archlinux-2-x64 + box: archlinux/archlinux + hypervisor: vagrant +CONFIG: + type: foss diff --git a/spec/acceptance/nodesets/docker/ubuntu-16.04.yml b/spec/acceptance/nodesets/docker/ubuntu-16.04.yml index 92a93cb73..bac2d5b34 100644 --- a/spec/acceptance/nodesets/docker/ubuntu-16.04.yml +++ b/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' + - 'apt-get install -y net-tools wget locales' - 'locale-gen en_US.UTF-8' CONFIG: trace_limit: 200 From d76e961dc4774a3cf6ab93f37106c75164e85211 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Wed, 21 Jun 2017 17:32:45 +0200 Subject: [PATCH 28/28] rubocop: autofixes --- spec/classes/haproxy_exporter_spec.rb | 1 + spec/classes/node_exporter_spec.rb | 1 + 2 files changed, 2 insertions(+) diff --git a/spec/classes/haproxy_exporter_spec.rb b/spec/classes/haproxy_exporter_spec.rb index ceb0ed781..e9bbddbad 100644 --- a/spec/classes/haproxy_exporter_spec.rb +++ b/spec/classes/haproxy_exporter_spec.rb @@ -15,6 +15,7 @@ os: 'linux' } end + describe 'install correct binary' do it { is_expected.to contain_file('/usr/local/bin/haproxy_exporter').with('target' => '/opt/haproxy_exporter-0.7.1.linux-amd64/haproxy_exporter') } end diff --git a/spec/classes/node_exporter_spec.rb b/spec/classes/node_exporter_spec.rb index 05159e22f..a4b38f500 100644 --- a/spec/classes/node_exporter_spec.rb +++ b/spec/classes/node_exporter_spec.rb @@ -15,6 +15,7 @@ os: 'linux' } end + describe 'install correct binary' do it { is_expected.to contain_file('/usr/local/bin/node_exporter').with('target' => '/opt/node_exporter-0.13.0.linux-amd64/node_exporter') } end