summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.msync.yml2
-rw-r--r--.rubocop.yml315
-rw-r--r--.travis.yml4
-rw-r--r--Gemfile9
-rw-r--r--Rakefile11
-rw-r--r--manifests/init.pp70
-rw-r--r--spec/default_facts.yml6
-rw-r--r--spec/spec_helper.rb12
8 files changed, 239 insertions, 190 deletions
diff --git a/.msync.yml b/.msync.yml
index efd68b6..0ac5eef 100644
--- a/.msync.yml
+++ b/.msync.yml
@@ -1 +1 @@
-modulesync_config_version: '0.9.1'
+modulesync_config_version: '0.12.0'
diff --git a/.rubocop.yml b/.rubocop.yml
index c834cd2..5aadd1b 100644
--- a/.rubocop.yml
+++ b/.rubocop.yml
@@ -9,476 +9,476 @@ AllCops:
- pkg/**/*
- spec/fixtures/**/*
Lint/ConditionPosition:
- Enabled: true
+ Enabled: True
Lint/ElseLayout:
- Enabled: true
+ Enabled: True
Lint/UnreachableCode:
- Enabled: true
+ Enabled: True
Lint/UselessComparison:
- Enabled: true
+ Enabled: True
Lint/EnsureReturn:
- Enabled: true
+ Enabled: True
Lint/HandleExceptions:
- Enabled: true
+ Enabled: True
Lint/LiteralInCondition:
- Enabled: true
+ Enabled: True
Lint/ShadowingOuterLocalVariable:
- Enabled: true
+ Enabled: True
Lint/LiteralInInterpolation:
- Enabled: true
+ Enabled: True
Style/HashSyntax:
- Enabled: true
+ Enabled: True
Style/RedundantReturn:
- Enabled: true
+ Enabled: True
Lint/AmbiguousOperator:
- Enabled: true
+ Enabled: True
Lint/AssignmentInCondition:
- Enabled: true
+ Enabled: True
Style/SpaceBeforeComment:
- Enabled: true
+ Enabled: True
Style/AndOr:
- Enabled: true
+ Enabled: True
Style/RedundantSelf:
- Enabled: true
+ Enabled: True
# Method length is not necessarily an indicator of code quality
Metrics/MethodLength:
- Enabled: false
+ Enabled: False
# Module length is not necessarily an indicator of code quality
Metrics/ModuleLength:
- Enabled: false
+ Enabled: False
Style/WhileUntilModifier:
- Enabled: true
+ Enabled: True
Lint/AmbiguousRegexpLiteral:
- Enabled: true
+ Enabled: True
Lint/Eval:
- Enabled: true
+ Enabled: True
Lint/BlockAlignment:
- Enabled: true
+ Enabled: True
Lint/DefEndAlignment:
- Enabled: true
+ Enabled: True
Lint/EndAlignment:
- Enabled: true
+ Enabled: True
Lint/DeprecatedClassMethods:
- Enabled: true
+ Enabled: True
Lint/Loop:
- Enabled: true
+ Enabled: True
Lint/ParenthesesAsGroupedExpression:
- Enabled: true
+ Enabled: True
Lint/RescueException:
- Enabled: true
+ Enabled: True
Lint/StringConversionInInterpolation:
- Enabled: true
+ Enabled: True
Lint/UnusedBlockArgument:
- Enabled: true
+ Enabled: True
Lint/UnusedMethodArgument:
- Enabled: true
+ Enabled: True
Lint/UselessAccessModifier:
- Enabled: true
+ Enabled: True
Lint/UselessAssignment:
- Enabled: true
+ Enabled: True
Lint/Void:
- Enabled: true
+ Enabled: True
Style/AccessModifierIndentation:
- Enabled: true
+ Enabled: True
Style/AccessorMethodName:
- Enabled: true
+ Enabled: True
Style/Alias:
- Enabled: true
+ Enabled: True
Style/AlignArray:
- Enabled: true
+ Enabled: True
Style/AlignHash:
- Enabled: true
+ Enabled: True
Style/AlignParameters:
- Enabled: true
+ Enabled: True
Metrics/BlockNesting:
- Enabled: true
+ Enabled: True
Style/AsciiComments:
- Enabled: true
+ Enabled: True
Style/Attr:
- Enabled: true
+ Enabled: True
Style/BracesAroundHashParameters:
- Enabled: true
+ Enabled: True
Style/CaseEquality:
- Enabled: true
+ Enabled: True
Style/CaseIndentation:
- Enabled: true
+ Enabled: True
Style/CharacterLiteral:
- Enabled: true
+ Enabled: True
Style/ClassAndModuleCamelCase:
- Enabled: true
+ Enabled: True
Style/ClassAndModuleChildren:
- Enabled: false
+ Enabled: False
Style/ClassCheck:
- Enabled: true
+ Enabled: True
# Class length is not necessarily an indicator of code quality
Metrics/ClassLength:
- Enabled: false
+ Enabled: False
Style/ClassMethods:
- Enabled: true
+ Enabled: True
Style/ClassVars:
- Enabled: true
+ Enabled: True
Style/WhenThen:
- Enabled: true
+ Enabled: True
Style/WordArray:
- Enabled: true
+ Enabled: True
Style/UnneededPercentQ:
- Enabled: true
+ Enabled: True
Style/Tab:
- Enabled: true
+ Enabled: True
Style/SpaceBeforeSemicolon:
- Enabled: true
+ Enabled: True
Style/TrailingBlankLines:
- Enabled: true
+ Enabled: True
Style/SpaceInsideBlockBraces:
- Enabled: true
+ Enabled: True
Style/SpaceInsideBrackets:
- Enabled: true
+ Enabled: True
Style/SpaceInsideHashLiteralBraces:
- Enabled: true
+ Enabled: True
Style/SpaceInsideParens:
- Enabled: true
+ Enabled: True
Style/LeadingCommentSpace:
- Enabled: true
+ Enabled: True
Style/SpaceBeforeFirstArg:
- Enabled: true
+ Enabled: True
Style/SpaceAfterColon:
- Enabled: true
+ Enabled: True
Style/SpaceAfterComma:
- Enabled: true
+ Enabled: True
Style/SpaceAfterMethodName:
- Enabled: true
+ Enabled: True
Style/SpaceAfterNot:
- Enabled: true
+ Enabled: True
Style/SpaceAfterSemicolon:
- Enabled: true
+ Enabled: True
Style/SpaceAroundEqualsInParameterDefault:
- Enabled: true
+ Enabled: True
Style/SpaceAroundOperators:
- Enabled: true
+ Enabled: True
Style/SpaceBeforeBlockBraces:
- Enabled: true
+ Enabled: True
Style/SpaceBeforeComma:
- Enabled: true
+ Enabled: True
Style/CollectionMethods:
- Enabled: true
+ Enabled: True
Style/CommentIndentation:
- Enabled: true
+ Enabled: True
Style/ColonMethodCall:
- Enabled: true
+ Enabled: True
Style/CommentAnnotation:
- Enabled: true
+ Enabled: True
# 'Complexity' is very relative
Metrics/CyclomaticComplexity:
- Enabled: false
+ Enabled: False
Style/ConstantName:
- Enabled: true
+ Enabled: True
Style/Documentation:
- Enabled: false
+ Enabled: False
Style/DefWithParentheses:
- Enabled: true
+ Enabled: True
Style/PreferredHashMethods:
- Enabled: true
+ Enabled: True
Style/DotPosition:
EnforcedStyle: trailing
Style/DoubleNegation:
- Enabled: true
+ Enabled: True
Style/EachWithObject:
- Enabled: true
+ Enabled: True
Style/EmptyLineBetweenDefs:
- Enabled: true
+ Enabled: True
Style/IndentArray:
- Enabled: true
+ Enabled: True
Style/IndentHash:
- Enabled: true
+ Enabled: True
Style/IndentationConsistency:
- Enabled: true
+ Enabled: True
Style/IndentationWidth:
- Enabled: true
+ Enabled: True
Style/EmptyLines:
- Enabled: true
+ Enabled: True
Style/EmptyLinesAroundAccessModifier:
- Enabled: true
+ Enabled: True
Style/EmptyLiteral:
- Enabled: true
+ Enabled: True
# Configuration parameters: AllowURI, URISchemes.
Metrics/LineLength:
- Enabled: false
+ Enabled: False
Style/MethodCallParentheses:
- Enabled: true
+ Enabled: True
Style/MethodDefParentheses:
- Enabled: true
+ Enabled: True
Style/LineEndConcatenation:
- Enabled: true
+ Enabled: True
Style/TrailingWhitespace:
- Enabled: true
+ Enabled: True
Style/StringLiterals:
- Enabled: true
+ Enabled: True
Style/TrailingCommaInArguments:
- Enabled: true
+ Enabled: True
Style/TrailingCommaInLiteral:
- Enabled: true
+ Enabled: True
Style/GlobalVars:
- Enabled: true
+ Enabled: True
Style/GuardClause:
- Enabled: true
+ Enabled: True
Style/IfUnlessModifier:
- Enabled: true
+ Enabled: True
Style/MultilineIfThen:
- Enabled: true
+ Enabled: True
Style/NegatedIf:
- Enabled: true
+ Enabled: True
Style/NegatedWhile:
- Enabled: true
+ Enabled: True
Style/Next:
- Enabled: true
+ Enabled: True
Style/SingleLineBlockParams:
- Enabled: true
+ Enabled: True
Style/SingleLineMethods:
- Enabled: true
+ Enabled: True
Style/SpecialGlobalVars:
- Enabled: true
+ Enabled: True
Style/TrivialAccessors:
- Enabled: true
+ Enabled: True
Style/UnlessElse:
- Enabled: true
+ Enabled: True
Style/VariableInterpolation:
- Enabled: true
+ Enabled: True
Style/VariableName:
- Enabled: true
+ Enabled: True
Style/WhileUntilDo:
- Enabled: true
+ Enabled: True
Style/EvenOdd:
- Enabled: true
+ Enabled: True
Style/FileName:
- Enabled: true
+ Enabled: True
Style/For:
- Enabled: true
+ Enabled: True
Style/Lambda:
- Enabled: true
+ Enabled: True
Style/MethodName:
- Enabled: true
+ Enabled: True
Style/MultilineTernaryOperator:
- Enabled: true
+ Enabled: True
Style/NestedTernaryOperator:
- Enabled: true
+ Enabled: True
Style/NilComparison:
- Enabled: true
+ Enabled: True
Style/FormatString:
- Enabled: true
+ Enabled: True
Style/MultilineBlockChain:
- Enabled: true
+ Enabled: True
Style/Semicolon:
- Enabled: true
+ Enabled: True
Style/SignalException:
- Enabled: true
+ Enabled: True
Style/NonNilCheck:
- Enabled: true
+ Enabled: True
Style/Not:
- Enabled: true
+ Enabled: True
Style/NumericLiterals:
- Enabled: true
+ Enabled: True
Style/OneLineConditional:
- Enabled: true
+ Enabled: True
Style/OpMethod:
- Enabled: true
+ Enabled: True
Style/ParenthesesAroundCondition:
- Enabled: true
+ Enabled: True
Style/PercentLiteralDelimiters:
- Enabled: true
+ Enabled: True
Style/PerlBackrefs:
- Enabled: true
+ Enabled: True
Style/PredicateName:
- Enabled: true
+ Enabled: True
Style/RedundantException:
- Enabled: true
+ Enabled: True
Style/SelfAssignment:
- Enabled: true
+ Enabled: True
Style/Proc:
- Enabled: true
+ Enabled: True
Style/RaiseArgs:
- Enabled: true
+ Enabled: True
Style/RedundantBegin:
- Enabled: true
+ Enabled: True
Style/RescueModifier:
- Enabled: true
+ Enabled: True
# based on https://github.com/voxpupuli/modulesync_config/issues/168
Style/RegexpLiteral:
EnforcedStyle: percent_r
- Enabled: true
+ Enabled: True
Lint/UnderscorePrefixedVariableName:
- Enabled: true
+ Enabled: True
Metrics/ParameterLists:
- Enabled: false
+ Enabled: False
Lint/RequireParentheses:
- Enabled: true
+ Enabled: True
Style/SpaceBeforeFirstArg:
- Enabled: true
+ Enabled: True
Style/ModuleFunction:
- Enabled: true
+ Enabled: True
Lint/Debugger:
- Enabled: true
+ Enabled: True
Style/IfWithSemicolon:
- Enabled: true
+ Enabled: True
Style/Encoding:
- Enabled: true
+ Enabled: True
Style/BlockDelimiters:
- Enabled: true
+ Enabled: True
Style/MultilineBlockLayout:
- Enabled: true
+ Enabled: True
# 'Complexity' is very relative
Metrics/AbcSize:
@@ -489,10 +489,10 @@ Metrics/PerceivedComplexity:
Enabled: False
Lint/UselessAssignment:
- Enabled: true
+ Enabled: True
Style/ClosingParenthesisIndentation:
- Enabled: false
+ Enabled: False
# RSpec
@@ -503,3 +503,6 @@ RSpec/DescribeClass:
# 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
index 5eb58f0..9e7c9a7 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -31,6 +31,10 @@ matrix:
env: PUPPET_VERSION="~> 4.0" STRICT_VARIABLES="yes" CHECK=rubocop
- rvm: 2.3.1
env: PUPPET_VERSION="~> 4.0" STRICT_VARIABLES="yes" CHECK=test
+ - rvm: 2.4.0-preview1
+ env: PUPPET_VERSION="~> 4.0" STRICT_VARIABLES="yes" CHECK=test
+ allow_failures:
+ - rvm: 2.4.0-preview1
notifications:
email: false
deploy:
diff --git a/Gemfile b/Gemfile
index 90188fe..ddbd23d 100644
--- a/Gemfile
+++ b/Gemfile
@@ -23,10 +23,11 @@ group :test do
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, :git => 'https://github.com/voxpupuli/puppet-blacksmith.git'
+ gem 'puppet-blacksmith', :require => false
gem 'voxpupuli-release', :require => false, :git => 'https://github.com/voxpupuli/voxpupuli-release-gem.git'
gem 'puppet-strings', :require => false, :git => 'https://github.com/puppetlabs/puppetlabs-strings.git'
- gem 'rubocop-rspec', '~> 1.5', :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
@@ -50,9 +51,9 @@ end
if facterversion = ENV['FACTER_GEM_VERSION']
-gem 'facter', facterversion.to_s, :require => false, :groups => [:test]
+ gem 'facter', facterversion.to_s, :require => false, :groups => [:test]
else
-gem 'facter', :require => false, :groups => [:test]
+ gem 'facter', :require => false, :groups => [:test]
end
ENV['PUPPET_VERSION'].nil? ? puppetversion = '~> 4.0' : puppetversion = ENV['PUPPET_VERSION'].to_s
diff --git a/Rakefile b/Rakefile
index 56ffc74..9cbcf7c 100644
--- a/Rakefile
+++ b/Rakefile
@@ -1,12 +1,15 @@
require 'puppetlabs_spec_helper/rake_tasks'
require 'puppet_blacksmith/rake_tasks'
require 'voxpupuli/release/rake_tasks'
-require 'rubocop/rake_task'
require 'puppet-strings/rake_tasks'
-RuboCop::RakeTask.new(:rubocop) do |task|
- # These make the rubocop experience maybe slightly less terrible
- task.options = ['-D', '-S', '-E']
+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}'
diff --git a/manifests/init.pp b/manifests/init.pp
index 7b09d0a..5460948 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -21,31 +21,65 @@ class unattended_upgrades (
$options = {},
) inherits ::unattended_upgrades::params {
- if $legacy_origin == undef or $origins == undef {
- fail('Please explicitly specify unattended_upgrades::legacy_origin and unattended_upgrades::origins.')
- }
+ validate_hash($age)
+ $_age = merge($::unattended_upgrades::default_age, $age)
+ validate_integer($_age['min'], undef, 0)
+ validate_integer($_age['max'], undef, 0)
- validate_bool(
- $install_on_shutdown,
- $legacy_origin,
- $minimal_steps,
- )
- validate_array($blacklist)
- validate_array($origins)
validate_hash($auto)
$_auto = merge($::unattended_upgrades::default_auto, $auto)
- validate_hash($mail)
- if $mail['only_on_error'] {
- validate_bool($mail['only_on_error'])
- }
- $_mail = merge($::unattended_upgrades::default_mail, $mail)
+ validate_integer($_auto['clean'], undef, 0)
+ validate_bool($_auto['fix_interrupted_dpkg'])
+ validate_bool($_auto['reboot'])
+ validate_string($_auto['reboot_time'])
+ validate_bool($_auto['remove'])
+
validate_hash($backup)
$_backup = merge($::unattended_upgrades::default_backup, $backup)
- validate_hash($age)
- $_age = merge($::unattended_upgrades::default_age, $age)
- validate_integer($size)
+ validate_integer($_backup['archive_interval'], undef, 0)
+ validate_integer($_backup['level'], undef, 0)
+
+ validate_array($blacklist)
+
+ if $dl_limit != undef {
+ validate_integer($dl_limit, undef, 0)
+ }
+
+ validate_integer($enable, 1, 0)
+
+ validate_bool($install_on_shutdown)
+
+ validate_bool($legacy_origin)
+
+ validate_hash($mail)
+ $_mail = merge($::unattended_upgrades::default_mail, $mail)
+ validate_bool($_mail['only_on_error'])
+
+ validate_bool($minimal_steps)
+
+ validate_array($origins)
+
+ validate_string($package_ensure)
+
+ if $random_sleep != undef {
+ validate_integer($random_sleep, undef, 0)
+ }
+
+ validate_integer($size, undef, 0)
+
+ validate_integer($update, undef, 0)
+
+ validate_integer($upgrade, undef, 0)
+
validate_hash($upgradeable_packages)
$_upgradeable_packages = merge($::unattended_upgrades::default_upgradeable_packages, $upgradeable_packages)
+ validate_integer($_upgradeable_packages['download_only'], undef, 0)
+ validate_integer($_upgradeable_packages['debdelta'], undef, 0)
+
+ validate_integer($verbose, undef, 0)
+
+ validate_bool($notify_update)
+
validate_hash($options)
$_options = merge($unattended_upgrades::default_options, $options)
validate_bool($_options['force_confdef'])
diff --git a/spec/default_facts.yml b/spec/default_facts.yml
new file mode 100644
index 0000000..a3f52bf
--- /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 047b126..2d8b165 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -3,15 +3,13 @@ require 'rspec-puppet-facts'
include RspecPuppetFacts
RSpec.configure do |c|
- c.default_facts = {
- concat_basedir: '/tmp',
- is_pe: false,
- selinux_config_mode: 'disabled',
+ default_facts = {
puppetversion: Puppet.version,
- facterversion: Facter.version,
- ipaddress: '172.16.254.254',
- macaddress: 'AA:AA:AA:AA:AA:AA'
+ 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