From 81b3ca695ae30b8496c04361966a73aae3836a0a Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 26 Sep 2016 09:56:36 +0200 Subject: [PATCH 1/7] modulesync 0.12.7 --- .github/CONTRIBUTING.md | 95 ++++ .github/ISSUE_TEMPLATE.md | 23 + .github/PULL_REQUEST_TEMPLATE.md | 5 + .gitignore | 20 +- .msync.yml | 1 + .rspec | 2 + .rubocop.yml | 509 ++++++++++++++++++ .travis.yml | 52 ++ .yardopts | 1 + Gemfile | 79 ++- Rakefile | 41 +- spec/acceptance/nodesets/centos-511-x64.yml | 6 +- spec/acceptance/nodesets/centos-66-x64-pe.yml | 14 + spec/acceptance/nodesets/centos-66-x64.yml | 5 +- spec/acceptance/nodesets/centos-72-x64.yml | 12 + spec/acceptance/nodesets/debian-78-x64.yml | 6 +- spec/acceptance/nodesets/debian-82-x64.yml | 12 + .../nodesets/ubuntu-server-1204-x64.yml | 12 + .../nodesets/ubuntu-server-1404-x64.yml | 12 + spec/classes/coverage_spec.rb | 3 + spec/default_facts.yml | 6 + spec/spec_helper.rb | 23 +- 22 files changed, 879 insertions(+), 60 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 .travis.yml create mode 100644 .yardopts create mode 100644 spec/acceptance/nodesets/centos-66-x64-pe.yml create mode 100644 spec/acceptance/nodesets/centos-72-x64.yml create mode 100644 spec/acceptance/nodesets/debian-82-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/default_facts.yml diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md new file mode 100644 index 00000000..5b09ea6c --- /dev/null +++ b/.github/CONTRIBUTING.md @@ -0,0 +1,95 @@ +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 + +## 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.5 with. + + BEAKER_set=centos-64-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 00000000..9ac4a2b0 --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,23 @@ + + +### 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 00000000..79272bf6 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,5 @@ + diff --git a/.gitignore b/.gitignore index ef5ea7e1..3c1af2d4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,14 @@ -.*.sw? -.bundle -.pkg -.ruby-version -.vagrant +pkg/ Gemfile.lock -modules/ -spec/fixtures +Gemfile.local +vendor/ +.vendor/ +spec/fixtures/manifests/ +spec/fixtures/modules/ +.vagrant/ +.bundle/ +coverage/ +log/ +.idea/ +*.iml +.*.sw diff --git a/.msync.yml b/.msync.yml new file mode 100644 index 00000000..e33088ec --- /dev/null +++ b/.msync.yml @@ -0,0 +1 @@ +modulesync_config_version: '0.12.7' diff --git a/.rspec b/.rspec new file mode 100644 index 00000000..8c18f1ab --- /dev/null +++ b/.rspec @@ -0,0 +1,2 @@ +--format documentation +--color diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 00000000..d6a39488 --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,509 @@ +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 + +# 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 diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..3f02a065 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,52 @@ +--- +sudo: false +language: ruby +cache: bundler +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: + 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 + - rvm: 2.1.9 + env: PUPPET_VERSION="~> 4.0" CHECK=test + - rvm: 2.2.5 + env: PUPPET_VERSION="~> 4.0" CHECK=test + - rvm: 2.3.1 + env: PUPPET_VERSION="~> 4.0" CHECK=build DEPLOY_TO_FORGE=yes + - rvm: 2.3.1 + env: PUPPET_VERSION="~> 4.0" CHECK=rubocop + - rvm: 2.3.1 + env: PUPPET_VERSION="~> 4.0" CHECK=test + - rvm: 2.4.0-preview1 + env: PUPPET_VERSION="~> 4.0" CHECK=test + allow_failures: + - rvm: 2.4.0-preview1 +notifications: + email: false +deploy: + provider: puppetforge + deploy: + branch: ha-bug-puppet-forge + 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 00000000..29c933bc --- /dev/null +++ b/.yardopts @@ -0,0 +1 @@ +--markup markdown diff --git a/Gemfile b/Gemfile index 4e17a8b2..8613079c 100644 --- a/Gemfile +++ b/Gemfile @@ -1,35 +1,62 @@ -source "https://rubygems.org" +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 "rake" - gem "puppet", ENV['PUPPET_GEM_VERSION'] || '~> 3.8.0' - gem "rspec", '< 3.2.0' - gem "rspec-puppet", :git => 'https://github.com/rodjek/rspec-puppet.git' - gem "puppetlabs_spec_helper" - gem "metadata-json-lint" - gem "rspec-puppet-facts" - gem 'rubocop', '0.33.0' - gem 'simplecov', '>= 0.11.0' - gem 'simplecov-console' - - gem "puppet-lint-absolute_classname-check" - gem "puppet-lint-leading_zero-check" - gem "puppet-lint-trailing_comma-check" - gem "puppet-lint-version_comparison-check" - gem "puppet-lint-classes_and_types_beginning_with_digits-check" - gem "puppet-lint-unquoted_string-check" - gem 'puppet-lint-resource_reference_syntax' + gem 'puppetlabs_spec_helper', '~> 1.2.2', :require => false + gem 'rspec-puppet', :require => false, :git => 'https://github.com/rodjek/rspec-puppet.git' + 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', '0.4.0', :require => false + gem 'rubocop-rspec', '~> 1.6', :require => false if RUBY_VERSION >= '2.3.0' + gem 'json_pure', '<= 2.0.1', :require => false if RUBY_VERSION < '2.0.0' end group :development do - gem "travis" - gem "travis-lint" - gem "puppet-blacksmith" - gem "guard-rake" + gem 'travis', :require => false + gem 'travis-lint', :require => false + gem 'guard-rake', :require => false end group :system_tests do - gem "beaker" - gem "beaker-rspec" - gem "beaker-puppet_install_helper" + 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 '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 01c85eb9..5191307f 100644 --- a/Rakefile +++ b/Rakefile @@ -1,11 +1,42 @@ require 'puppetlabs_spec_helper/rake_tasks' -require 'puppet-lint/tasks/puppet-lint' +require 'puppet_blacksmith/rake_tasks' +require 'voxpupuli/release/rake_tasks' +require 'puppet-strings/rake_tasks' -PuppetLint.configuration.fail_on_warnings +if RUBY_VERSION >= '2.3.0' + require 'rubocop/rake_task' + + RuboCop::RakeTask.new(:rubocop) do |task| + # These make the rubocop experience maybe slightly less terrible + task.options = ['-D', '-S', '-E'] + end +end + +PuppetLint.configuration.log_format = '%{path}:%{linenumber}:%{check}:%{KIND}:%{message}' +PuppetLint.configuration.fail_on_warnings = true PuppetLint.configuration.send('relative') -PuppetLint.configuration.send('disable_80chars') +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') -PuppetLint.configuration.send('disable_only_variable_string') -PuppetLint.configuration.ignore_paths = ["spec/**/*.pp", "pkg/**/*.pp"] + +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 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 index 155926dd..a7878634 100644 --- a/spec/acceptance/nodesets/centos-511-x64.yml +++ b/spec/acceptance/nodesets/centos-511-x64.yml @@ -1,12 +1,12 @@ +--- HOSTS: centos-511-x64: roles: - master platform: el-5-x86_64 box: puppetlabs/centos-5.11-64-nocm - box_url: https://vagrantcloud.com/puppetlabs/boxes/centos-5.11-64-nocm hypervisor: vagrant - CONFIG: - log_level: verbose 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 00000000..0da6913c --- /dev/null +++ b/spec/acceptance/nodesets/centos-66-x64-pe.yml @@ -0,0 +1,14 @@ +--- +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 index 07843d5f..dff02def 100644 --- a/spec/acceptance/nodesets/centos-66-x64.yml +++ b/spec/acceptance/nodesets/centos-66-x64.yml @@ -1,11 +1,12 @@ +--- HOSTS: centos-66-x64: roles: - master platform: el-6-x86_64 box: puppetlabs/centos-6.6-64-nocm - box_url: https://vagrantcloud.com/puppetlabs/boxes/centos-6.6-64-nocm hypervisor: vagrant CONFIG: - log_level: verbose 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 00000000..b5ec2034 --- /dev/null +++ b/spec/acceptance/nodesets/centos-72-x64.yml @@ -0,0 +1,12 @@ +--- +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 index c4062fd1..8b71f390 100644 --- a/spec/acceptance/nodesets/debian-78-x64.yml +++ b/spec/acceptance/nodesets/debian-78-x64.yml @@ -1,12 +1,12 @@ +--- HOSTS: debian-78-x64: roles: - master platform: debian-7-amd64 box: puppetlabs/debian-7.8-64-nocm - box_url: https://vagrantcloud.com/puppetlabs/boxes/debian-7.8-64-nocm hypervisor: vagrant - CONFIG: - log_level: verbose 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 00000000..83e3660c --- /dev/null +++ b/spec/acceptance/nodesets/debian-82-x64.yml @@ -0,0 +1,12 @@ +--- +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/ubuntu-server-1204-x64.yml b/spec/acceptance/nodesets/ubuntu-server-1204-x64.yml new file mode 100644 index 00000000..52ba020a --- /dev/null +++ b/spec/acceptance/nodesets/ubuntu-server-1204-x64.yml @@ -0,0 +1,12 @@ +--- +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 00000000..407e82b6 --- /dev/null +++ b/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml @@ -0,0 +1,12 @@ +--- +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/classes/coverage_spec.rb b/spec/classes/coverage_spec.rb index 12513b83..de446548 100644 --- a/spec/classes/coverage_spec.rb +++ b/spec/classes/coverage_spec.rb @@ -1 +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 00000000..a3f52bfd --- /dev/null +++ b/spec/default_facts.yml @@ -0,0 +1,6 @@ +--- +concat_basedir: "/tmp" +ipaddress: "172.16.254.254" +is_pe: false +macaddress: "AA:AA:AA:AA:AA:AA" +selinux_config_mode: "disabled" diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index f2e59854..2d8b1658 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,20 +1,15 @@ require 'puppetlabs_spec_helper/module_spec_helper' require 'rspec-puppet-facts' - include RspecPuppetFacts -require 'simplecov' -require 'simplecov-console' - -SimpleCov.start do - add_filter '/spec' - add_filter '/vendor' - formatter SimpleCov::Formatter::MultiFormatter.new([ - SimpleCov::Formatter::HTMLFormatter, - SimpleCov::Formatter::Console - ]) -end - RSpec.configure do |c| - c.hiera_config = File.expand_path(File.join(__FILE__, '../fixtures/hiera.yaml')) + 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 074fee6f13de752bfd01cc50275238763041734f Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 26 Sep 2016 09:57:36 +0200 Subject: [PATCH 2/7] add travis secret --- .sync.yml | 4 ++++ .travis.yml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 .sync.yml diff --git a/.sync.yml b/.sync.yml new file mode 100644 index 00000000..5a60b3e6 --- /dev/null +++ b/.sync.yml @@ -0,0 +1,4 @@ +--- +.travis.yml: + secure: "RrAmWtM6eTjZZzD954AIgR179Pqp14lzHhd/C9cpKbTPynLncuim08CEvjmq+7pgAy9XDg1d02x3udfZt4btR1sBdyNRpNN3yUhWptmGU61HRJdiZq+nSLQkIYsqXanhk+O3NndFojO58WRD01dkWEc6HRHjlivuYNxDXmMkg9k=" + diff --git a/.travis.yml b/.travis.yml index 3f02a065..f84ad5b9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -43,7 +43,7 @@ deploy: branch: ha-bug-puppet-forge user: puppet password: - secure: "" + secure: "RrAmWtM6eTjZZzD954AIgR179Pqp14lzHhd/C9cpKbTPynLncuim08CEvjmq+7pgAy9XDg1d02x3udfZt4btR1sBdyNRpNN3yUhWptmGU61HRJdiZq+nSLQkIYsqXanhk+O3NndFojO58WRD01dkWEc6HRHjlivuYNxDXmMkg9k=" on: tags: true # all_branches is required to use tags From 08eac8ea643f9fa79cb5c30e02ce694f895e8fe6 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 26 Sep 2016 10:03:44 +0200 Subject: [PATCH 3/7] puppet-lint: fix relative_classname_inclusion --- manifests/forwarder.pp | 8 ++++---- manifests/init.pp | 8 ++++---- manifests/platform/solaris.pp | 6 +++--- manifests/virtual.pp | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/manifests/forwarder.pp b/manifests/forwarder.pp index d4fa773f..7940f07c 100644 --- a/manifests/forwarder.pp +++ b/manifests/forwarder.pp @@ -72,7 +72,7 @@ $path_delimiter = $splunk::params::path_delimiter #no need for staging the source if we have yum or apt if $pkg_provider != undef and $pkg_provider != 'yum' and $pkg_provider != 'apt' { - include staging + include ::staging $staged_package = staging_parse($package_source) $pkg_path_parts = [$staging::path, $staging_subdir, $staged_package] @@ -123,15 +123,15 @@ # there is non-generic configuration that needs to be declared in addition # to the agnostic resources declared here. case $::kernel { - 'Linux': { class { 'splunk::platform::posix': splunkd_port => $splunkd_port, + 'Linux': { class { '::splunk::platform::posix': splunkd_port => $splunkd_port, splunk_user => $splunk_user } } - 'SunOS': { include splunk::platform::solaris } + 'SunOS': { ::include splunk::platform::solaris } default: { } # no special configuration needed } # Realize resources shared between server and forwarder profiles, and set up # dependency chains. - include splunk::virtual + include ::splunk::virtual realize Service[$virtual_service] diff --git a/manifests/init.pp b/manifests/init.pp index e0fec418..e41226c2 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -71,7 +71,7 @@ $path_delimiter = $splunk::params::path_delimiter if $pkg_provider != undef and $pkg_provider != 'yum' and $pkg_provider != 'apt' { - include staging + include ::staging $staged_package = staging_parse($package_source) $pkg_path_parts = [$staging::path, $staging_subdir, $staged_package] @@ -138,14 +138,14 @@ # there is non-generic configuration that needs to be declared in addition # to the agnostic resources declared here. case $::kernel { - 'Linux': { include splunk::platform::posix } - 'SunOS': { include splunk::platform::solaris } + 'Linux': { include ::splunk::platform::posix } + 'SunOS': { include ::splunk::platform::solaris } default: { } # no special configuration needed } # Realize resources shared between server and forwarder profiles, and set up # dependency chains. - include splunk::virtual + include ::splunk::virtual # This realize() call is because the collectors don't seem to work well with # arrays. They'll set the dependencies but not realize all Service resources diff --git a/manifests/platform/solaris.pp b/manifests/platform/solaris.pp index a442622a..dd12710e 100644 --- a/manifests/platform/solaris.pp +++ b/manifests/platform/solaris.pp @@ -13,9 +13,9 @@ # Requires: nothing # class splunk::platform::solaris inherits splunk::virtual { - include staging - include splunk::params - include splunk::platform::posix + include ::staging + include ::splunk::params + include ::splunk::platform::posix $path = $staging::path $subdir = $splunk::params::staging_subdir diff --git a/manifests/virtual.pp b/manifests/virtual.pp index 19a77ff8..d0c86766 100644 --- a/manifests/virtual.pp +++ b/manifests/virtual.pp @@ -14,7 +14,7 @@ # Requires: nothing # class splunk::virtual { - include splunk::params + include ::splunk::params $virtual_services = unique(flatten([ $splunk::params::server_service, From fe2f145633ef77748828e45fd655063c568c0e82 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 26 Sep 2016 10:05:00 +0200 Subject: [PATCH 4/7] puppet-lint: fix ensure_first_param --- manifests/password.pp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifests/password.pp b/manifests/password.pp index 72400552..d2f6361f 100644 --- a/manifests/password.pp +++ b/manifests/password.pp @@ -40,18 +40,18 @@ } file { "$password_config_file": - content => $password_content, ensure => present, + content => $password_content, require => Package[$package_name], notify => Service[$virtual_service], tag => "splunk_password", } file { "$secret_file": + ensure => present, content => $secret, require => Package[$package_name], notify => Service[$virtual_service], - ensure => present, } From 8f28022a1f4b9365da0bbc31c088cf835f7c46cd Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 26 Sep 2016 10:07:14 +0200 Subject: [PATCH 5/7] remove trailing whitespace --- manifests/addon.pp | 6 +++--- manifests/forwarder.pp | 4 ++-- manifests/password.pp | 2 -- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/manifests/addon.pp b/manifests/addon.pp index afe89add..ad494a16 100644 --- a/manifests/addon.pp +++ b/manifests/addon.pp @@ -2,7 +2,7 @@ # Defined type: splunk::addon # # This define sets up a TA (Technology Addon) for Splunk. It (optionally) -# installed a package, and configures input forwarders in +# installed a package, and configures input forwarders in # $SPLUNK_HOME/etc/apps//local/inputs.conf # # Examples @@ -57,9 +57,9 @@ path => "${splunk_home}/etc/apps/${name}/local/inputs.conf", require => File["${splunk_home}/etc/apps/${name}/local"] } - + create_resources('splunk::addon::input', $inputs, {"addon" => $name }) } - + } diff --git a/manifests/forwarder.pp b/manifests/forwarder.pp index 7940f07c..a5f7351f 100644 --- a/manifests/forwarder.pp +++ b/manifests/forwarder.pp @@ -118,7 +118,7 @@ purge_forwarder_transforms => $purge_forwarder_transforms, purge_forwarder_web => $purge_forwarder_web } - + # This is a module that supports multiple platforms. For some platforms # there is non-generic configuration that needs to be declared in addition # to the agnostic resources declared here. @@ -140,7 +140,7 @@ Exec <| tag == 'splunk_forwarder' |> -> Service[$virtual_service] - Package[$package_name] -> Splunkforwarder_output<||> ~> Service[$virtual_service] + Package[$package_name] -> Splunkforwarder_output<||> ~> Service[$virtual_service] Package[$package_name] -> Splunkforwarder_input<||> ~> Service[$virtual_service] Package[$package_name] -> Splunkforwarder_props<||> ~> Service[$virtual_service] Package[$package_name] -> Splunkforwarder_transforms<||> ~> Service[$virtual_service] diff --git a/manifests/password.pp b/manifests/password.pp index d2f6361f..b0ece0b8 100644 --- a/manifests/password.pp +++ b/manifests/password.pp @@ -53,6 +53,4 @@ require => Package[$package_name], notify => Service[$virtual_service], } - - } From ea7b9d04f629b3cd1faeb46d2e44040d965a9005 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 26 Sep 2016 12:30:36 +0200 Subject: [PATCH 6/7] change present to file --- manifests/password.pp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifests/password.pp b/manifests/password.pp index b0ece0b8..2f67991f 100644 --- a/manifests/password.pp +++ b/manifests/password.pp @@ -40,7 +40,7 @@ } file { "$password_config_file": - ensure => present, + ensure => file, content => $password_content, require => Package[$package_name], notify => Service[$virtual_service], @@ -48,7 +48,7 @@ } file { "$secret_file": - ensure => present, + ensure => file, content => $secret, require => Package[$package_name], notify => Service[$virtual_service], From e9e38f546426170464e2b07e936ed5170dfa7f37 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 26 Sep 2016 12:31:21 +0200 Subject: [PATCH 7/7] convert hardtab to softtab --- .sync.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.sync.yml b/.sync.yml index 5a60b3e6..8c620c4c 100644 --- a/.sync.yml +++ b/.sync.yml @@ -1,4 +1,4 @@ --- .travis.yml: - secure: "RrAmWtM6eTjZZzD954AIgR179Pqp14lzHhd/C9cpKbTPynLncuim08CEvjmq+7pgAy9XDg1d02x3udfZt4btR1sBdyNRpNN3yUhWptmGU61HRJdiZq+nSLQkIYsqXanhk+O3NndFojO58WRD01dkWEc6HRHjlivuYNxDXmMkg9k=" + secure: "RrAmWtM6eTjZZzD954AIgR179Pqp14lzHhd/C9cpKbTPynLncuim08CEvjmq+7pgAy9XDg1d02x3udfZt4btR1sBdyNRpNN3yUhWptmGU61HRJdiZq+nSLQkIYsqXanhk+O3NndFojO58WRD01dkWEc6HRHjlivuYNxDXmMkg9k="