mirror of
https://github.com/ardichoke/puppet-arpwatch.git
synced 2026-05-11 02:15:37 -04:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a9dfc7fa45 | |||
|
|
93243c7912 | ||
|
|
2284b701e9 | ||
|
|
c036916a53 | ||
| f1f8aaa4ab | |||
| 6219c146c7 | |||
| 41d9b4d879 |
6
.devcontainer/Dockerfile
Normal file
6
.devcontainer/Dockerfile
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
FROM puppet/pdk:latest
|
||||||
|
|
||||||
|
# [Optional] Uncomment this section to install additional packages.
|
||||||
|
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
|
||||||
|
# && apt-get -y install --no-install-recommends <your-package-list-here>
|
||||||
|
|
||||||
23
.devcontainer/devcontainer.json
Normal file
23
.devcontainer/devcontainer.json
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
|
||||||
|
// https://github.com/microsoft/vscode-dev-containers/tree/v0.140.1/containers/puppet
|
||||||
|
{
|
||||||
|
"name": "Puppet Development Kit (Community)",
|
||||||
|
"dockerFile": "Dockerfile",
|
||||||
|
|
||||||
|
// Set *default* container specific settings.json values on container create.
|
||||||
|
"settings": {
|
||||||
|
"terminal.integrated.shell.linux": "/bin/bash"
|
||||||
|
},
|
||||||
|
|
||||||
|
// Add the IDs of extensions you want installed when the container is created.
|
||||||
|
"extensions": [
|
||||||
|
"puppet.puppet-vscode",
|
||||||
|
"rebornix.Ruby"
|
||||||
|
]
|
||||||
|
|
||||||
|
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
||||||
|
// "forwardPorts": [],
|
||||||
|
|
||||||
|
// Use 'postCreateCommand' to run commands after the container is created.
|
||||||
|
// "postCreateCommand": "pdk --version",
|
||||||
|
}
|
||||||
5
.gitattributes
vendored
Normal file
5
.gitattributes
vendored
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
*.rb eol=lf
|
||||||
|
*.erb eol=lf
|
||||||
|
*.pp eol=lf
|
||||||
|
*.sh eol=lf
|
||||||
|
*.epp eol=lf
|
||||||
29
.gitignore
vendored
29
.gitignore
vendored
@@ -1 +1,28 @@
|
|||||||
pkg/
|
.git/
|
||||||
|
.*.sw[op]
|
||||||
|
.metadata
|
||||||
|
.yardoc
|
||||||
|
.yardwarns
|
||||||
|
*.iml
|
||||||
|
/.bundle/
|
||||||
|
/.idea/
|
||||||
|
/.vagrant/
|
||||||
|
/coverage/
|
||||||
|
/bin/
|
||||||
|
/doc/
|
||||||
|
/Gemfile.local
|
||||||
|
/Gemfile.lock
|
||||||
|
/junit/
|
||||||
|
/log/
|
||||||
|
/pkg/
|
||||||
|
/spec/fixtures/manifests/
|
||||||
|
/spec/fixtures/modules/
|
||||||
|
/tmp/
|
||||||
|
/vendor/
|
||||||
|
/convert_report.txt
|
||||||
|
/update_report.txt
|
||||||
|
.DS_Store
|
||||||
|
.project
|
||||||
|
.envrc
|
||||||
|
/inventory.yaml
|
||||||
|
/spec/fixtures/litmus_inventory.yaml
|
||||||
|
|||||||
53
.gitlab-ci.yml
Normal file
53
.gitlab-ci.yml
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
---
|
||||||
|
stages:
|
||||||
|
- syntax
|
||||||
|
- unit
|
||||||
|
|
||||||
|
default:
|
||||||
|
cache:
|
||||||
|
paths:
|
||||||
|
- vendor/bundle
|
||||||
|
|
||||||
|
before_script: &before_script
|
||||||
|
- bundle -v
|
||||||
|
- rm Gemfile.lock || true
|
||||||
|
- "# Update system gems if requested. This is useful to temporarily workaround troubles in the test runner"
|
||||||
|
- "# Set `rubygems_version` in the .sync.yml to set a value"
|
||||||
|
- "# Ignore exit code of SIGPIPE'd yes to not fail with shell's pipefail set"
|
||||||
|
- '[ -z "$RUBYGEMS_VERSION" ] || (yes || true) | gem update --system $RUBYGEMS_VERSION'
|
||||||
|
- gem --version
|
||||||
|
- bundle -v
|
||||||
|
- bundle install --without system_tests --path vendor/bundle --jobs $(nproc)
|
||||||
|
|
||||||
|
syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop-Ruby 2.5.7-Puppet ~> 6:
|
||||||
|
stage: syntax
|
||||||
|
image: ruby:2.5.7
|
||||||
|
script:
|
||||||
|
- bundle exec rake syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop
|
||||||
|
variables:
|
||||||
|
PUPPET_GEM_VERSION: '~> 6'
|
||||||
|
|
||||||
|
parallel_spec-Ruby 2.5.7-Puppet ~> 6:
|
||||||
|
stage: unit
|
||||||
|
image: ruby:2.5.7
|
||||||
|
script:
|
||||||
|
- bundle exec rake parallel_spec
|
||||||
|
variables:
|
||||||
|
PUPPET_GEM_VERSION: '~> 6'
|
||||||
|
|
||||||
|
syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop-Ruby 2.7.2-Puppet ~> 7:
|
||||||
|
stage: syntax
|
||||||
|
image: ruby:2.7.2
|
||||||
|
script:
|
||||||
|
- bundle exec rake syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop
|
||||||
|
variables:
|
||||||
|
PUPPET_GEM_VERSION: '~> 7'
|
||||||
|
|
||||||
|
parallel_spec-Ruby 2.7.2-Puppet ~> 7:
|
||||||
|
stage: unit
|
||||||
|
image: ruby:2.7.2
|
||||||
|
script:
|
||||||
|
- bundle exec rake parallel_spec
|
||||||
|
variables:
|
||||||
|
PUPPET_GEM_VERSION: '~> 7'
|
||||||
|
|
||||||
47
.pdkignore
Normal file
47
.pdkignore
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
.git/
|
||||||
|
.*.sw[op]
|
||||||
|
.metadata
|
||||||
|
.yardoc
|
||||||
|
.yardwarns
|
||||||
|
*.iml
|
||||||
|
/.bundle/
|
||||||
|
/.idea/
|
||||||
|
/.vagrant/
|
||||||
|
/coverage/
|
||||||
|
/bin/
|
||||||
|
/doc/
|
||||||
|
/Gemfile.local
|
||||||
|
/Gemfile.lock
|
||||||
|
/junit/
|
||||||
|
/log/
|
||||||
|
/pkg/
|
||||||
|
/spec/fixtures/manifests/
|
||||||
|
/spec/fixtures/modules/
|
||||||
|
/tmp/
|
||||||
|
/vendor/
|
||||||
|
/convert_report.txt
|
||||||
|
/update_report.txt
|
||||||
|
.DS_Store
|
||||||
|
.project
|
||||||
|
.envrc
|
||||||
|
/inventory.yaml
|
||||||
|
/spec/fixtures/litmus_inventory.yaml
|
||||||
|
/appveyor.yml
|
||||||
|
/.editorconfig
|
||||||
|
/.fixtures.yml
|
||||||
|
/Gemfile
|
||||||
|
/.gitattributes
|
||||||
|
/.gitignore
|
||||||
|
/.gitlab-ci.yml
|
||||||
|
/.pdkignore
|
||||||
|
/.puppet-lint.rc
|
||||||
|
/Rakefile
|
||||||
|
/rakelib/
|
||||||
|
/.rspec
|
||||||
|
/.rubocop.yml
|
||||||
|
/.travis.yml
|
||||||
|
/.yardopts
|
||||||
|
/spec/
|
||||||
|
/.vscode/
|
||||||
|
/.sync.yml
|
||||||
|
/.devcontainer/
|
||||||
1
.puppet-lint.rc
Normal file
1
.puppet-lint.rc
Normal file
@@ -0,0 +1 @@
|
|||||||
|
--relative
|
||||||
519
.rubocop.yml
Normal file
519
.rubocop.yml
Normal file
@@ -0,0 +1,519 @@
|
|||||||
|
---
|
||||||
|
require:
|
||||||
|
- rubocop-performance
|
||||||
|
- rubocop-rspec
|
||||||
|
AllCops:
|
||||||
|
DisplayCopNames: true
|
||||||
|
TargetRubyVersion: '2.4'
|
||||||
|
Include:
|
||||||
|
- "**/*.rb"
|
||||||
|
Exclude:
|
||||||
|
- bin/*
|
||||||
|
- ".vendor/**/*"
|
||||||
|
- "**/Gemfile"
|
||||||
|
- "**/Rakefile"
|
||||||
|
- pkg/**/*
|
||||||
|
- spec/fixtures/**/*
|
||||||
|
- vendor/**/*
|
||||||
|
- "**/Puppetfile"
|
||||||
|
- "**/Vagrantfile"
|
||||||
|
- "**/Guardfile"
|
||||||
|
Layout/LineLength:
|
||||||
|
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
|
||||||
|
RSpec/DescribeSymbol:
|
||||||
|
Exclude:
|
||||||
|
- spec/unit/facter/**/*.rb
|
||||||
|
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:
|
||||||
|
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
|
||||||
|
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/TrailingCommaInArrayLiteral:
|
||||||
|
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
|
||||||
|
RSpec/MessageSpies:
|
||||||
|
EnforcedStyle: receive
|
||||||
|
Style/Documentation:
|
||||||
|
Exclude:
|
||||||
|
- lib/puppet/parser/functions/**/*
|
||||||
|
- spec/**/*
|
||||||
|
Style/WordArray:
|
||||||
|
EnforcedStyle: brackets
|
||||||
|
Performance/AncestorsInclude:
|
||||||
|
Enabled: true
|
||||||
|
Performance/BigDecimalWithNumericArgument:
|
||||||
|
Enabled: true
|
||||||
|
Performance/BlockGivenWithExplicitBlock:
|
||||||
|
Enabled: true
|
||||||
|
Performance/CaseWhenSplat:
|
||||||
|
Enabled: true
|
||||||
|
Performance/ConstantRegexp:
|
||||||
|
Enabled: true
|
||||||
|
Performance/MethodObjectAsBlock:
|
||||||
|
Enabled: true
|
||||||
|
Performance/RedundantSortBlock:
|
||||||
|
Enabled: true
|
||||||
|
Performance/RedundantStringChars:
|
||||||
|
Enabled: true
|
||||||
|
Performance/ReverseFirst:
|
||||||
|
Enabled: true
|
||||||
|
Performance/SortReverse:
|
||||||
|
Enabled: true
|
||||||
|
Performance/Squeeze:
|
||||||
|
Enabled: true
|
||||||
|
Performance/StringInclude:
|
||||||
|
Enabled: true
|
||||||
|
Performance/Sum:
|
||||||
|
Enabled: true
|
||||||
|
Style/CollectionMethods:
|
||||||
|
Enabled: true
|
||||||
|
Style/MethodCalledOnDoEndBlock:
|
||||||
|
Enabled: true
|
||||||
|
Style/StringMethods:
|
||||||
|
Enabled: true
|
||||||
|
Bundler/InsecureProtocolSource:
|
||||||
|
Enabled: false
|
||||||
|
Gemspec/DuplicatedAssignment:
|
||||||
|
Enabled: false
|
||||||
|
Gemspec/OrderedDependencies:
|
||||||
|
Enabled: false
|
||||||
|
Gemspec/RequiredRubyVersion:
|
||||||
|
Enabled: false
|
||||||
|
Gemspec/RubyVersionGlobalsUsage:
|
||||||
|
Enabled: false
|
||||||
|
Layout/ArgumentAlignment:
|
||||||
|
Enabled: false
|
||||||
|
Layout/BeginEndAlignment:
|
||||||
|
Enabled: false
|
||||||
|
Layout/ClosingHeredocIndentation:
|
||||||
|
Enabled: false
|
||||||
|
Layout/EmptyComment:
|
||||||
|
Enabled: false
|
||||||
|
Layout/EmptyLineAfterGuardClause:
|
||||||
|
Enabled: false
|
||||||
|
Layout/EmptyLinesAroundArguments:
|
||||||
|
Enabled: false
|
||||||
|
Layout/EmptyLinesAroundAttributeAccessor:
|
||||||
|
Enabled: false
|
||||||
|
Layout/EndOfLine:
|
||||||
|
Enabled: false
|
||||||
|
Layout/FirstArgumentIndentation:
|
||||||
|
Enabled: false
|
||||||
|
Layout/HashAlignment:
|
||||||
|
Enabled: false
|
||||||
|
Layout/HeredocIndentation:
|
||||||
|
Enabled: false
|
||||||
|
Layout/LeadingEmptyLines:
|
||||||
|
Enabled: false
|
||||||
|
Layout/SpaceAroundMethodCallOperator:
|
||||||
|
Enabled: false
|
||||||
|
Layout/SpaceInsideArrayLiteralBrackets:
|
||||||
|
Enabled: false
|
||||||
|
Layout/SpaceInsideReferenceBrackets:
|
||||||
|
Enabled: false
|
||||||
|
Lint/BigDecimalNew:
|
||||||
|
Enabled: false
|
||||||
|
Lint/BooleanSymbol:
|
||||||
|
Enabled: false
|
||||||
|
Lint/ConstantDefinitionInBlock:
|
||||||
|
Enabled: false
|
||||||
|
Lint/DeprecatedOpenSSLConstant:
|
||||||
|
Enabled: false
|
||||||
|
Lint/DisjunctiveAssignmentInConstructor:
|
||||||
|
Enabled: false
|
||||||
|
Lint/DuplicateElsifCondition:
|
||||||
|
Enabled: false
|
||||||
|
Lint/DuplicateRequire:
|
||||||
|
Enabled: false
|
||||||
|
Lint/DuplicateRescueException:
|
||||||
|
Enabled: false
|
||||||
|
Lint/EmptyConditionalBody:
|
||||||
|
Enabled: false
|
||||||
|
Lint/EmptyFile:
|
||||||
|
Enabled: false
|
||||||
|
Lint/ErbNewArguments:
|
||||||
|
Enabled: false
|
||||||
|
Lint/FloatComparison:
|
||||||
|
Enabled: false
|
||||||
|
Lint/HashCompareByIdentity:
|
||||||
|
Enabled: false
|
||||||
|
Lint/IdentityComparison:
|
||||||
|
Enabled: false
|
||||||
|
Lint/InterpolationCheck:
|
||||||
|
Enabled: false
|
||||||
|
Lint/MissingCopEnableDirective:
|
||||||
|
Enabled: false
|
||||||
|
Lint/MixedRegexpCaptureTypes:
|
||||||
|
Enabled: false
|
||||||
|
Lint/NestedPercentLiteral:
|
||||||
|
Enabled: false
|
||||||
|
Lint/NonDeterministicRequireOrder:
|
||||||
|
Enabled: false
|
||||||
|
Lint/OrderedMagicComments:
|
||||||
|
Enabled: false
|
||||||
|
Lint/OutOfRangeRegexpRef:
|
||||||
|
Enabled: false
|
||||||
|
Lint/RaiseException:
|
||||||
|
Enabled: false
|
||||||
|
Lint/RedundantCopEnableDirective:
|
||||||
|
Enabled: false
|
||||||
|
Lint/RedundantRequireStatement:
|
||||||
|
Enabled: false
|
||||||
|
Lint/RedundantSafeNavigation:
|
||||||
|
Enabled: false
|
||||||
|
Lint/RedundantWithIndex:
|
||||||
|
Enabled: false
|
||||||
|
Lint/RedundantWithObject:
|
||||||
|
Enabled: false
|
||||||
|
Lint/RegexpAsCondition:
|
||||||
|
Enabled: false
|
||||||
|
Lint/ReturnInVoidContext:
|
||||||
|
Enabled: false
|
||||||
|
Lint/SafeNavigationConsistency:
|
||||||
|
Enabled: false
|
||||||
|
Lint/SafeNavigationWithEmpty:
|
||||||
|
Enabled: false
|
||||||
|
Lint/SelfAssignment:
|
||||||
|
Enabled: false
|
||||||
|
Lint/SendWithMixinArgument:
|
||||||
|
Enabled: false
|
||||||
|
Lint/ShadowedArgument:
|
||||||
|
Enabled: false
|
||||||
|
Lint/StructNewOverride:
|
||||||
|
Enabled: false
|
||||||
|
Lint/ToJSON:
|
||||||
|
Enabled: false
|
||||||
|
Lint/TopLevelReturnWithArgument:
|
||||||
|
Enabled: false
|
||||||
|
Lint/TrailingCommaInAttributeDeclaration:
|
||||||
|
Enabled: false
|
||||||
|
Lint/UnreachableLoop:
|
||||||
|
Enabled: false
|
||||||
|
Lint/UriEscapeUnescape:
|
||||||
|
Enabled: false
|
||||||
|
Lint/UriRegexp:
|
||||||
|
Enabled: false
|
||||||
|
Lint/UselessMethodDefinition:
|
||||||
|
Enabled: false
|
||||||
|
Lint/UselessTimes:
|
||||||
|
Enabled: false
|
||||||
|
Metrics/AbcSize:
|
||||||
|
Enabled: false
|
||||||
|
Metrics/BlockLength:
|
||||||
|
Enabled: false
|
||||||
|
Metrics/BlockNesting:
|
||||||
|
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
|
||||||
|
Migration/DepartmentName:
|
||||||
|
Enabled: false
|
||||||
|
Naming/AccessorMethodName:
|
||||||
|
Enabled: false
|
||||||
|
Naming/BlockParameterName:
|
||||||
|
Enabled: false
|
||||||
|
Naming/HeredocDelimiterCase:
|
||||||
|
Enabled: false
|
||||||
|
Naming/HeredocDelimiterNaming:
|
||||||
|
Enabled: false
|
||||||
|
Naming/MemoizedInstanceVariableName:
|
||||||
|
Enabled: false
|
||||||
|
Naming/MethodParameterName:
|
||||||
|
Enabled: false
|
||||||
|
Naming/RescuedExceptionsVariableName:
|
||||||
|
Enabled: false
|
||||||
|
Naming/VariableNumber:
|
||||||
|
Enabled: false
|
||||||
|
Performance/BindCall:
|
||||||
|
Enabled: false
|
||||||
|
Performance/DeletePrefix:
|
||||||
|
Enabled: false
|
||||||
|
Performance/DeleteSuffix:
|
||||||
|
Enabled: false
|
||||||
|
Performance/InefficientHashSearch:
|
||||||
|
Enabled: false
|
||||||
|
Performance/UnfreezeString:
|
||||||
|
Enabled: false
|
||||||
|
Performance/UriDefaultParser:
|
||||||
|
Enabled: false
|
||||||
|
RSpec/Be:
|
||||||
|
Enabled: false
|
||||||
|
RSpec/Capybara/CurrentPathExpectation:
|
||||||
|
Enabled: false
|
||||||
|
RSpec/Capybara/FeatureMethods:
|
||||||
|
Enabled: false
|
||||||
|
RSpec/Capybara/VisibilityMatcher:
|
||||||
|
Enabled: false
|
||||||
|
RSpec/ContextMethod:
|
||||||
|
Enabled: false
|
||||||
|
RSpec/ContextWording:
|
||||||
|
Enabled: false
|
||||||
|
RSpec/DescribeClass:
|
||||||
|
Enabled: false
|
||||||
|
RSpec/EmptyHook:
|
||||||
|
Enabled: false
|
||||||
|
RSpec/EmptyLineAfterExample:
|
||||||
|
Enabled: false
|
||||||
|
RSpec/EmptyLineAfterExampleGroup:
|
||||||
|
Enabled: false
|
||||||
|
RSpec/EmptyLineAfterHook:
|
||||||
|
Enabled: false
|
||||||
|
RSpec/ExampleLength:
|
||||||
|
Enabled: false
|
||||||
|
RSpec/ExampleWithoutDescription:
|
||||||
|
Enabled: false
|
||||||
|
RSpec/ExpectChange:
|
||||||
|
Enabled: false
|
||||||
|
RSpec/ExpectInHook:
|
||||||
|
Enabled: false
|
||||||
|
RSpec/FactoryBot/AttributeDefinedStatically:
|
||||||
|
Enabled: false
|
||||||
|
RSpec/FactoryBot/CreateList:
|
||||||
|
Enabled: false
|
||||||
|
RSpec/FactoryBot/FactoryClassName:
|
||||||
|
Enabled: false
|
||||||
|
RSpec/HooksBeforeExamples:
|
||||||
|
Enabled: false
|
||||||
|
RSpec/ImplicitBlockExpectation:
|
||||||
|
Enabled: false
|
||||||
|
RSpec/ImplicitSubject:
|
||||||
|
Enabled: false
|
||||||
|
RSpec/LeakyConstantDeclaration:
|
||||||
|
Enabled: false
|
||||||
|
RSpec/LetBeforeExamples:
|
||||||
|
Enabled: false
|
||||||
|
RSpec/MissingExampleGroupArgument:
|
||||||
|
Enabled: false
|
||||||
|
RSpec/MultipleExpectations:
|
||||||
|
Enabled: false
|
||||||
|
RSpec/MultipleMemoizedHelpers:
|
||||||
|
Enabled: false
|
||||||
|
RSpec/MultipleSubjects:
|
||||||
|
Enabled: false
|
||||||
|
RSpec/NestedGroups:
|
||||||
|
Enabled: false
|
||||||
|
RSpec/PredicateMatcher:
|
||||||
|
Enabled: false
|
||||||
|
RSpec/ReceiveCounts:
|
||||||
|
Enabled: false
|
||||||
|
RSpec/ReceiveNever:
|
||||||
|
Enabled: false
|
||||||
|
RSpec/RepeatedExampleGroupBody:
|
||||||
|
Enabled: false
|
||||||
|
RSpec/RepeatedExampleGroupDescription:
|
||||||
|
Enabled: false
|
||||||
|
RSpec/RepeatedIncludeExample:
|
||||||
|
Enabled: false
|
||||||
|
RSpec/ReturnFromStub:
|
||||||
|
Enabled: false
|
||||||
|
RSpec/SharedExamples:
|
||||||
|
Enabled: false
|
||||||
|
RSpec/StubbedMock:
|
||||||
|
Enabled: false
|
||||||
|
RSpec/UnspecifiedException:
|
||||||
|
Enabled: false
|
||||||
|
RSpec/VariableDefinition:
|
||||||
|
Enabled: false
|
||||||
|
RSpec/VoidExpect:
|
||||||
|
Enabled: false
|
||||||
|
RSpec/Yield:
|
||||||
|
Enabled: false
|
||||||
|
Security/Open:
|
||||||
|
Enabled: false
|
||||||
|
Style/AccessModifierDeclarations:
|
||||||
|
Enabled: false
|
||||||
|
Style/AccessorGrouping:
|
||||||
|
Enabled: false
|
||||||
|
Style/AsciiComments:
|
||||||
|
Enabled: false
|
||||||
|
Style/BisectedAttrAccessor:
|
||||||
|
Enabled: false
|
||||||
|
Style/CaseLikeIf:
|
||||||
|
Enabled: false
|
||||||
|
Style/ClassEqualityComparison:
|
||||||
|
Enabled: false
|
||||||
|
Style/ColonMethodDefinition:
|
||||||
|
Enabled: false
|
||||||
|
Style/CombinableLoops:
|
||||||
|
Enabled: false
|
||||||
|
Style/CommentedKeyword:
|
||||||
|
Enabled: false
|
||||||
|
Style/Dir:
|
||||||
|
Enabled: false
|
||||||
|
Style/DoubleCopDisableDirective:
|
||||||
|
Enabled: false
|
||||||
|
Style/EmptyBlockParameter:
|
||||||
|
Enabled: false
|
||||||
|
Style/EmptyLambdaParameter:
|
||||||
|
Enabled: false
|
||||||
|
Style/Encoding:
|
||||||
|
Enabled: false
|
||||||
|
Style/EvalWithLocation:
|
||||||
|
Enabled: false
|
||||||
|
Style/ExpandPathArguments:
|
||||||
|
Enabled: false
|
||||||
|
Style/ExplicitBlockArgument:
|
||||||
|
Enabled: false
|
||||||
|
Style/ExponentialNotation:
|
||||||
|
Enabled: false
|
||||||
|
Style/FloatDivision:
|
||||||
|
Enabled: false
|
||||||
|
Style/FrozenStringLiteralComment:
|
||||||
|
Enabled: false
|
||||||
|
Style/GlobalStdStream:
|
||||||
|
Enabled: false
|
||||||
|
Style/HashAsLastArrayItem:
|
||||||
|
Enabled: false
|
||||||
|
Style/HashLikeCase:
|
||||||
|
Enabled: false
|
||||||
|
Style/HashTransformKeys:
|
||||||
|
Enabled: false
|
||||||
|
Style/HashTransformValues:
|
||||||
|
Enabled: false
|
||||||
|
Style/IfUnlessModifier:
|
||||||
|
Enabled: false
|
||||||
|
Style/KeywordParametersOrder:
|
||||||
|
Enabled: false
|
||||||
|
Style/MinMax:
|
||||||
|
Enabled: false
|
||||||
|
Style/MixinUsage:
|
||||||
|
Enabled: false
|
||||||
|
Style/MultilineWhenThen:
|
||||||
|
Enabled: false
|
||||||
|
Style/NegatedUnless:
|
||||||
|
Enabled: false
|
||||||
|
Style/NumericPredicate:
|
||||||
|
Enabled: false
|
||||||
|
Style/OptionalBooleanParameter:
|
||||||
|
Enabled: false
|
||||||
|
Style/OrAssignment:
|
||||||
|
Enabled: false
|
||||||
|
Style/RandomWithOffset:
|
||||||
|
Enabled: false
|
||||||
|
Style/RedundantAssignment:
|
||||||
|
Enabled: false
|
||||||
|
Style/RedundantCondition:
|
||||||
|
Enabled: false
|
||||||
|
Style/RedundantConditional:
|
||||||
|
Enabled: false
|
||||||
|
Style/RedundantFetchBlock:
|
||||||
|
Enabled: false
|
||||||
|
Style/RedundantFileExtensionInRequire:
|
||||||
|
Enabled: false
|
||||||
|
Style/RedundantRegexpCharacterClass:
|
||||||
|
Enabled: false
|
||||||
|
Style/RedundantRegexpEscape:
|
||||||
|
Enabled: false
|
||||||
|
Style/RedundantSelfAssignment:
|
||||||
|
Enabled: false
|
||||||
|
Style/RedundantSort:
|
||||||
|
Enabled: false
|
||||||
|
Style/RescueStandardError:
|
||||||
|
Enabled: false
|
||||||
|
Style/SingleArgumentDig:
|
||||||
|
Enabled: false
|
||||||
|
Style/SlicingWithRange:
|
||||||
|
Enabled: false
|
||||||
|
Style/SoleNestedConditional:
|
||||||
|
Enabled: false
|
||||||
|
Style/StderrPuts:
|
||||||
|
Enabled: false
|
||||||
|
Style/StringConcatenation:
|
||||||
|
Enabled: false
|
||||||
|
Style/Strip:
|
||||||
|
Enabled: false
|
||||||
|
Style/SymbolProc:
|
||||||
|
Enabled: false
|
||||||
|
Style/TrailingBodyOnClass:
|
||||||
|
Enabled: false
|
||||||
|
Style/TrailingBodyOnMethodDefinition:
|
||||||
|
Enabled: false
|
||||||
|
Style/TrailingBodyOnModule:
|
||||||
|
Enabled: false
|
||||||
|
Style/TrailingCommaInHashLiteral:
|
||||||
|
Enabled: false
|
||||||
|
Style/TrailingMethodEndStatement:
|
||||||
|
Enabled: false
|
||||||
|
Style/UnpackFirst:
|
||||||
|
Enabled: false
|
||||||
|
Lint/DuplicateBranch:
|
||||||
|
Enabled: false
|
||||||
|
Lint/DuplicateRegexpCharacterClassElement:
|
||||||
|
Enabled: false
|
||||||
|
Lint/EmptyBlock:
|
||||||
|
Enabled: false
|
||||||
|
Lint/EmptyClass:
|
||||||
|
Enabled: false
|
||||||
|
Lint/NoReturnInBeginEndBlocks:
|
||||||
|
Enabled: false
|
||||||
|
Lint/ToEnumArguments:
|
||||||
|
Enabled: false
|
||||||
|
Lint/UnexpectedBlockArity:
|
||||||
|
Enabled: false
|
||||||
|
Lint/UnmodifiedReduceAccumulator:
|
||||||
|
Enabled: false
|
||||||
|
Performance/CollectionLiteralInLoop:
|
||||||
|
Enabled: false
|
||||||
|
Style/ArgumentsForwarding:
|
||||||
|
Enabled: false
|
||||||
|
Style/CollectionCompact:
|
||||||
|
Enabled: false
|
||||||
|
Style/DocumentDynamicEvalDefinition:
|
||||||
|
Enabled: false
|
||||||
|
Style/NegatedIfElseCondition:
|
||||||
|
Enabled: false
|
||||||
|
Style/NilLambda:
|
||||||
|
Enabled: false
|
||||||
|
Style/RedundantArgument:
|
||||||
|
Enabled: false
|
||||||
|
Style/SwapValues:
|
||||||
|
Enabled: false
|
||||||
45
.travis.yml
Normal file
45
.travis.yml
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
---
|
||||||
|
os: linux
|
||||||
|
dist: xenial
|
||||||
|
language: ruby
|
||||||
|
cache: bundler
|
||||||
|
before_install:
|
||||||
|
- bundle -v
|
||||||
|
- rm -f Gemfile.lock
|
||||||
|
- "# Update system gems if requested. This is useful to temporarily workaround troubles in the test runner"
|
||||||
|
- "# See https://github.com/puppetlabs/pdk-templates/commit/705154d5c437796b821691b707156e1b056d244f for an example of how this was used"
|
||||||
|
- "# Ignore exit code of SIGPIPE'd yes to not fail with shell's pipefail set"
|
||||||
|
- '[ -z "$RUBYGEMS_VERSION" ] || (yes || true) | gem update --system $RUBYGEMS_VERSION'
|
||||||
|
- gem --version
|
||||||
|
- bundle -v
|
||||||
|
script:
|
||||||
|
- 'bundle exec rake $CHECK'
|
||||||
|
bundler_args: --without system_tests
|
||||||
|
rvm:
|
||||||
|
- 2.5.7
|
||||||
|
stages:
|
||||||
|
- static
|
||||||
|
- spec
|
||||||
|
- acceptance
|
||||||
|
-
|
||||||
|
if: tag =~ ^v\d
|
||||||
|
name: deploy
|
||||||
|
jobs:
|
||||||
|
fast_finish: true
|
||||||
|
include:
|
||||||
|
-
|
||||||
|
env: CHECK="check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop syntax lint metadata_lint"
|
||||||
|
stage: static
|
||||||
|
-
|
||||||
|
env: PUPPET_GEM_VERSION="~> 6.0" CHECK=parallel_spec
|
||||||
|
rvm: 2.5.7
|
||||||
|
stage: spec
|
||||||
|
-
|
||||||
|
env: DEPLOY_TO_FORGE=yes
|
||||||
|
stage: deploy
|
||||||
|
branches:
|
||||||
|
only:
|
||||||
|
- main
|
||||||
|
- /^v\d/
|
||||||
|
notifications:
|
||||||
|
email: false
|
||||||
6
.vscode/extensions.json
vendored
Normal file
6
.vscode/extensions.json
vendored
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"recommendations": [
|
||||||
|
"puppet.puppet-vscode",
|
||||||
|
"rebornix.Ruby"
|
||||||
|
]
|
||||||
|
}
|
||||||
11
CHANGELOG.md
Normal file
11
CHANGELOG.md
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
# Changelog
|
||||||
|
|
||||||
|
All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
|
## Release 0.2.1
|
||||||
|
|
||||||
|
**Features**
|
||||||
|
|
||||||
|
**Bugfixes**
|
||||||
|
|
||||||
|
**Known Issues**
|
||||||
62
Gemfile
Normal file
62
Gemfile
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
source ENV['GEM_SOURCE'] || 'https://rubygems.org'
|
||||||
|
|
||||||
|
def location_for(place_or_version, fake_version = nil)
|
||||||
|
git_url_regex = %r{\A(?<url>(https?|git)[:@][^#]*)(#(?<branch>.*))?}
|
||||||
|
file_url_regex = %r{\Afile:\/\/(?<path>.*)}
|
||||||
|
|
||||||
|
if place_or_version && (git_url = place_or_version.match(git_url_regex))
|
||||||
|
[fake_version, { git: git_url[:url], branch: git_url[:branch], require: false }].compact
|
||||||
|
elsif place_or_version && (file_url = place_or_version.match(file_url_regex))
|
||||||
|
['>= 0', { path: File.expand_path(file_url[:path]), require: false }]
|
||||||
|
else
|
||||||
|
[place_or_version, { require: false }]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
ruby_version_segments = Gem::Version.new(RUBY_VERSION.dup).segments
|
||||||
|
minor_version = ruby_version_segments[0..1].join('.')
|
||||||
|
|
||||||
|
group :development do
|
||||||
|
gem "json", '= 2.0.4', require: false if Gem::Requirement.create('~> 2.4.2').satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
|
||||||
|
gem "json", '= 2.1.0', require: false if Gem::Requirement.create(['>= 2.5.0', '< 2.7.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
|
||||||
|
gem "json", '= 2.3.0', require: false if Gem::Requirement.create(['>= 2.7.0', '< 2.8.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
|
||||||
|
gem "puppet-module-posix-default-r#{minor_version}", '~> 1.0', require: false, platforms: [:ruby]
|
||||||
|
gem "puppet-module-posix-dev-r#{minor_version}", '~> 1.0', require: false, platforms: [:ruby]
|
||||||
|
gem "puppet-module-win-default-r#{minor_version}", '~> 1.0', require: false, platforms: [:mswin, :mingw, :x64_mingw]
|
||||||
|
gem "puppet-module-win-dev-r#{minor_version}", '~> 1.0', require: false, platforms: [:mswin, :mingw, :x64_mingw]
|
||||||
|
end
|
||||||
|
group :system_tests do
|
||||||
|
gem "puppet-module-posix-system-r#{minor_version}", '~> 1.0', require: false, platforms: [:ruby]
|
||||||
|
gem "puppet-module-win-system-r#{minor_version}", '~> 1.0', require: false, platforms: [:mswin, :mingw, :x64_mingw]
|
||||||
|
end
|
||||||
|
|
||||||
|
puppet_version = ENV['PUPPET_GEM_VERSION']
|
||||||
|
facter_version = ENV['FACTER_GEM_VERSION']
|
||||||
|
hiera_version = ENV['HIERA_GEM_VERSION']
|
||||||
|
|
||||||
|
gems = {}
|
||||||
|
|
||||||
|
gems['puppet'] = location_for(puppet_version)
|
||||||
|
|
||||||
|
# If facter or hiera versions have been specified via the environment
|
||||||
|
# variables
|
||||||
|
|
||||||
|
gems['facter'] = location_for(facter_version) if facter_version
|
||||||
|
gems['hiera'] = location_for(hiera_version) if hiera_version
|
||||||
|
|
||||||
|
gems.each do |gem_name, gem_params|
|
||||||
|
gem gem_name, *gem_params
|
||||||
|
end
|
||||||
|
|
||||||
|
# Evaluate Gemfile.local and ~/.gemfile if they exist
|
||||||
|
extra_gemfiles = [
|
||||||
|
"#{__FILE__}.local",
|
||||||
|
File.join(Dir.home, '.gemfile'),
|
||||||
|
]
|
||||||
|
|
||||||
|
extra_gemfiles.each do |gemfile|
|
||||||
|
if File.file?(gemfile) && File.readable?(gemfile)
|
||||||
|
eval(File.read(gemfile), binding)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
# vim: syntax=ruby
|
||||||
2
LICENSE
2
LICENSE
@@ -186,7 +186,7 @@
|
|||||||
same "printed page" as the copyright notice for easier
|
same "printed page" as the copyright notice for easier
|
||||||
identification within third-party archives.
|
identification within third-party archives.
|
||||||
|
|
||||||
Copyright {yyyy} {name of copyright owner}
|
Copyright 2017 Ryan DeShone
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
|
|||||||
12
README.md
12
README.md
@@ -57,6 +57,9 @@ Specifies the email address to send arpwatch alerts to. Valid options: string. D
|
|||||||
|
|
||||||
Specifies the interface to monitor for arp changes. Valid options: string containing an interface name. Default: eth0
|
Specifies the interface to monitor for arp changes. Valid options: string containing an interface name. Default: eth0
|
||||||
|
|
||||||
|
#### `opts`
|
||||||
|
|
||||||
|
Specify additional options to pass to arpwatch at start. Valid options: string of command line options. Default: OS dependant
|
||||||
#### `package_ensure`
|
#### `package_ensure`
|
||||||
|
|
||||||
Tells Puppet whether the arpwatch package should be installed, and what version. Valid options: 'present', 'latest', or a specific version number. Default value: 'present'
|
Tells Puppet whether the arpwatch package should be installed, and what version. Valid options: 'present', 'latest', or a specific version number. Default value: 'present'
|
||||||
@@ -83,11 +86,12 @@ Specifies which user account arpwatch should run under. Valid options: string. D
|
|||||||
|
|
||||||
#### `source_email`
|
#### `source_email`
|
||||||
|
|
||||||
Specifies the source email address for arpwatch emails. Valid options: string. Default value: 'arpwatch@${::fqdn}'
|
Specifies the source email address for arpwatch emails. Only works under RedHat family distributions. Valid options: string. Default value: 'arpwatch@${::fqdn}'
|
||||||
|
|
||||||
## Limitations
|
## Limitations
|
||||||
|
|
||||||
arpwatch currently only supports RedHat based distributions. Pull requests are welcome to add support for other platforms.
|
This module currently supports RedHat and Debian distributions. It has only been thoroughly tested under RedHat.
|
||||||
|
Pull requests are welcome to add support for other platforms.
|
||||||
|
|
||||||
## Development
|
## Development
|
||||||
|
|
||||||
@@ -95,4 +99,8 @@ Pull requests are welcome. Please make sure to properly document any additions o
|
|||||||
|
|
||||||
## Release Notes
|
## Release Notes
|
||||||
|
|
||||||
|
v0.2.0 - Add support for Debian
|
||||||
|
|
||||||
|
v0.1.2 - Add spec tests and dependencies
|
||||||
|
|
||||||
v0.1.0 - Initial release of arpwatch module
|
v0.1.0 - Initial release of arpwatch module
|
||||||
|
|||||||
100
Rakefile
100
Rakefile
@@ -1,32 +1,88 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require 'bundler'
|
||||||
|
require 'puppet_litmus/rake_tasks' if Bundler.rubygems.find_name('puppet_litmus').any?
|
||||||
require 'puppetlabs_spec_helper/rake_tasks'
|
require 'puppetlabs_spec_helper/rake_tasks'
|
||||||
require 'puppet-lint/tasks/puppet-lint'
|
require 'puppet-syntax/tasks/puppet-syntax'
|
||||||
require 'metadata-json-lint/rake_task'
|
require 'puppet_blacksmith/rake_tasks' if Bundler.rubygems.find_name('puppet-blacksmith').any?
|
||||||
|
require 'github_changelog_generator/task' if Bundler.rubygems.find_name('github_changelog_generator').any?
|
||||||
|
require 'puppet-strings/tasks' if Bundler.rubygems.find_name('puppet-strings').any?
|
||||||
|
|
||||||
if RUBY_VERSION >= '1.9'
|
def changelog_user
|
||||||
require 'rubocop/rake_task'
|
return unless Rake.application.top_level_tasks.include? "changelog"
|
||||||
RuboCop::RakeTask.new
|
returnVal = nil || JSON.load(File.read('metadata.json'))['author']
|
||||||
|
raise "unable to find the changelog_user in .sync.yml, or the author in metadata.json" if returnVal.nil?
|
||||||
|
puts "GitHubChangelogGenerator user:#{returnVal}"
|
||||||
|
returnVal
|
||||||
end
|
end
|
||||||
|
|
||||||
PuppetLint.configuration.send('disable_80chars')
|
def changelog_project
|
||||||
PuppetLint.configuration.relative = true
|
return unless Rake.application.top_level_tasks.include? "changelog"
|
||||||
PuppetLint.configuration.ignore_paths = ['spec/**/*.pp', 'pkg/**/*.pp']
|
|
||||||
|
|
||||||
desc 'Validate manifests, templates, and ruby files'
|
returnVal = nil
|
||||||
task :validate do
|
returnVal ||= begin
|
||||||
Dir['manifests/**/*.pp'].each do |manifest|
|
metadata_source = JSON.load(File.read('metadata.json'))['source']
|
||||||
sh "puppet parser validate --noop #{manifest}"
|
metadata_source_match = metadata_source && metadata_source.match(%r{.*\/([^\/]*?)(?:\.git)?\Z})
|
||||||
|
|
||||||
|
metadata_source_match && metadata_source_match[1]
|
||||||
end
|
end
|
||||||
Dir['spec/**/*.rb', 'lib/**/*.rb'].each do |ruby_file|
|
|
||||||
sh "ruby -c #{ruby_file}" unless ruby_file =~ %r{spec/fixtures}
|
raise "unable to find the changelog_project in .sync.yml or calculate it from the source in metadata.json" if returnVal.nil?
|
||||||
|
|
||||||
|
puts "GitHubChangelogGenerator project:#{returnVal}"
|
||||||
|
returnVal
|
||||||
end
|
end
|
||||||
Dir['templates/**/*.erb'].each do |template|
|
|
||||||
sh "erb -P -x -T '-' #{template} | ruby -c"
|
def changelog_future_release
|
||||||
|
return unless Rake.application.top_level_tasks.include? "changelog"
|
||||||
|
returnVal = "v%s" % JSON.load(File.read('metadata.json'))['version']
|
||||||
|
raise "unable to find the future_release (version) in metadata.json" if returnVal.nil?
|
||||||
|
puts "GitHubChangelogGenerator future_release:#{returnVal}"
|
||||||
|
returnVal
|
||||||
|
end
|
||||||
|
|
||||||
|
PuppetLint.configuration.send('disable_relative')
|
||||||
|
|
||||||
|
if Bundler.rubygems.find_name('github_changelog_generator').any?
|
||||||
|
GitHubChangelogGenerator::RakeTask.new :changelog do |config|
|
||||||
|
raise "Set CHANGELOG_GITHUB_TOKEN environment variable eg 'export CHANGELOG_GITHUB_TOKEN=valid_token_here'" if Rake.application.top_level_tasks.include? "changelog" and ENV['CHANGELOG_GITHUB_TOKEN'].nil?
|
||||||
|
config.user = "#{changelog_user}"
|
||||||
|
config.project = "#{changelog_project}"
|
||||||
|
config.future_release = "#{changelog_future_release}"
|
||||||
|
config.exclude_labels = ['maintenance']
|
||||||
|
config.header = "# Change log\n\nAll notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org)."
|
||||||
|
config.add_pr_wo_labels = true
|
||||||
|
config.issues = false
|
||||||
|
config.merge_prefix = "### UNCATEGORIZED PRS; LABEL THEM ON GITHUB"
|
||||||
|
config.configure_sections = {
|
||||||
|
"Changed" => {
|
||||||
|
"prefix" => "### Changed",
|
||||||
|
"labels" => ["backwards-incompatible"],
|
||||||
|
},
|
||||||
|
"Added" => {
|
||||||
|
"prefix" => "### Added",
|
||||||
|
"labels" => ["enhancement", "feature"],
|
||||||
|
},
|
||||||
|
"Fixed" => {
|
||||||
|
"prefix" => "### Fixed",
|
||||||
|
"labels" => ["bug", "documentation", "bugfix"],
|
||||||
|
},
|
||||||
|
}
|
||||||
|
end
|
||||||
|
else
|
||||||
|
desc 'Generate a Changelog from GitHub'
|
||||||
|
task :changelog do
|
||||||
|
raise <<EOM
|
||||||
|
The changelog tasks depends on recent features of the github_changelog_generator gem.
|
||||||
|
Please manually add it to your .sync.yml for now, and run `pdk update`:
|
||||||
|
---
|
||||||
|
Gemfile:
|
||||||
|
optional:
|
||||||
|
':development':
|
||||||
|
- gem: 'github_changelog_generator'
|
||||||
|
version: '~> 1.15'
|
||||||
|
condition: "Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.3.0')"
|
||||||
|
EOM
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
desc 'Run metadata_lint, lint, validate, and spec tests.'
|
|
||||||
task :test do
|
|
||||||
[:metadata_lint, :lint, :validate, :spec].each do |test|
|
|
||||||
Rake::Task[test].invoke
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|||||||
48
appveyor.yml
Normal file
48
appveyor.yml
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
---
|
||||||
|
version: 1.1.x.{build}
|
||||||
|
branches:
|
||||||
|
only:
|
||||||
|
- main
|
||||||
|
- release
|
||||||
|
skip_commits:
|
||||||
|
message: /^\(?doc\)?.*/
|
||||||
|
clone_depth: 10
|
||||||
|
init:
|
||||||
|
- SET
|
||||||
|
- 'mkdir C:\ProgramData\PuppetLabs\code && exit 0'
|
||||||
|
- 'mkdir C:\ProgramData\PuppetLabs\facter && exit 0'
|
||||||
|
- 'mkdir C:\ProgramData\PuppetLabs\hiera && exit 0'
|
||||||
|
- 'mkdir C:\ProgramData\PuppetLabs\puppet\var && exit 0'
|
||||||
|
environment:
|
||||||
|
matrix:
|
||||||
|
-
|
||||||
|
RUBY_VERSION: 25-x64
|
||||||
|
CHECK: syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop
|
||||||
|
-
|
||||||
|
PUPPET_GEM_VERSION: ~> 6.0
|
||||||
|
RUBY_VERSION: 25
|
||||||
|
CHECK: parallel_spec
|
||||||
|
-
|
||||||
|
PUPPET_GEM_VERSION: ~> 6.0
|
||||||
|
RUBY_VERSION: 25-x64
|
||||||
|
CHECK: parallel_spec
|
||||||
|
matrix:
|
||||||
|
fast_finish: true
|
||||||
|
install:
|
||||||
|
- set PATH=C:\Ruby%RUBY_VERSION%\bin;%PATH%
|
||||||
|
- bundle install --jobs 4 --retry 2 --without system_tests
|
||||||
|
- type Gemfile.lock
|
||||||
|
build: off
|
||||||
|
test_script:
|
||||||
|
- bundle exec puppet -V
|
||||||
|
- ruby -v
|
||||||
|
- gem -v
|
||||||
|
- bundle -v
|
||||||
|
- bundle exec rake %CHECK%
|
||||||
|
notifications:
|
||||||
|
- provider: Email
|
||||||
|
to:
|
||||||
|
- nobody@nowhere.com
|
||||||
|
on_build_success: false
|
||||||
|
on_build_failure: false
|
||||||
|
on_build_status_changed: false
|
||||||
1
data/common.yaml
Normal file
1
data/common.yaml
Normal file
@@ -0,0 +1 @@
|
|||||||
|
---
|
||||||
1
data/os/Debian.yaml
Normal file
1
data/os/Debian.yaml
Normal file
@@ -0,0 +1 @@
|
|||||||
|
---
|
||||||
4
data/os/RedHat.yaml
Normal file
4
data/os/RedHat.yaml
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
---
|
||||||
|
arpwatch::config_file: /etc/sysconfig/arpwatch
|
||||||
|
arpwatch::config_template: arpwatch/conf.rhel.erb
|
||||||
|
arpwatch::opts: ''
|
||||||
21
hiera.yaml
Normal file
21
hiera.yaml
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
---
|
||||||
|
version: 5
|
||||||
|
|
||||||
|
defaults: # Used for any hierarchy level that omits these keys.
|
||||||
|
datadir: data # This path is relative to hiera.yaml's directory.
|
||||||
|
data_hash: yaml_data # Use the built-in YAML backend.
|
||||||
|
|
||||||
|
hierarchy:
|
||||||
|
- name: "osfamily/major release"
|
||||||
|
paths:
|
||||||
|
# Used to distinguish between Debian and Ubuntu
|
||||||
|
- "os/%{facts.os.name}/%{facts.os.release.major}.yaml"
|
||||||
|
- "os/%{facts.os.family}/%{facts.os.release.major}.yaml"
|
||||||
|
# Used for Solaris
|
||||||
|
- "os/%{facts.os.family}/%{facts.kernelrelease}.yaml"
|
||||||
|
- name: "osfamily"
|
||||||
|
paths:
|
||||||
|
- "os/%{facts.os.name}.yaml"
|
||||||
|
- "os/%{facts.os.family}.yaml"
|
||||||
|
- name: 'common'
|
||||||
|
path: 'common.yaml'
|
||||||
@@ -1,76 +1,42 @@
|
|||||||
# Class: arpwatch
|
|
||||||
# ===========================
|
|
||||||
#
|
#
|
||||||
# Install and configure arpwatch
|
# Install and configure arpwatch
|
||||||
#
|
#
|
||||||
# Parameters
|
# @example Basic installation and configuration of arpwatch
|
||||||
# ----------
|
# include ::arpwatch
|
||||||
#
|
#
|
||||||
# * `config_file`
|
# @example Install service and set it to send email alerts
|
||||||
# The confiugration file on the server to manage.
|
|
||||||
#
|
|
||||||
# * `config_template`
|
|
||||||
# The template to use when generating the config file.
|
|
||||||
#
|
|
||||||
# * `dest_email`
|
|
||||||
# The email address to send arpwatch alerts to.
|
|
||||||
#
|
|
||||||
# * `interface`
|
|
||||||
# Which interface to watch for arp traffic
|
|
||||||
#
|
|
||||||
# * `package_ensure`
|
|
||||||
# Ensure value passed to the package resource
|
|
||||||
#
|
|
||||||
# * `package_name`
|
|
||||||
# Name of the package to manage
|
|
||||||
#
|
|
||||||
# * `service_enable`
|
|
||||||
# Enable value, passed to the service resource
|
|
||||||
#
|
|
||||||
# * `service_ensure`
|
|
||||||
# Ensure value, passed to the service resource
|
|
||||||
#
|
|
||||||
# * `service_name`
|
|
||||||
# Name of the service to manage
|
|
||||||
#
|
|
||||||
# * `service_user`
|
|
||||||
# Defines the user account that arpwatch will run under
|
|
||||||
#
|
|
||||||
# * `source_email`
|
|
||||||
# Define the source email address for arpwatch alerts
|
|
||||||
#
|
|
||||||
# Examples
|
|
||||||
# --------
|
|
||||||
#
|
|
||||||
# @example
|
|
||||||
# class { 'arpwatch':
|
# class { 'arpwatch':
|
||||||
# dest_email => 'foo@bar.org',
|
# dest_email => 'foo@bar.org',
|
||||||
# source_email => 'arpwatch@baz.com',
|
# source_email => 'arpwatch@baz.com',
|
||||||
# }
|
# }
|
||||||
#
|
#
|
||||||
# Authors
|
# @param [String] config_file The configuration file on the server to manage.
|
||||||
# -------
|
# @param [String] config_template The template to use when generating the config file
|
||||||
#
|
# @param [String] dest_email The email address to send arpwatch alerts to.
|
||||||
# Ryan DeShone <rfdeshon@gmail.com>
|
# @param [String] interface Which interface to watch for arp traffic
|
||||||
#
|
# @param [String] opts Additional command line options to pass to arpwatch at start
|
||||||
# Copyright
|
# @param [String] package_ensure Ensure value passed to the package resource
|
||||||
# ---------
|
# @param [String] package_name Name of the package to manage
|
||||||
#
|
# @param [Boolean] service_enable Enable value, passed to the service resource
|
||||||
# Copyright 2016 Ryan DeShone, unless otherwise noted.
|
# @param [String] service_ensure Ensure value, passed to the service resource
|
||||||
|
# @param [String] service_name Name of the service to manage
|
||||||
|
# @param [String] service_user Defines the user account that arpwatch will run under
|
||||||
|
# @param [String] source_email Define the source email address for arpwatch alerts
|
||||||
#
|
#
|
||||||
class arpwatch (
|
class arpwatch (
|
||||||
$config_file = $arpwatch::params::config_file,
|
$config_file = '/etc/default/arpwatch',
|
||||||
$config_template = $arpwatch::params::config_template,
|
$config_template = 'arpwatch/conf.deb.erb',
|
||||||
$dest_email = '-',
|
$dest_email = '-',
|
||||||
$interface = $arpwatch::params::interface,
|
$interface = 'eth0',
|
||||||
|
$opts = '-N -p',
|
||||||
$package_ensure = 'installed',
|
$package_ensure = 'installed',
|
||||||
$package_name = $arpwatch::params::package_name,
|
$package_name = 'arpwatch',
|
||||||
$service_enable = true,
|
$service_enable = true,
|
||||||
$service_ensure = 'running',
|
$service_ensure = 'running',
|
||||||
$service_name = $arpwatch::params::service_name,
|
$service_name = 'arpwatch',
|
||||||
$service_user = $arpwatch::params::service_user,
|
$service_user = 'arpwatch',
|
||||||
$source_email = "arpwatch@${::fqdn}",
|
$source_email = "arpwatch@${::fqdn}",
|
||||||
) inherits arpwatch::params {
|
) {
|
||||||
validate_string($dest_email)
|
validate_string($dest_email)
|
||||||
validate_string($package_name)
|
validate_string($package_name)
|
||||||
validate_string($service_user)
|
validate_string($service_user)
|
||||||
@@ -99,5 +65,7 @@ class arpwatch (
|
|||||||
ensure => $service_ensure,
|
ensure => $service_ensure,
|
||||||
enable => $service_enable,
|
enable => $service_enable,
|
||||||
}
|
}
|
||||||
Package[$package_name]->File[$config_file]~>Service[$service_name]
|
Package[$package_name]
|
||||||
|
-> File[$config_file]
|
||||||
|
~> Service[$service_name]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,20 +0,0 @@
|
|||||||
# Class: arpwatch::params
|
|
||||||
# ========================
|
|
||||||
class arpwatch::params {
|
|
||||||
case $::osfamily {
|
|
||||||
'RedHat': {
|
|
||||||
$package_name = 'arpwatch'
|
|
||||||
$service_name = 'arpwatch'
|
|
||||||
$interface = 'eth0'
|
|
||||||
$config_file = '/etc/sysconfig/arpwatch'
|
|
||||||
$config_template = 'arpwatch/conf.rhel.erb'
|
|
||||||
$service_user = $::operatingsystemmajrelease ? {
|
|
||||||
'5' => 'pcap',
|
|
||||||
default => 'arpwatch',
|
|
||||||
}
|
|
||||||
}
|
|
||||||
default: {
|
|
||||||
fail("The ${module_name} module is not supported on an ${::osfamily} distribution.")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,24 +1,50 @@
|
|||||||
{
|
{
|
||||||
"name": "ardichoke-arpwatch",
|
"name": "ardichoke-arpwatch",
|
||||||
"version": "0.1.2",
|
"version": "0.3.0",
|
||||||
"author": "ardichoke",
|
"author": "ardichoke",
|
||||||
"summary": "Install and manage arpwatch",
|
"summary": "Install and manage arpwatch",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"source": "https://github.com/ardichoke/puppet-arpwatch",
|
"source": "https://github.com/ardichoke/puppet-arpwatch",
|
||||||
"project_page": "https://github.com/ardichoke/puppet-arpwatch",
|
"project_page": "https://github.com/ardichoke/puppet-arpwatch",
|
||||||
"issues_url": "https://github.com/ardichoke/puppet-arpwatch/issues",
|
"issues_url": "https://github.com/ardichoke/puppet-arpwatch/issues",
|
||||||
|
"dependencies": [
|
||||||
|
{
|
||||||
|
"name": "puppetlabs/stdlib",
|
||||||
|
"version_requirement": ">=1.0.0 <9.0.0"
|
||||||
|
}
|
||||||
|
],
|
||||||
"operatingsystem_support": [
|
"operatingsystem_support": [
|
||||||
{
|
{
|
||||||
"operatingsystem": "RedHat",
|
"operatingsystem": "RedHat",
|
||||||
"operatingsystemrelease": [
|
"operatingsystemrelease": [
|
||||||
"5",
|
|
||||||
"6",
|
"6",
|
||||||
"7"
|
"7",
|
||||||
|
"8"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"operatingsystem": "Debian",
|
||||||
|
"operatingsystemrelease": [
|
||||||
|
"7",
|
||||||
|
"8",
|
||||||
|
"9",
|
||||||
|
"10",
|
||||||
|
"11"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"dependencies": [
|
"requirements": [
|
||||||
{ "name": "puppetlabs/stdlib", "version_requirement": ">=1.0.0 <5.0.0"},
|
{
|
||||||
],
|
"name": "puppet",
|
||||||
"tags": ["arpwatch","network","monitoring"]
|
"version_requirement": ">= 4.10.0 < 8.0.0"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"arpwatch",
|
||||||
|
"network",
|
||||||
|
"monitoring"
|
||||||
|
],
|
||||||
|
"pdk-version": "2.1.1",
|
||||||
|
"template-url": "pdk-default#2.1.1",
|
||||||
|
"template-ref": "tags/2.1.1-0-g03daa92"
|
||||||
}
|
}
|
||||||
|
|||||||
15
spec/classes/arpwatch_spec.rb
Normal file
15
spec/classes/arpwatch_spec.rb
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe 'arpwatch' do
|
||||||
|
on_supported_os.each do |os, os_facts|
|
||||||
|
context "on #{os}" do
|
||||||
|
let(:facts) { os_facts }
|
||||||
|
|
||||||
|
it { is_expected.to compile }
|
||||||
|
it { is_expected.to contain_package('arpwatch') }
|
||||||
|
it { is_expected.to contain_service('arpwatch') }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
require 'spec_helper'
|
|
||||||
describe 'arpwatch', type: 'class' do
|
|
||||||
context 'On RedHat 7 with no parameters' do
|
|
||||||
let (:facts) { { osfamily: 'RedHat', operatingsystemmajrelease: '7' } }
|
|
||||||
it {
|
|
||||||
should contain_package('arpwatch').with({'ensure'=>'installed'})
|
|
||||||
should contain_file('/etc/sysconfig/arpwatch').with({'ensure'=>'file'})
|
|
||||||
}
|
|
||||||
end
|
|
||||||
context 'On RedHat 6 with no parameters' do
|
|
||||||
let (:facts) { { osfamily: 'RedHat', operatingsystemmajrelease: '6' } }
|
|
||||||
it {
|
|
||||||
should contain_package('arpwatch').with({'ensure'=>'installed'})
|
|
||||||
should contain_file('/etc/sysconfig/arpwatch').with({'ensure'=>'file'})
|
|
||||||
}
|
|
||||||
end
|
|
||||||
context 'On RedHat 5 with no parameters' do
|
|
||||||
let (:facts) { { osfamily: 'RedHat', operatingsystemmajrelease: '6' } }
|
|
||||||
it {
|
|
||||||
should contain_package('arpwatch').with({'ensure'=>'installed'})
|
|
||||||
should contain_file('/etc/sysconfig/arpwatch').with({'ensure'=>'file'})
|
|
||||||
}
|
|
||||||
end
|
|
||||||
context 'On an unknown OS' do
|
|
||||||
let :facts do
|
|
||||||
{
|
|
||||||
:osfamily => 'Darwin'
|
|
||||||
}
|
|
||||||
end
|
|
||||||
it {
|
|
||||||
expect { should raise_error(Puppet::Error) }
|
|
||||||
}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
8
spec/default_facts.yml
Normal file
8
spec/default_facts.yml
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
# Use default_module_facts.yml for module specific facts.
|
||||||
|
#
|
||||||
|
# Facts specified here will override the values provided by rspec-puppet-facts.
|
||||||
|
---
|
||||||
|
ipaddress: "172.16.254.254"
|
||||||
|
ipaddress6: "FE80:0000:0000:0000:AAAA:AAAA:AAAA"
|
||||||
|
is_pe: false
|
||||||
|
macaddress: "AA:AA:AA:AA:AA:AA"
|
||||||
@@ -1,6 +1,73 @@
|
|||||||
require 'rspec-puppet'
|
# frozen_string_literal: true
|
||||||
fixture_path = File.expand_path(File.join(__FILE__, '..', 'fixtures'))
|
|
||||||
RSpec.configure do |c|
|
RSpec.configure do |c|
|
||||||
c.module_path = File.join(fixture_path, 'modules')
|
c.mock_with :rspec
|
||||||
c.manifest_dir = File.join(fixture_path, 'manifests')
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
require 'puppetlabs_spec_helper/module_spec_helper'
|
||||||
|
require 'rspec-puppet-facts'
|
||||||
|
|
||||||
|
require 'spec_helper_local' if File.file?(File.join(File.dirname(__FILE__), 'spec_helper_local.rb'))
|
||||||
|
|
||||||
|
include RspecPuppetFacts
|
||||||
|
|
||||||
|
default_facts = {
|
||||||
|
puppetversion: Puppet.version,
|
||||||
|
facterversion: Facter.version,
|
||||||
|
}
|
||||||
|
|
||||||
|
default_fact_files = [
|
||||||
|
File.expand_path(File.join(File.dirname(__FILE__), 'default_facts.yml')),
|
||||||
|
File.expand_path(File.join(File.dirname(__FILE__), 'default_module_facts.yml')),
|
||||||
|
]
|
||||||
|
|
||||||
|
default_fact_files.each do |f|
|
||||||
|
next unless File.exist?(f) && File.readable?(f) && File.size?(f)
|
||||||
|
|
||||||
|
begin
|
||||||
|
default_facts.merge!(YAML.safe_load(File.read(f), [], [], true))
|
||||||
|
rescue => e
|
||||||
|
RSpec.configuration.reporter.message "WARNING: Unable to load #{f}: #{e}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# read default_facts and merge them over what is provided by facterdb
|
||||||
|
default_facts.each do |fact, value|
|
||||||
|
add_custom_fact fact, value
|
||||||
|
end
|
||||||
|
|
||||||
|
RSpec.configure do |c|
|
||||||
|
c.default_facts = default_facts
|
||||||
|
c.before :each do
|
||||||
|
# set to strictest setting for testing
|
||||||
|
# by default Puppet runs at warning level
|
||||||
|
Puppet.settings[:strict] = :warning
|
||||||
|
Puppet.settings[:strict_variables] = true
|
||||||
|
end
|
||||||
|
c.filter_run_excluding(bolt: true) unless ENV['GEM_BOLT']
|
||||||
|
c.after(:suite) do
|
||||||
|
end
|
||||||
|
|
||||||
|
# Filter backtrace noise
|
||||||
|
backtrace_exclusion_patterns = [
|
||||||
|
%r{spec_helper},
|
||||||
|
%r{gems},
|
||||||
|
]
|
||||||
|
|
||||||
|
if c.respond_to?(:backtrace_exclusion_patterns)
|
||||||
|
c.backtrace_exclusion_patterns = backtrace_exclusion_patterns
|
||||||
|
elsif c.respond_to?(:backtrace_clean_patterns)
|
||||||
|
c.backtrace_clean_patterns = backtrace_exclusion_patterns
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# Ensures that a module is defined
|
||||||
|
# @param module_name Name of the module
|
||||||
|
def ensure_module_defined(module_name)
|
||||||
|
module_name.split('::').reduce(Object) do |last_module, next_module|
|
||||||
|
last_module.const_set(next_module, Module.new) unless last_module.const_defined?(next_module, false)
|
||||||
|
last_module.const_get(next_module, false)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# 'spec_overrides' from sync.yml will appear below this line
|
||||||
|
|||||||
4
templates/conf.deb.erb
Normal file
4
templates/conf.deb.erb
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
# THIS FILE MANAGED BY PUPPET
|
||||||
|
# CHANGES WILL BE OVERWRITTEN
|
||||||
|
ARGS="-i <%= @interface -%> -m <%= @dest_email -%> <%= @opts -%>"
|
||||||
|
RUNAS="<%= @service_user -%>"
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
# THIS FILE MANAGED BY PUPPET
|
# THIS FILE MANAGED BY PUPPET
|
||||||
# CHANGES WILL BE OVERWRITTEN
|
# CHANGES WILL BE OVERWRITTEN
|
||||||
OPTIONS="-i <%= @interface -%> -u <%= @service_user -%> -e <%= @dest_email -%> -s <%= @source_email -%>"
|
OPTIONS="-i <%= @interface -%> -u <%= @service_user -%> -e <%= @dest_email -%> -s <%= @source_email -%> <%= @opts -%>"
|
||||||
|
|||||||
Reference in New Issue
Block a user