diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..543dd6a
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,4 @@
+*.rb eol=lf
+*.erb eol=lf
+*.pp eol=lf
+*.sh eol=lf
diff --git a/.rubocop.yml b/.rubocop.yml
index 85429cd..72d2f75 100644
--- a/.rubocop.yml
+++ b/.rubocop.yml
@@ -1,516 +1,104 @@
+---
require: rubocop-rspec
AllCops:
- TargetRubyVersion: 1.9
+ TargetRubyVersion: '2.1'
Include:
- - ./**/*.rb
+ - "./**/*.rb"
Exclude:
- - Gemfile
- - Rakefile
- - files/**/*
- - vendor/**/*
- - .vendor/**/*
- - pkg/**/*
- - lib/puppet/parser/functions/*
- - spec/fixtures/**/*
- - spec/functions/*
-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
-
-Security/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.
+ - bin/*
+ - ".vendor/**/*"
+ - Gemfile
+ - Rakefile
+ - pkg/**/*
+ - spec/fixtures/**/*
+ - vendor/**/*
Metrics/LineLength:
- Enabled: False
-
-Style/MethodCallWithoutArgsParentheses:
- 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
-
+ Description: People have wide screens, use them.
+ Max: 200
+RSpec/BeforeAfterAll:
+ Description: Beware of using after(:all) as it may cause state to leak between tests.
+ A necessary evil in acceptance testing.
+ Exclude:
+ - spec/acceptance/**/*.rb
+RSpec/HookArgument:
+ Description: Prefer explicit :each argument, matching existing module's style
+ EnforcedStyle: each
+Style/BlockDelimiters:
+ Description: Prefer braces for chaining. Mostly an aesthetical choice. Better to
+ be consistent then.
+ EnforcedStyle: braces_for_chaining
+Style/ClassAndModuleChildren:
+ Description: Compact style reduces the required amount of indentation.
+ EnforcedStyle: compact
+Style/EmptyElse:
+ Description: Enforce against empty else clauses, but allow `nil` for clarity.
+ EnforcedStyle: empty
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
+ Description: Following the main puppet project's style, prefer the % format format.
+ EnforcedStyle: percent
+Style/FormatStringToken:
+ Description: Following the main puppet project's style, prefer the simpler template
+ tokens over annotated ones.
+ EnforcedStyle: template
+Style/Lambda:
+ Description: Prefer the keyword for easier discoverability.
+ EnforcedStyle: literal
Style/RegexpLiteral:
+ Description: Community preference. See https://github.com/voxpupuli/modulesync_config/issues/168
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
+Style/TernaryParentheses:
+ Description: Checks for use of parentheses around ternary conditions. Enforce parentheses
+ on complex expressions for better readability, but seriously consider breaking
+ it up.
+ EnforcedStyle: require_parentheses_when_complex
+Style/TrailingCommaInArguments:
+ Description: Prefer always trailing comma on multiline argument lists. This makes
+ diffs, and re-ordering nicer.
+ EnforcedStyleForMultiline: comma
+Style/TrailingCommaInLiteral:
+ Description: Prefer always trailing comma on multiline literals. This makes diffs,
+ and re-ordering nicer.
+ EnforcedStyleForMultiline: comma
+Style/SymbolArray:
+ Description: Using percent style obscures symbolic intent of array's contents.
+ EnforcedStyle: brackets
+Style/EndOfLine:
+ Enabled: false
+Style/CollectionMethods:
+ Enabled: true
+Style/MethodCalledOnDoEndBlock:
+ Enabled: true
+Style/StringMethods:
+ Enabled: true
Metrics/AbcSize:
- Enabled: False
-
-# 'Complexity' is very relative
+ Enabled: false
+Metrics/BlockLength:
+ Enabled: false
+Metrics/ClassLength:
+ Enabled: false
+Metrics/CyclomaticComplexity:
+ Enabled: false
+Metrics/MethodLength:
+ Enabled: false
+Metrics/ModuleLength:
+ Enabled: false
+Metrics/ParameterLists:
+ Enabled: false
Metrics/PerceivedComplexity:
- Enabled: False
-
-Lint/UselessAssignment:
- Enabled: True
-
-Style/ClosingParenthesisIndentation:
- Enabled: True
-
-# RSpec
-
-# We don't use rspec in this way
+ Enabled: false
RSpec/DescribeClass:
- Enabled: False
-
-# Example length is not necessarily an indicator of code quality
+ Enabled: false
RSpec/ExampleLength:
- Enabled: False
-
-RSpec/NamedSubject:
- Enabled: False
+ Enabled: false
+RSpec/MessageExpectation:
+ Enabled: false
+RSpec/MultipleExpectations:
+ Enabled: false
+RSpec/NestedGroups:
+ Enabled: false
+Style/AsciiComments:
+ Enabled: false
+Style/IfUnlessModifier:
+ Enabled: false
+Style/SymbolProc:
+ Enabled: false
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0fe7640..ee07be0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,11 +4,18 @@ All notable changes to this project will be documented in this file.
## Release 1.1.0 (NOT YET RELEASED)
+With this release, ownership of this module is transfered to Kogito UG,
+a DevOps / Infrastructure services business in Berlin, Germany.
**Features**
- Upgrade default Minio installation to a more recent version
- Base URL for Minio downloads can now be pointed to a custom location
+- Converted module to be Puppet Development Kit compatible
+- Added support for Debian 9 (Stretch)
+- Updated Puppet requirements to be in line with PE lifecycle
+- **API**: `sorted_json(...)` function has been converted to a Puppet 4 style
+ function and renamed to `to_sorted_json(...)`
## Release 1.0.2 (2017-07-13)
diff --git a/Gemfile b/Gemfile
index 8d4882a..db715da 100644
--- a/Gemfile
+++ b/Gemfile
@@ -1,9 +1,8 @@
source 'https://rubygems.org'
-gem 'rubocop', '<= 0.48.1'
+gem 'rubocop', '>= 0.49.1'
group :test do
- gem 'coveralls', require: false if RUBY_VERSION >= '2.0.0'
gem 'json_pure', '<= 2.0.1', require: false if RUBY_VERSION < '2.0.0'
gem 'metadata-json-lint', require: false
gem 'mocha', '>= 1.2.1', require: false
@@ -15,13 +14,11 @@ group :test do
gem 'puppet-lint-unquoted_string-check', require: false
gem 'puppet-lint-variable_contains_upcase', require: false
gem 'puppet-lint-version_comparison-check', require: false
- gem 'puppet-strings', '~> 0.99.0', require: false
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 'rubocop-rspec', '~> 1.6', require: false if RUBY_VERSION >= '2.3.0'
- gem 'simplecov-console', require: false if RUBY_VERSION >= '2.0.0'
end
group :development do
diff --git a/LICENSE b/LICENSE
index 0695be3..933cfd4 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,4 +1,4 @@
-Copyright 2016 Daniel S. Reichenbach
+Copyright (c) 2016-2017 Kogito UG
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/README.md b/README.md
index 850ea93..9a4db82 100644
--- a/README.md
+++ b/README.md
@@ -18,12 +18,12 @@ with default settings, or customize all settings to your liking.
### What Minio affects
-* `puppet-minio` depends on
- * [puppetlabs-stdlib][puppetlabs-stdlib],
- * [lwf-remote_file][lwf-remote_file],
-* it manages a user and group `minio`
-* it manages the Minio directory (`/opt/minio`) and the storage (`/var/minio`)
-* it install a `minio` service listening on port `3000`
+- `puppet-minio` depends on
+ - [puppetlabs-stdlib][puppetlabs-stdlib],
+ - [lwf-remote_file][lwf-remote_file],
+- it manages a user and group `minio`
+- it manages the Minio directory (`/opt/minio`) and the storage (`/var/minio`)
+- it install a `minio` service listening on port `3000`
### Beginning with Minio
@@ -139,7 +139,7 @@ class { 'minio::config':
## Limitations
-See [metadata.json](metadata.json) for supported platforms
+See [metadata.json](metadata.json) for supported platforms.
## Development
@@ -150,9 +150,9 @@ This project contains tests for [rspec-puppet][puppet-rspec].
Quickstart:
```bash
-$ gem install bundler
-$ bundle install
-$ bundle exec rake test
+gem install bundler
+bundle install
+bundle exec rake test
```
When submitting pull requests, please make sure that module documentation,
diff --git a/Rakefile b/Rakefile
index e449340..7051829 100644
--- a/Rakefile
+++ b/Rakefile
@@ -1,7 +1,6 @@
require 'puppetlabs_spec_helper/rake_tasks.rb'
require 'puppet_blacksmith/rake_tasks.rb'
require 'puppet-lint/tasks/puppet-lint.rb'
-require 'puppet-strings/tasks.rb'
require 'metadata-json-lint/rake_task.rb'
if RUBY_VERSION >= '1.9'
diff --git a/lib/puppet/functions/to_sorted_json.rb b/lib/puppet/functions/to_sorted_json.rb
new file mode 100644
index 0000000..80f81b4
--- /dev/null
+++ b/lib/puppet/functions/to_sorted_json.rb
@@ -0,0 +1,44 @@
+# Take a data structure and output it as sorted JSON
+#
+# @example how to output pretty JSON
+# # output pretty json to a file
+# file { '/tmp/my.json':
+# ensure => file,
+# content => to_sorted_json($myhash),
+# }
+#
+#
+require 'json'
+
+Puppet::Functions.create_function(:to_sorted_json) do
+ dispatch :to_sorted_json do
+ param 'Hash', :arg
+ end
+
+ def sorted_generate(obj)
+ case obj
+ when Integer, Float, TrueClass, FalseClass, NilClass
+ return obj.to_json
+ when String
+ obj.to_json
+ when Array
+ array_ret = []
+ obj.each do |a|
+ array_ret.push(sorted_generate(a))
+ end
+ '[' << array_ret.join(',') << ']'
+ when Hash
+ ret = []
+ obj.keys.sort.each do |k|
+ ret.push(k.to_json << ':' << sorted_generate(obj[k]))
+ end
+ '{' << ret.join(',') << '}'
+ else
+ raise Exception('Unable to handle object of type <%s>' % obj.class.to_s)
+ end
+ end
+
+ def to_sorted_json(h)
+ sorted_generate(h)
+ end
+end
diff --git a/lib/puppet/parser/functions/sorted_json.rb b/lib/puppet/parser/functions/sorted_json.rb
deleted file mode 100644
index e53dabc..0000000
--- a/lib/puppet/parser/functions/sorted_json.rb
+++ /dev/null
@@ -1,156 +0,0 @@
-require 'json'
-
-module JSON
- class << self
- @@loop = 0
-
- def sorted_generate(obj)
- case obj
- when Integer, Float, TrueClass, FalseClass, NilClass
- return obj.to_json
- when String
- return obj.to_json
- when Array
- arrayRet = []
- obj.each do |a|
- arrayRet.push(sorted_generate(a))
- end
- return "[" << arrayRet.join(',') << "]";
- when Hash
- ret = []
- obj.keys.sort.each do |k|
- ret.push(k.to_json << ":" << sorted_generate(obj[k]))
- end
- return "{" << ret.join(",") << "}";
- else
- raise Exception("Unable to handle object of type <%s>" % obj.class.to_s)
- end
- end
-
- def sorted_pretty_generate(obj, indent_len=4)
-
- # Indent length
- indent = " " * indent_len
-
- case obj
-
- when Integer, Float, TrueClass, FalseClass, NilClass
- return obj.to_json
-
- when String
- return obj.to_json
-
- when Array
- arrayRet = []
-
- # We need to increase the loop count before #each so the objects inside are indented twice.
- # When we come out of #each we decrease the loop count so the closing brace lines up properly.
- #
- # If you start with @@loop = 1, the count will be as follows
- #
- # "start_join": [ <-- @@loop == 1
- # "192.168.50.20", <-- @@loop == 2
- # "192.168.50.21", <-- @@loop == 2
- # "192.168.50.22" <-- @@loop == 2
- # ] <-- closing brace <-- @@loop == 1
- #
- @@loop += 1
- obj.each do |a|
- arrayRet.push(sorted_pretty_generate(a, indent_len))
- end
- @@loop -= 1
-
- return "[\n#{indent * (@@loop + 1)}" << arrayRet.join(",\n#{indent * (@@loop + 1)}") << "\n#{indent * @@loop}]";
-
- when Hash
- ret = []
-
- # This loop works in a similar way to the above
- @@loop += 1
- obj.keys.sort.each do |k|
- ret.push("#{indent * @@loop}" << k.to_json << ": " << sorted_pretty_generate(obj[k], indent_len))
- end
- @@loop -= 1
-
- return "{\n" << ret.join(",\n") << "\n#{indent * @@loop}}";
- else
- raise Exception("Unable to handle object of type <%s>" % obj.class.to_s)
- end
-
- end # end def
-
- end # end class
-
-end # end module
-
-
-module Puppet::Parser::Functions
- newfunction(:sorted_json, :type => :rvalue, :doc => <<-EOS
-This function takes unsorted hash and outputs JSON object making sure the keys are sorted.
-Optionally you can pass 2 additional parameters, pretty generate and indent length.
-
-*Examples:*
-
- -------------------
- -- UNSORTED HASH --
- -------------------
- unsorted_hash = {
- 'client_addr' => '127.0.0.1',
- 'bind_addr' => '192.168.34.56',
- 'start_join' => [
- '192.168.34.60',
- '192.168.34.61',
- '192.168.34.62',
- ],
- 'ports' => {
- 'rpc' => 8567,
- 'https' => 8500,
- 'http' => -1,
- },
- }
-
- -----------------
- -- SORTED JSON --
- -----------------
-
- sorted_json(unsorted_hash)
-
- {"bind_addr":"192.168.34.56","client_addr":"127.0.0.1",
- "ports":{"http":-1,"https":8500,"rpc":8567},
- "start_join":["192.168.34.60","192.168.34.61","192.168.34.62"]}
-
- ------------------------
- -- PRETTY SORTED JSON --
- ------------------------
- Params: data , pretty , indent .
-
- sorted_json(unsorted_hash, true, 4)
-
- {
- "bind_addr": "192.168.34.56",
- "client_addr": "127.0.0.1",
- "ports": {
- "http": -1,
- "https": 8500,
- "rpc": 8567
- },
- "start_join": [
- "192.168.34.60",
- "192.168.34.61",
- "192.168.34.62"
- ]
- }
-
- EOS
- ) do |args|
-
- unsorted_hash = args[0] || {}
- pretty = args[1] || false
- indent_len = args[2].to_i || 4
-
- unsorted_hash.reject! {|key, value| value == :undef }
-
- return JSON.sorted_generate(unsorted_hash) unless pretty
- return JSON.sorted_pretty_generate(unsorted_hash, indent_len) << "\n"
- end
-end
diff --git a/manifests/config.pp b/manifests/config.pp
index 1885f9d..70c40d8 100644
--- a/manifests/config.pp
+++ b/manifests/config.pp
@@ -77,7 +77,7 @@
},
}
- $resulting_configuration = sorted_json(deep_merge($default_configuration, $configuration), true, 2)
+ $resulting_configuration = to_sorted_json(deep_merge($default_configuration, $configuration))
file { "${configuration_directory}/config.json":
content => $resulting_configuration,
diff --git a/metadata.json b/metadata.json
index 56cf0cf..1902de8 100644
--- a/metadata.json
+++ b/metadata.json
@@ -1,16 +1,21 @@
{
"name": "kogitoapp-minio",
"version": "1.0.2",
- "author": "kogitoapp",
- "summary": "Manage Minio with Puppet",
+ "author": "Kogito UG ",
+ "summary": "A module to manage Minio to enjoy self-hosted S3 storage",
"license": "Apache-2.0",
"source": "https://github.com/kogitoapp/puppet-minio.git",
"project_page": "https://github.com/kogitoapp/puppet-minio",
"issues_url": "https://github.com/kogitoapp/puppet-minio/issues",
- "tags": [
- "minio",
- "git",
- "linux"
+ "dependencies": [
+ {
+ "name": "puppetlabs-stdlib",
+ "version_requirement": ">= 4.14.0 < 5.0.0"
+ },
+ {
+ "name": "lwf-remote_file",
+ "version_requirement": ">= 1.1.3 < 2.0.0"
+ }
],
"operatingsystem_support": [
{
@@ -19,12 +24,24 @@
"7"
]
},
+ {
+ "operatingsystem": "OracleLinux",
+ "operatingsystemrelease": [
+ "7"
+ ]
+ },
{
"operatingsystem": "RedHat",
"operatingsystemrelease": [
"7"
]
},
+ {
+ "operatingsystem": "Scientific",
+ "operatingsystemrelease": [
+ "7"
+ ]
+ },
{
"operatingsystem": "Debian",
"operatingsystemrelease": [
@@ -39,20 +56,10 @@
]
}
],
- "dependencies": [
- {
- "name": "puppetlabs-stdlib",
- "version_requirement": ">= 4.14.0 < 5.0.0"
- },
- {
- "name": "lwf-remote_file",
- "version_requirement": ">= 1.1.3 < 2.0.0"
- }
- ],
"requirements": [
{
"name": "puppet",
- "version_requirement": ">= 4.0.0 < 6.0.0"
+ "version_requirement": ">= 4.10.8 < 6.0.0"
}
]
}
diff --git a/spec/acceptance/class_spec.rb b/spec/acceptance/class_spec.rb
index 932dfce..bc24f2a 100644
--- a/spec/acceptance/class_spec.rb
+++ b/spec/acceptance/class_spec.rb
@@ -1,12 +1,12 @@
require 'spec_helper_acceptance'
describe 'minio class' do
- context 'default parameters' do
+ context 'with default parameters' do
# Using puppet_apply as a helper
it 'works idempotently with no errors' do
- pp = <<-EOS
+ pp = <<-PUPPET
class { 'minio': }
- EOS
+ PUPPET
# Run it twice and test for idempotency
apply_manifest(pp, catch_failures: true)
diff --git a/spec/classes/config_spec.rb b/spec/classes/config_spec.rb
index 8da9a07..05e8a89 100644
--- a/spec/classes/config_spec.rb
+++ b/spec/classes/config_spec.rb
@@ -14,17 +14,17 @@
'version' => '19',
'credential' => {
'accessKey' => 'ADMIN',
- 'secretKey' => 'PASSWORD'
+ 'secretKey' => 'PASSWORD',
},
'region' => 'us-east-1',
- 'browser' => 'on'
+ 'browser' => 'on',
},
owner: 'minio',
group: 'minio',
configuration_directory: '/etc/minio',
installation_directory: '/opt/minio',
storage_root: '/var/minio',
- log_directory: '/var/log/minio'
+ log_directory: '/var/log/minio',
}
end
diff --git a/spec/classes/install_spec.rb b/spec/classes/install_spec.rb
index 6ddacb8..594ecfe 100644
--- a/spec/classes/install_spec.rb
+++ b/spec/classes/install_spec.rb
@@ -27,7 +27,7 @@
service_template: 'minio/systemd.erb',
service_path: '/lib/systemd/system/minio.service',
service_provider: 'systemd',
- service_mode: '0644'
+ service_mode: '0644',
}
end
diff --git a/spec/classes/service_spec.rb b/spec/classes/service_spec.rb
index e673912..8bff784 100644
--- a/spec/classes/service_spec.rb
+++ b/spec/classes/service_spec.rb
@@ -11,7 +11,7 @@
let :params do
{
manage_service: true,
- service_provider: 'systemd'
+ service_provider: 'systemd',
}
end
diff --git a/spec/classes/user_spec.rb b/spec/classes/user_spec.rb
index a1236f6..71dbad4 100644
--- a/spec/classes/user_spec.rb
+++ b/spec/classes/user_spec.rb
@@ -15,7 +15,7 @@
manage_home: true,
owner: 'minio',
group: 'minio',
- home: '/home/minio'
+ home: '/home/minio',
}
end
diff --git a/spec/functions/sorted_json_spec.rb b/spec/functions/sorted_json_spec.rb
deleted file mode 100644
index 93a7687..0000000
--- a/spec/functions/sorted_json_spec.rb
+++ /dev/null
@@ -1,44 +0,0 @@
-require 'spec_helper'
-
-describe 'sorted_json', :type => :puppet_function do
-
- let(:test_hash){ { 'z' => 3, 'a' => '1', 'p' => '2', 's' => '-7' } }
- before do
- @json = subject.call([test_hash, true])
- end
- it "sorts keys" do
- expect( @json.index('a') ).to be < @json.index('p')
- expect( @json.index('p') ).to be < @json.index('s')
- expect( @json.index('s') ).to be < @json.index('z')
- end
-
- it "prints pretty json" do
- expect(@json.split("\n").size).to eql(test_hash.size + 2) # +2 for { and }
- end
-
- it "prints ugly json" do
- json = subject.call([test_hash]) # pretty=false by default
- expect(json.split("\n").size).to eql(1)
- end
-
- it "validate ugly json" do
- json = subject.call([test_hash]) # pretty=false by default
- expect(json).to match("{\"a\":\"1\",\"p\":\"2\",\"s\":\"-7\",\"z\":3}")
- end
-
- context 'nesting' do
-
- let(:nested_test_hash){ { 'z' => [{'l' => 3, 'k' => '2', 'j'=> '1'}],
- 'a' => {'z' => '3', 'x' => '1', 'y' => '2'},
- 'p' => [ '9','8','7'] } }
- before do
- @json = subject.call([nested_test_hash, true])
- end
-
- it "sorts nested hashes" do
- expect( @json.index('x') ).to be < @json.index('y')
- expect( @json.index('y') ).to be < @json.index('z')
- end
-
- end
-end
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 7506ae1..c188e54 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -1,26 +1,11 @@
require 'puppetlabs_spec_helper/module_spec_helper'
require 'rspec-puppet-facts'
-require 'coveralls'
-require 'simplecov'
-require 'simplecov-console'
include RspecPuppetFacts
-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
-
RSpec.configure do |c|
default_facts = {
puppetversion: Puppet.version,
- facterversion: Facter.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__))