mirror of
https://github.com/philippdieter/puppet-ldapquery.git
synced 2025-10-13 12:55:48 +00:00
modulesync 2017-02-07
This commit is contained in:
parent
589a63b10e
commit
5e4e0671ef
23
.gitignore
vendored
23
.gitignore
vendored
@ -1,7 +1,18 @@
|
|||||||
|
pkg/
|
||||||
|
Gemfile.lock
|
||||||
|
Gemfile.local
|
||||||
|
vendor/
|
||||||
|
.vendor/
|
||||||
|
spec/fixtures/manifests/
|
||||||
|
spec/fixtures/modules/
|
||||||
|
.vagrant/
|
||||||
|
.bundle/
|
||||||
|
coverage/
|
||||||
|
log/
|
||||||
|
.idea/
|
||||||
|
.dependencies/
|
||||||
|
.librarian/
|
||||||
|
Puppetfile.lock
|
||||||
|
*.iml
|
||||||
.*.sw?
|
.*.sw?
|
||||||
pkg
|
.yardoc/
|
||||||
spec/fixtures
|
|
||||||
.rspec_system
|
|
||||||
.vagrant
|
|
||||||
.bundle
|
|
||||||
vendor
|
|
||||||
|
1
.msync.yml
Normal file
1
.msync.yml
Normal file
@ -0,0 +1 @@
|
|||||||
|
modulesync_config_version: '0.19.3'
|
1
.pmtignore
Normal file
1
.pmtignore
Normal file
@ -0,0 +1 @@
|
|||||||
|
docs/
|
531
.rubocop.yml
Normal file
531
.rubocop.yml
Normal file
@ -0,0 +1,531 @@
|
|||||||
|
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
|
||||||
|
|
||||||
|
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.
|
||||||
|
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
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
# disabled for simpler testing on multiple platforms in case statement
|
||||||
|
RSpec/RepeatedExample:
|
||||||
|
Enabled: False
|
||||||
|
|
||||||
|
RSpec/NestedGroups:
|
||||||
|
Enabled: False
|
||||||
|
|
||||||
|
# disable Yaml safe_load. This is needed to support ruby2.0.0 development envs
|
||||||
|
Security/YAMLLoad:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Security/MarshalLoad:
|
||||||
|
Enabled: false
|
9
.sync.yml
Normal file
9
.sync.yml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
Gemfile:
|
||||||
|
optional:
|
||||||
|
':extra':
|
||||||
|
- gem: 'net-ldap'
|
||||||
|
version: '~> 0.12.1'
|
||||||
|
':testextra':
|
||||||
|
- gem: 'rspec-mocks'
|
||||||
|
- gem: 'rspec-expectations'
|
||||||
|
mock_with: ':rspec
|
48
.travis.yml
48
.travis.yml
@ -1,16 +1,36 @@
|
|||||||
---
|
---
|
||||||
language: ruby
|
|
||||||
bundler_args: --without development system_tests
|
|
||||||
before_install: rm Gemfile.lock || true
|
|
||||||
rvm:
|
|
||||||
- 1.9.3
|
|
||||||
- 2.0.0
|
|
||||||
- 2.1.0
|
|
||||||
script: bundle exec rake test
|
|
||||||
env:
|
|
||||||
- PUPPET_VERSION="~> 3.6.0" STRICT_VARIABLES=yes
|
|
||||||
- PUPPET_VERSION="~> 3.7.0" STRICT_VARIABLES=yes FUTURE_PARSER=yes
|
|
||||||
- PUPPET_VERSION="~> 3.8.3" STRICT_VARIABLES=yes FUTURE_PARSER=yes
|
|
||||||
- PUPPET_VERSION="~> 4.2.3"
|
|
||||||
- PUPPET_VERSION="~> 4.3.2"
|
|
||||||
sudo: false
|
sudo: false
|
||||||
|
dist: trusty
|
||||||
|
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: 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=test
|
||||||
|
- rvm: 2.4.0
|
||||||
|
env: PUPPET_VERSION="~> 4.0" CHECK=test
|
||||||
|
- rvm: 2.4.0
|
||||||
|
env: PUPPET_VERSION="~> 4.0" CHECK=rubocop
|
||||||
|
- rvm: 2.4.0
|
||||||
|
env: PUPPET_VERSION="~> 4.0" CHECK=build
|
||||||
|
branches:
|
||||||
|
only:
|
||||||
|
- master
|
||||||
|
- /^v\d/
|
||||||
|
notifications:
|
||||||
|
email: false
|
||||||
|
77
Gemfile
77
Gemfile
@ -1,27 +1,66 @@
|
|||||||
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
|
group :test do
|
||||||
gem "rake"
|
gem 'puppetlabs_spec_helper', '~> 1.2.2', :require => false
|
||||||
gem "puppet", ENV['PUPPET_VERSION'] || '~> 3.7.0'
|
gem 'rspec-puppet', '~> 2.5', :require => false
|
||||||
gem "rspec", '< 3.2.0'
|
gem 'rspec-puppet-facts', :require => false
|
||||||
gem 'rspec-core'
|
gem 'rspec-puppet-utils', :require => false
|
||||||
gem 'rspec-mocks'
|
gem 'puppet-lint-absolute_classname-check', :require => false
|
||||||
gem 'rspec-expectations'
|
gem 'puppet-lint-leading_zero-check', :require => false
|
||||||
gem "rspec-puppet", :git => 'https://github.com/rodjek/rspec-puppet.git'
|
gem 'puppet-lint-trailing_comma-check', :require => false
|
||||||
gem "puppetlabs_spec_helper"
|
gem 'puppet-lint-version_comparison-check', :require => false
|
||||||
gem "metadata-json-lint"
|
gem 'puppet-lint-classes_and_types_beginning_with_digits-check', :require => false
|
||||||
gem "rspec-puppet-facts"
|
gem 'puppet-lint-unquoted_string-check', :require => false
|
||||||
gem 'net-ldap', '~> 0.12.1'
|
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 '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
|
||||||
|
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
|
end
|
||||||
|
|
||||||
group :development do
|
group :development do
|
||||||
gem "travis"
|
gem 'travis', :require => false
|
||||||
gem "travis-lint"
|
gem 'travis-lint', :require => false
|
||||||
gem "vagrant-wrapper"
|
gem 'guard-rake', :require => false
|
||||||
gem "puppet-blacksmith"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
group :system_tests do
|
group :extra do
|
||||||
gem "beaker"
|
gem 'net-ldap', '~> 0.12.1', :require => false
|
||||||
gem "beaker-rspec"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
group :testextra do
|
||||||
|
gem 'rspec-mocks'
|
||||||
|
gem 'rspec-expectations'
|
||||||
|
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
|
||||||
|
76
Rakefile
76
Rakefile
@ -1,56 +1,44 @@
|
|||||||
require 'puppetlabs_spec_helper/rake_tasks'
|
require 'puppetlabs_spec_helper/rake_tasks'
|
||||||
require 'puppet/version'
|
require 'puppet_blacksmith/rake_tasks'
|
||||||
require 'puppet/vendor/semantic/lib/semantic' unless Puppet.version.to_f < 3.6
|
require 'voxpupuli/release/rake_tasks'
|
||||||
require 'puppet-lint/tasks/puppet-lint'
|
require 'puppet-strings/tasks'
|
||||||
require 'puppet-syntax/tasks/puppet-syntax'
|
|
||||||
|
|
||||||
# These gems aren't always present, for instance
|
PuppetLint.configuration.log_format = '%{path}:%{line}:%{check}:%{KIND}:%{message}'
|
||||||
# on Travis with --without development
|
|
||||||
begin
|
|
||||||
require 'puppet_blacksmith/rake_tasks'
|
|
||||||
rescue LoadError
|
|
||||||
end
|
|
||||||
|
|
||||||
Rake::Task[:lint].clear
|
|
||||||
|
|
||||||
PuppetLint.configuration.relative = true
|
|
||||||
PuppetLint.configuration.send("disable_80chars")
|
|
||||||
PuppetLint.configuration.log_format = "%{path}:%{linenumber}:%{check}:%{KIND}:%{message}"
|
|
||||||
PuppetLint.configuration.fail_on_warnings = true
|
PuppetLint.configuration.fail_on_warnings = true
|
||||||
|
PuppetLint.configuration.send('relative')
|
||||||
# Forsake support for Puppet 2.6.2 for the benefit of cleaner code.
|
PuppetLint.configuration.send('disable_140chars')
|
||||||
# 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.send('disable_class_inherits_from_params_class')
|
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 = [
|
exclude_paths = %w(
|
||||||
"bundle/**/*",
|
pkg/**/*
|
||||||
"pkg/**/*",
|
vendor/**/*
|
||||||
"vendor/**/*",
|
.vendor/**/*
|
||||||
"spec/**/*",
|
spec/**/*
|
||||||
]
|
)
|
||||||
PuppetLint.configuration.ignore_paths = exclude_paths
|
PuppetLint.configuration.ignore_paths = exclude_paths
|
||||||
PuppetSyntax.exclude_paths = exclude_paths
|
PuppetSyntax.exclude_paths = exclude_paths
|
||||||
|
|
||||||
desc "Run acceptance tests"
|
desc 'Run acceptance tests'
|
||||||
RSpec::Core::RakeTask.new(:acceptance) do |t|
|
RSpec::Core::RakeTask.new(:acceptance) do |t|
|
||||||
t.pattern = 'spec/**/*.rb'
|
t.pattern = 'spec/acceptance'
|
||||||
end
|
end
|
||||||
|
|
||||||
desc "Populate CONTRIBUTORS file"
|
desc 'Run tests metadata_lint, release_checks'
|
||||||
task :contributors do
|
task test: [
|
||||||
system("git log --format='%aN' | sort -u > CONTRIBUTORS")
|
:metadata_lint,
|
||||||
end
|
:release_checks,
|
||||||
|
|
||||||
task :metadata do
|
|
||||||
sh "metadata-json-lint metadata.json"
|
|
||||||
end
|
|
||||||
|
|
||||||
desc "Run syntax, lint, and spec tests."
|
|
||||||
task :test => [
|
|
||||||
:syntax,
|
|
||||||
:lint,
|
|
||||||
:spec,
|
|
||||||
:metadata,
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
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
|
||||||
|
@ -11,14 +11,14 @@ require_relative '../../../puppet_x/ldapquery'
|
|||||||
begin
|
begin
|
||||||
require 'net/ldap'
|
require 'net/ldap'
|
||||||
rescue
|
rescue
|
||||||
Puppet.warn("Missing net/ldap gem required for ldapquery() function")
|
Puppet.warn('Missing net/ldap gem required for ldapquery() function')
|
||||||
end
|
end
|
||||||
|
|
||||||
Puppet::Parser::Functions.newfunction(:ldapquery,
|
Puppet::Parser::Functions.newfunction(:ldapquery,
|
||||||
:type => :rvalue) do |args|
|
type: :rvalue) do |args|
|
||||||
|
|
||||||
if args.size > 4
|
if args.size > 4
|
||||||
raise Puppet::ParseError, "Too many arguments received in ldapquery()"
|
raise Puppet::ParseError, 'Too many arguments received in ldapquery()'
|
||||||
end
|
end
|
||||||
|
|
||||||
filter, attributes, base, scope = args
|
filter, attributes, base, scope = args
|
||||||
|
@ -7,44 +7,44 @@ module PuppetX
|
|||||||
|
|
||||||
def initialize(
|
def initialize(
|
||||||
filter,
|
filter,
|
||||||
attributes=[],
|
attributes = [],
|
||||||
base=Puppet[:ldapbase],
|
base = Puppet[:ldapbase],
|
||||||
scope='sub'
|
scope = 'sub'
|
||||||
)
|
)
|
||||||
@filter = filter
|
@filter = filter
|
||||||
@attributes = attributes
|
@attributes = attributes
|
||||||
@base = base
|
@base = base
|
||||||
|
|
||||||
if scope
|
return unless scope
|
||||||
if scope == 'sub'
|
|
||||||
@scope = Net::LDAP::SearchScope_WholeSubtree
|
if scope == 'sub'
|
||||||
elsif scope == 'base'
|
@scope = Net::LDAP::SearchScope_WholeSubtree
|
||||||
@scope = Net::LDAP::SearchScope_BaseObject
|
elsif scope == 'base'
|
||||||
elsif scope == 'single'
|
@scope = Net::LDAP::SearchScope_BaseObject
|
||||||
@scope = Net::LDAP::SearchScope_SingleLevel
|
elsif scope == 'single'
|
||||||
else
|
@scope = Net::LDAP::SearchScope_SingleLevel
|
||||||
raise Puppet::ParseError, 'Received param "scope" not one of ["sub","base","single"]'
|
else
|
||||||
end
|
raise Puppet::ParseError, 'Received param "scope" not one of ["sub","base","single"]'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_config
|
def ldap_config
|
||||||
# Load the configuration variables from Puppet
|
# Load the configuration variables from Puppet
|
||||||
required_vars = [
|
required_vars = [
|
||||||
:ldapserver,
|
:ldapserver,
|
||||||
:ldapport,
|
:ldapport
|
||||||
]
|
]
|
||||||
|
|
||||||
required_vars.each {|r|
|
required_vars.each do |r|
|
||||||
unless Puppet[r]
|
unless Puppet[r]
|
||||||
raise Puppet::ParseError, "Missing required setting '#{r.to_s}' in puppet.conf"
|
raise Puppet::ParseError, "Missing required setting '#{r}' in puppet.conf"
|
||||||
end
|
end
|
||||||
}
|
end
|
||||||
|
|
||||||
host = Puppet[:ldapserver]
|
host = Puppet[:ldapserver]
|
||||||
port = Puppet[:ldapport]
|
port = Puppet[:ldapport]
|
||||||
|
|
||||||
if Puppet[:ldapuser] and Puppet[:ldappassword]
|
if Puppet[:ldapuser] && Puppet[:ldappassword]
|
||||||
user = Puppet[:ldapuser]
|
user = Puppet[:ldapuser]
|
||||||
password = Puppet[:ldappassword]
|
password = Puppet[:ldappassword]
|
||||||
end
|
end
|
||||||
@ -53,45 +53,45 @@ module PuppetX
|
|||||||
ca_file = "#{Puppet[:confdir]}/ldap_ca.pem"
|
ca_file = "#{Puppet[:confdir]}/ldap_ca.pem"
|
||||||
|
|
||||||
conf = {
|
conf = {
|
||||||
:host => host,
|
host: host,
|
||||||
:port => port,
|
port: port
|
||||||
}
|
}
|
||||||
|
|
||||||
if user != '' and password != ''
|
if (user != '') && (password != '')
|
||||||
conf[:auth] = {
|
conf[:auth] = {
|
||||||
:method => :simple,
|
method: :simple,
|
||||||
:username => user,
|
username: user,
|
||||||
:password => password,
|
password: password
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
if tls
|
if tls
|
||||||
conf[:encryption] = {
|
conf[:encryption] = {
|
||||||
:method => :simple_tls,
|
method: :simple_tls,
|
||||||
:tls_options => { :ca_file => ca_file }
|
tls_options: { ca_file: ca_file }
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
return conf
|
conf
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_entries()
|
def entries
|
||||||
# Query the LDAP server for attributes using the filter
|
# Query the LDAP server for attributes using the filter
|
||||||
#
|
#
|
||||||
# Returns: An array of Net::LDAP::Entry objects
|
# Returns: An array of Net::LDAP::Entry objects
|
||||||
conf = self.get_config()
|
conf = ldap_config
|
||||||
|
|
||||||
start_time = Time.now
|
start_time = Time.now
|
||||||
ldap = Net::LDAP.new(conf)
|
ldap = Net::LDAP.new(conf)
|
||||||
|
|
||||||
search_args = {
|
search_args = {
|
||||||
:base => @base,
|
base: @base,
|
||||||
:attributes => @attributes,
|
attributes: @attributes,
|
||||||
:scope => @scope,
|
scope: @scope,
|
||||||
:time => 10,
|
time: 10
|
||||||
}
|
}
|
||||||
|
|
||||||
if @filter and @filter.length > 0
|
if @filter && !@filter.empty?
|
||||||
ldapfilter = Net::LDAP::Filter.construct(@filter)
|
ldapfilter = Net::LDAP::Filter.construct(@filter)
|
||||||
search_args[:filter] = ldapfilter
|
search_args[:filter] = ldapfilter
|
||||||
end
|
end
|
||||||
@ -103,11 +103,11 @@ module PuppetX
|
|||||||
entries << entry
|
entries << entry
|
||||||
end
|
end
|
||||||
end_time = Time.now
|
end_time = Time.now
|
||||||
time_delta = sprintf('%.3f', end_time - start_time)
|
time_delta = format('%.3f', end_time - start_time)
|
||||||
|
|
||||||
Puppet.debug("ldapquery(): Searching #{@base} for #{@attributes} using #{@filter} took #{time_delta} seconds and returned #{entries.length} results")
|
Puppet.debug("ldapquery(): Searching #{@base} for #{@attributes} using #{@filter} took #{time_delta} seconds and returned #{entries.length} results")
|
||||||
return entries
|
return entries
|
||||||
rescue Exception => e
|
rescue LdapError => e
|
||||||
Puppet.debug("There was an error searching LDAP #{e.message}")
|
Puppet.debug("There was an error searching LDAP #{e.message}")
|
||||||
Puppet.debug('Returning false')
|
Puppet.debug('Returning false')
|
||||||
return false
|
return false
|
||||||
@ -116,11 +116,9 @@ module PuppetX
|
|||||||
|
|
||||||
def parse_entries
|
def parse_entries
|
||||||
data = []
|
data = []
|
||||||
entries = get_entries()
|
|
||||||
entries.each do |entry|
|
entries.each do |entry|
|
||||||
entry_data = {}
|
entry_data = {}
|
||||||
entry.each do |attribute, values|
|
entry.each do |attribute, values|
|
||||||
|
|
||||||
attr = attribute.to_s
|
attr = attribute.to_s
|
||||||
value_data = []
|
value_data = []
|
||||||
Array(values).flatten.each do |v|
|
Array(values).flatten.each do |v|
|
||||||
@ -131,7 +129,7 @@ module PuppetX
|
|||||||
data << entry_data
|
data << entry_data
|
||||||
end
|
end
|
||||||
Puppet.debug(data)
|
Puppet.debug(data)
|
||||||
return data
|
data
|
||||||
end
|
end
|
||||||
|
|
||||||
def results
|
def results
|
||||||
|
4
spec/classes/coverage_spec.rb
Normal file
4
spec/classes/coverage_spec.rb
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
require 'rspec-puppet'
|
||||||
|
|
||||||
|
at_exit { RSpec::Puppet::Coverage.report! }
|
||||||
|
# vim: syntax=ruby
|
14
spec/default_facts.yml
Normal file
14
spec/default_facts.yml
Normal file
@ -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"
|
@ -1,10 +1,33 @@
|
|||||||
require 'puppetlabs_spec_helper/module_spec_helper'
|
require 'puppetlabs_spec_helper/module_spec_helper'
|
||||||
require 'rspec-puppet'
|
require 'rspec-puppet-facts'
|
||||||
|
include RspecPuppetFacts
|
||||||
|
|
||||||
fixture_path = File.expand_path(File.join(__FILE__, '..', 'fixtures'))
|
if Dir.exist?(File.expand_path('../../lib', __FILE__))
|
||||||
|
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|
|
RSpec.configure do |c|
|
||||||
c.module_path = File.join(fixture_path, 'modules')
|
default_facts = {
|
||||||
c.manifest_dir = File.join(fixture_path, 'manifests')
|
puppetversion: Puppet.version,
|
||||||
c.mock_framework = :rspec
|
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
|
||||||
|
c.mock_with :rspec
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# vim: syntax=ruby
|
||||||
|
@ -4,62 +4,64 @@ require 'net/ldap'
|
|||||||
|
|
||||||
describe 'PuppetX::LDAPquery' do
|
describe 'PuppetX::LDAPquery' do
|
||||||
describe 'results' do
|
describe 'results' do
|
||||||
let (:conf) { {
|
let(:conf) do
|
||||||
:host => 'ldap.example.com',
|
{
|
||||||
:port => 9009,
|
host: 'ldap.example.com',
|
||||||
} }
|
port: 9009
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
let (:base) { 'dc=example,dc=com' }
|
let(:base) { 'dc=example,dc=com' }
|
||||||
|
|
||||||
it "should fail with no filter" do
|
it 'fails with no filter' do
|
||||||
filter = ''
|
filter = ''
|
||||||
attributes = ['uid']
|
attributes = ['uid']
|
||||||
expect { PuppetX::LDAPquery.new(filter, attributes).results }.to raise_error
|
expect { PuppetX::LDAPquery.new(filter, attributes).results }.to raise_error
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should not fail when using defaults in puppet.conf" do
|
it 'does not fail when using defaults in puppet.conf' do
|
||||||
filter = '(uid=zach)'
|
filter = '(uid=zach)'
|
||||||
attributes = ['uid']
|
attributes = ['uid']
|
||||||
l = PuppetX::LDAPquery.new(filter, attributes, base)
|
l = PuppetX::LDAPquery.new(filter, attributes, base)
|
||||||
expect { l.get_config }.to_not raise_error
|
expect { l.ldap_config }.not_to raise_error
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should return the desired results' do
|
it 'returns the desired results' do
|
||||||
filter = '(uid=zach)'
|
filter = '(uid=zach)'
|
||||||
attributes = ['uid']
|
attributes = ['uid']
|
||||||
|
|
||||||
wanted = [{"dn"=>["uid=zach,ou=users,dc=puppetlabs,dc=com"], "uid"=>["zach"]}]
|
wanted = [{ 'dn' => ['uid=zach,ou=users,dc=puppetlabs,dc=com'], 'uid' => ['zach'] }]
|
||||||
entries = Marshal.load(File.read("spec/fixtures/entries_single.obj"))
|
entries = Marshal.load(File.read('spec/fixtures/entries_single.obj'))
|
||||||
|
|
||||||
l = PuppetX::LDAPquery.new(filter, attributes, base)
|
l = PuppetX::LDAPquery.new(filter, attributes, base)
|
||||||
|
|
||||||
expect(l).to receive(:get_entries).and_return(entries)
|
allow(l).to receive(:entries).and_return(entries)
|
||||||
expect(l.results).to eq(wanted)
|
expect(l.results).to eq(wanted)
|
||||||
end
|
end
|
||||||
|
|
||||||
context "a multivalued attribute is requested" do
|
context 'a multivalued attribute is requested' do
|
||||||
it 'should return the attribute values as an array to the attribute' do
|
it 'returns the attribute values as an array to the attribute' do
|
||||||
filter = '(uid=zach)'
|
filter = '(uid=zach)'
|
||||||
attributes = ['objectClass']
|
attributes = ['objectClass']
|
||||||
|
|
||||||
wanted =[{"dn"=>["uid=zach,ou=users,dc=puppetlabs,dc=com"], "objectclass"=>["posixAccount", "shadowAccount", "inetOrgPerson", "puppetPerson", "ldapPublicKey", "top"]}]
|
wanted = [{ 'dn' => ['uid=zach,ou=users,dc=puppetlabs,dc=com'], 'objectclass' => %w(posixAccount shadowAccount inetOrgPerson puppetPerson ldapPublicKey top) }]
|
||||||
|
|
||||||
entries = Marshal.load(File.read("spec/fixtures/entries_objectClass.obj"))
|
entries = Marshal.load(File.read('spec/fixtures/entries_objectClass.obj'))
|
||||||
|
|
||||||
l = PuppetX::LDAPquery.new(filter, attributes, base)
|
l = PuppetX::LDAPquery.new(filter, attributes, base)
|
||||||
expect(l).to receive(:get_entries).and_return(entries)
|
allow(l).to receive(:entries).and_return(entries)
|
||||||
expect(l.results).to eq(wanted)
|
expect(l.results).to eq(wanted)
|
||||||
end
|
end
|
||||||
it 'should return the attributes without new lines' do
|
it 'returns the attributes without new lines' do
|
||||||
filter = '(uid=zach)'
|
filter = '(uid=zach)'
|
||||||
attributes = ['sshPublicKey']
|
attributes = ['sshPublicKey']
|
||||||
|
|
||||||
wanted = [{"dn"=>["uid=zach,ou=users,dc=puppetlabs,dc=com"], "sshpublickey"=>["ssh-rsa AAAAB...1== user@somewhere", "ssh-rsa AAAAB...2== user@somewhereelse"]}]
|
wanted = [{ 'dn' => ['uid=zach,ou=users,dc=puppetlabs,dc=com'], 'sshpublickey' => ['ssh-rsa AAAAB...1== user@somewhere', 'ssh-rsa AAAAB...2== user@somewhereelse'] }]
|
||||||
|
|
||||||
entries = Marshal.load(File.read("spec/fixtures/entries_multivalue.obj"))
|
entries = Marshal.load(File.read('spec/fixtures/entries_multivalue.obj'))
|
||||||
|
|
||||||
l = PuppetX::LDAPquery.new(filter, attributes, base)
|
l = PuppetX::LDAPquery.new(filter, attributes, base)
|
||||||
expect(l).to receive(:get_entries).and_return(entries)
|
allow(l).to receive(:entries).and_return(entries)
|
||||||
expect(l.results).to eq(wanted)
|
expect(l.results).to eq(wanted)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user