Skip to content

Commit

Permalink
Support PDK
Browse files Browse the repository at this point in the history
  • Loading branch information
treydock committed Nov 25, 2019
1 parent 9457505 commit 495b2ce
Show file tree
Hide file tree
Showing 14 changed files with 264 additions and 66 deletions.
5 changes: 5 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*.rb eol=lf
*.erb eol=lf
*.pp eol=lf
*.sh eol=lf
*.epp eol=lf
76 changes: 25 additions & 51 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,57 +1,31 @@
# Default .gitignore for Ruby
*.gem
*.rbc
.bundle
.config
coverage
InstalledFiles
lib/bundler/man
pkg
rdoc
spec/reports
test/tmp
test/version_tmp
tmp
/Gemfile.lock
/Gemfile.local

# YARD artifacts
.git/
.*.sw[op]
.metadata
.yardoc
_yardoc
doc/

# Vim
*.swp

# Eclipse
.project

# Visual Studio Code
.vscode/

# OS X
.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

# Puppet
spec/fixtures/manifests/*
spec/fixtures/modules/*

# Vagrant
.vagrant/*

# Sensu
junit/
log/
.project
.envrc
/inventory.yaml
*.log
vendor/
sensu.komodoproject
doc/**

# direnv & rbenv
/.envrc
/.ruby-version

# secrets
tests/sensu_license.json
tests/secrets
tests/secrets.tar
46 changes: 46 additions & 0 deletions .pdkignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
.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
/appveyor.yml
/.fixtures.yml
/Gemfile
/.gitattributes
/.gitignore
/.gitlab-ci.yml
/.pdkignore
/Rakefile
/rakelib/
/.rspec
/.rubocop.yml
/.travis.yml
/.yardopts
/spec/
/.vscode/
*.log
tests/sensu_license.json
tests/secrets
tests/secrets.tar
1 change: 1 addition & 0 deletions .puppet-lint.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--relative
127 changes: 127 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
---
require:
- rubocop-rspec
- rubocop-i18n
AllCops:
DisplayCopNames: true
TargetRubyVersion: '2.1'
Include:
- "./**/*.rb"
Exclude:
- bin/*
- ".vendor/**/*"
- "**/Gemfile"
- "**/Rakefile"
- pkg/**/*
- spec/fixtures/**/*
- vendor/**/*
- "**/Puppetfile"
- "**/Vagrantfile"
- "**/Guardfile"
- "**/*"
Metrics/LineLength:
Description: People have wide screens, use them.
Max: 200
GetText:
Enabled: false
GetText/DecorateString:
Description: We don't want to decorate test output.
Exclude:
- spec/**/*
RSpec/BeforeAfterAll:
Description: Beware of using after(:all) as it may cause state to leak between tests.
A necessary evil in acceptance testing.
Exclude:
- spec/acceptance/**/*.rb
RSpec/HookArgument:
Description: Prefer explicit :each argument, matching existing module's style
EnforcedStyle: each
Style/BlockDelimiters:
Description: Prefer braces for chaining. Mostly an aesthetical choice. Better to
be consistent then.
EnforcedStyle: braces_for_chaining
Style/ClassAndModuleChildren:
Description: Compact style reduces the required amount of indentation.
EnforcedStyle: compact
Style/EmptyElse:
Description: Enforce against empty else clauses, but allow `nil` for clarity.
EnforcedStyle: empty
Style/FormatString:
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/TrailingCommaInLiteral:
Description: Prefer always trailing comma on multiline literals. This makes diffs,
and re-ordering nicer.
EnforcedStyleForMultiline: comma
Style/SymbolArray:
Description: Using percent style obscures symbolic intent of array's contents.
EnforcedStyle: brackets
RSpec/MessageSpies:
EnforcedStyle: receive
Style/Documentation:
Exclude:
- lib/puppet/parser/functions/**/*
- spec/**/*
Style/WordArray:
EnforcedStyle: brackets
Style/CollectionMethods:
Enabled: true
Style/MethodCalledOnDoEndBlock:
Enabled: true
Style/StringMethods:
Enabled: true
Layout/EndOfLine:
Enabled: false
Layout/IndentHeredoc:
Enabled: false
Metrics/AbcSize:
Enabled: false
Metrics/BlockLength:
Enabled: false
Metrics/ClassLength:
Enabled: false
Metrics/CyclomaticComplexity:
Enabled: false
Metrics/MethodLength:
Enabled: false
Metrics/ModuleLength:
Enabled: false
Metrics/ParameterLists:
Enabled: false
Metrics/PerceivedComplexity:
Enabled: false
RSpec/DescribeClass:
Enabled: false
RSpec/ExampleLength:
Enabled: false
RSpec/MessageExpectation:
Enabled: false
RSpec/MultipleExpectations:
Enabled: false
RSpec/NestedGroups:
Enabled: false
Style/AsciiComments:
Enabled: false
Style/IfUnlessModifier:
Enabled: false
Style/SymbolProc:
Enabled: false
33 changes: 33 additions & 0 deletions .sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
.rubocop.yml:
default_configs:
AllCops:
Exclude:
- '**/*'
.vscode/extensions.json:
delete: true
spec/default_facts.yml:
delete: true
.gitlab-ci.yml:
delete: true
.pdkignore:
paths: &ignorepaths
- '*.log'
- tests/sensu_license.json
- tests/secrets
- tests/secrets.tar
data/common.yaml:
unmanaged: true
Rakefile:
unmanaged: true
.travis.yml:
unmanaged: true
spec/spec_helper.rb:
unmanaged: true
.gitignore:
paths: *ignorepaths
Gemfile:
unmanaged: true
appveyor.yml:
unmanaged: true
.rspec:
unmanaged: true
1 change: 1 addition & 0 deletions .yardopts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--markup markdown
5 changes: 4 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
source ENV['GEM_SOURCE'] || "https://rubygems.org"

if puppetversion = ENV['PUPPET_GEM_VERSION'] || "~> 5.x"
if puppetversion = ENV['PUPPET_GEM_VERSION']
gem 'puppet', puppetversion, :require => false
else
gem 'puppet', :require => false
Expand Down Expand Up @@ -31,6 +31,9 @@ group :development, :unit_tests do
gem 'puppet-lint-unquoted_string-check', :require => false
gem 'puppet-lint-variable_contains_upcase', :require => false
gem 'puppet-lint-version_comparison-check', :require => false
gem "rubocop", '~> 0.49.0', :require => false
gem "rubocop-i18n", '~> 1.2.0', :require => false
gem "rubocop-rspec", '~> 1.16.0', :require => false
end

group :documentation do
Expand Down
2 changes: 1 addition & 1 deletion manifests/agent.pp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
if $facts['os']['family'] == 'windows' {
$sensu_agent_exe = "C:\\Program Files\\sensu\\sensu-agent\\bin\\sensu-agent.exe"
exec { 'install-agent-service':
command => "C:\\windows\\system32\\cmd.exe /c \"\"${sensu_agent_exe}\" service install --config-file \"${::sensu::agent_config_path}\" --log-file \"${log_file}\"\"",
command => "C:\\windows\\system32\\cmd.exe /c \"\"${sensu_agent_exe}\" service install --config-file \"${::sensu::agent_config_path}\" --log-file \"${log_file}\"\"", # lint:ignore:140chars
unless => "C:\\windows\\system32\\sc.exe query SensuAgent",
before => Service['sensu-agent'],
require => [
Expand Down
23 changes: 16 additions & 7 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
"source": "https://github.com/sensu/sensu-puppet",
"project_page": "https://github.com/sensu/sensu-puppet",
"issues_url": "https://github.com/sensu/sensu-puppet/issues",
"tags": [
"sensu",
"monitoring"
"dependencies": [
{
"name": "puppetlabs/stdlib",
"version_requirement": ">= 4.25.1 < 7.0.0"
}
],
"operatingsystem_support": [
{
Expand Down Expand Up @@ -59,9 +61,16 @@
}
],
"requirements": [
{ "name": "puppet", "version_requirement": ">= 5.0.0 < 7.0.0" }
{
"name": "puppet",
"version_requirement": ">= 5.0.0 < 7.0.0"
}
],
"dependencies": [
{ "name": "puppetlabs/stdlib", "version_requirement": ">= 4.25.1 < 7.0.0" }
]
"tags": [
"sensu",
"monitoring"
],
"pdk-version": "1.13.0",
"template-url": "https://github.com/puppetlabs/pdk-templates#1.13.0",
"template-ref": "tags/1.13.0-0-g66e1443"
}
3 changes: 1 addition & 2 deletions tasks/install_agent_linux.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"name": "Install Agent Linux",
"description": "Install Sensu Go agent on Linux",
"private": true,
"parameters": []
"private": true
}
3 changes: 1 addition & 2 deletions tasks/install_agent_windows.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@
"name": "Install Agent Windows",
"description": "Install Sensu Go agent on Windows",
"input_method": "powershell",
"private": true,
"parameters": []
"private": true
}
3 changes: 2 additions & 1 deletion tests/sensu-backend-cluster.pp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
/peer2/: {
$backend_name = 'backend2'
}
default: {}
}

class { '::sensu::backend':
Expand All @@ -17,6 +18,6 @@
'etcd-initial-cluster-state' => 'new',
'etcd-initial-cluster-token' => '',
'etcd-name' => $backend_name,
}
},
}

Loading

0 comments on commit 495b2ce

Please sign in to comment.