Skip to content
This repository was archived by the owner on Nov 24, 2023. It is now read-only.

Commit 60635a8

Browse files
author
shimon
committed
migrate puppet module to this repository
0 parents  commit 60635a8

25 files changed

+955
-0
lines changed

.fixtures.yml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# This file can be used to install module dependencies for unit testing
2+
# See https://github.com/puppetlabs/puppetlabs_spec_helper#using-fixtures for details
3+
---
4+
fixtures:
5+
forge_modules:
6+
stdlib: "puppetlabs/stdlib"
7+
repositories:
8+
archive:
9+
repo: "https://github.com/voxpupuli/puppet-archive.git"
10+
ref: "v1.1.2"
11+
systemd:
12+
repo: "https://github.com/camptocamp/puppet-systemd.git"
13+
ref: "1.1.1"
14+
15+

.gitattributes

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
*.rb eol=lf
2+
*.erb eol=lf
3+
*.pp eol=lf
4+
*.sh eol=lf
5+
*.epp eol=lf

.gitlab-ci.yml

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
stages:
3+
- syntax
4+
- unit
5+
6+
cache:
7+
paths:
8+
- vendor/bundle
9+
10+
before_script:
11+
- bundle -v
12+
- rm Gemfile.lock || true
13+
- "# Update system gems if requested. This is useful to temporarily workaround troubles in the test runner"
14+
- "# Set `rubygems_version` in the .sync.yml to set a value"
15+
- "# Ignore exit code of SIGPIPE'd yes to not fail with shell's pipefail set"
16+
- '[ -z "$RUBYGEMS_VERSION" ] || (yes || true) | gem update --system $RUBYGEMS_VERSION'
17+
- gem --version
18+
- bundle -v
19+
- bundle install --without system_tests --path vendor/bundle --jobs $(nproc)
20+
21+
syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop-Ruby 2.5.7-Puppet ~> 6:
22+
stage: syntax
23+
image: ruby:2.5.7
24+
script:
25+
- bundle exec rake syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop
26+
variables:
27+
PUPPET_GEM_VERSION: '~> 6'
28+
29+
parallel_spec-Ruby 2.5.7-Puppet ~> 6:
30+
stage: unit
31+
image: ruby:2.5.7
32+
script:
33+
- bundle exec rake parallel_spec
34+
variables:
35+
PUPPET_GEM_VERSION: '~> 6'
36+
37+
parallel_spec-Ruby 2.4.5-Puppet ~> 5:
38+
stage: unit
39+
image: ruby:2.4.5
40+
script:
41+
- bundle exec rake parallel_spec
42+
variables:
43+
PUPPET_GEM_VERSION: '~> 5'
44+

.pdkignore

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
.git/
2+
.*.sw[op]
3+
.metadata
4+
.yardoc
5+
.yardwarns
6+
*.iml
7+
/.bundle/
8+
/.idea/
9+
/.vagrant/
10+
/coverage/
11+
/bin/
12+
/doc/
13+
/Gemfile.local
14+
/Gemfile.lock
15+
/junit/
16+
/log/
17+
/pkg/
18+
/spec/fixtures/manifests/
19+
/spec/fixtures/modules/
20+
/tmp/
21+
/vendor/
22+
/convert_report.txt
23+
/update_report.txt
24+
.DS_Store
25+
.project
26+
.envrc
27+
/inventory.yaml
28+
/appveyor.yml
29+
/.fixtures.yml
30+
/Gemfile
31+
/.gitattributes
32+
/.gitignore
33+
/.gitlab-ci.yml
34+
/.pdkignore
35+
/Rakefile
36+
/rakelib/
37+
/.rspec
38+
/.rubocop.yml
39+
/.travis.yml
40+
/.yardopts
41+
/spec/
42+
/.vscode/

.puppet-lint.rc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--relative

.rspec

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
--color
2+
--format documentation

.rubocop.yml

+137
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
---
2+
require:
3+
- rubocop-rspec
4+
- rubocop-i18n
5+
AllCops:
6+
DisplayCopNames: true
7+
TargetRubyVersion: '2.1'
8+
Include:
9+
- "./**/*.rb"
10+
Exclude:
11+
- bin/*
12+
- ".vendor/**/*"
13+
- "**/Gemfile"
14+
- "**/Rakefile"
15+
- pkg/**/*
16+
- spec/fixtures/**/*
17+
- vendor/**/*
18+
- "**/Puppetfile"
19+
- "**/Vagrantfile"
20+
- "**/Guardfile"
21+
Metrics/LineLength:
22+
Description: People have wide screens, use them.
23+
Max: 200
24+
GetText:
25+
Enabled: false
26+
GetText/DecorateString:
27+
Description: We don't want to decorate test output.
28+
Exclude:
29+
- spec/**/*
30+
Enabled: false
31+
RSpec/BeforeAfterAll:
32+
Description: Beware of using after(:all) as it may cause state to leak between tests.
33+
A necessary evil in acceptance testing.
34+
Exclude:
35+
- spec/acceptance/**/*.rb
36+
RSpec/HookArgument:
37+
Description: Prefer explicit :each argument, matching existing module's style
38+
EnforcedStyle: each
39+
Style/BlockDelimiters:
40+
Description: Prefer braces for chaining. Mostly an aesthetical choice. Better to
41+
be consistent then.
42+
EnforcedStyle: braces_for_chaining
43+
Style/BracesAroundHashParameters:
44+
Description: Braces are required by Ruby 2.7. Cop removed from RuboCop v0.80.0.
45+
See https://github.com/rubocop-hq/rubocop/pull/7643
46+
Enabled: true
47+
Style/ClassAndModuleChildren:
48+
Description: Compact style reduces the required amount of indentation.
49+
EnforcedStyle: compact
50+
Style/EmptyElse:
51+
Description: Enforce against empty else clauses, but allow `nil` for clarity.
52+
EnforcedStyle: empty
53+
Style/FormatString:
54+
Description: Following the main puppet project's style, prefer the % format format.
55+
EnforcedStyle: percent
56+
Style/FormatStringToken:
57+
Description: Following the main puppet project's style, prefer the simpler template
58+
tokens over annotated ones.
59+
EnforcedStyle: template
60+
Style/Lambda:
61+
Description: Prefer the keyword for easier discoverability.
62+
EnforcedStyle: literal
63+
Style/RegexpLiteral:
64+
Description: Community preference. See https://github.com/voxpupuli/modulesync_config/issues/168
65+
EnforcedStyle: percent_r
66+
Style/TernaryParentheses:
67+
Description: Checks for use of parentheses around ternary conditions. Enforce parentheses
68+
on complex expressions for better readability, but seriously consider breaking
69+
it up.
70+
EnforcedStyle: require_parentheses_when_complex
71+
Style/TrailingCommaInArguments:
72+
Description: Prefer always trailing comma on multiline argument lists. This makes
73+
diffs, and re-ordering nicer.
74+
EnforcedStyleForMultiline: comma
75+
Style/TrailingCommaInLiteral:
76+
Description: Prefer always trailing comma on multiline literals. This makes diffs,
77+
and re-ordering nicer.
78+
EnforcedStyleForMultiline: comma
79+
Style/SymbolArray:
80+
Description: Using percent style obscures symbolic intent of array's contents.
81+
EnforcedStyle: brackets
82+
RSpec/MessageSpies:
83+
EnforcedStyle: receive
84+
Style/Documentation:
85+
Exclude:
86+
- lib/puppet/parser/functions/**/*
87+
- spec/**/*
88+
Style/WordArray:
89+
EnforcedStyle: brackets
90+
Style/CollectionMethods:
91+
Enabled: true
92+
Style/MethodCalledOnDoEndBlock:
93+
Enabled: true
94+
Style/StringMethods:
95+
Enabled: true
96+
GetText/DecorateFunctionMessage:
97+
Enabled: false
98+
GetText/DecorateStringFormattingUsingInterpolation:
99+
Enabled: false
100+
GetText/DecorateStringFormattingUsingPercent:
101+
Enabled: false
102+
Layout/EndOfLine:
103+
Enabled: false
104+
Layout/IndentHeredoc:
105+
Enabled: false
106+
Metrics/AbcSize:
107+
Enabled: false
108+
Metrics/BlockLength:
109+
Enabled: false
110+
Metrics/ClassLength:
111+
Enabled: false
112+
Metrics/CyclomaticComplexity:
113+
Enabled: false
114+
Metrics/MethodLength:
115+
Enabled: false
116+
Metrics/ModuleLength:
117+
Enabled: false
118+
Metrics/ParameterLists:
119+
Enabled: false
120+
Metrics/PerceivedComplexity:
121+
Enabled: false
122+
RSpec/DescribeClass:
123+
Enabled: false
124+
RSpec/ExampleLength:
125+
Enabled: false
126+
RSpec/MessageExpectation:
127+
Enabled: false
128+
RSpec/MultipleExpectations:
129+
Enabled: false
130+
RSpec/NestedGroups:
131+
Enabled: false
132+
Style/AsciiComments:
133+
Enabled: false
134+
Style/IfUnlessModifier:
135+
Enabled: false
136+
Style/SymbolProc:
137+
Enabled: false

.travis.yml

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
os: linux
3+
dist: xenial
4+
language: ruby
5+
cache: bundler
6+
before_install:
7+
- bundle -v
8+
- rm -f Gemfile.lock
9+
- "# Update system gems if requested. This is useful to temporarily workaround troubles in the test runner"
10+
- "# See https://github.com/puppetlabs/pdk-templates/commit/705154d5c437796b821691b707156e1b056d244f for an example of how this was used"
11+
- "# Ignore exit code of SIGPIPE'd yes to not fail with shell's pipefail set"
12+
- '[ -z "$RUBYGEMS_VERSION" ] || (yes || true) | gem update --system $RUBYGEMS_VERSION'
13+
- gem --version
14+
- bundle -v
15+
script:
16+
- 'bundle exec rake $CHECK'
17+
bundler_args: --without system_tests
18+
rvm:
19+
- 2.5.7
20+
stages:
21+
- static
22+
- spec
23+
- acceptance
24+
-
25+
if: tag =~ ^v\d
26+
name: deploy
27+
jobs:
28+
fast_finish: true
29+
include:
30+
-
31+
env: CHECK="check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop syntax lint metadata_lint"
32+
stage: static
33+
-
34+
env: PUPPET_GEM_VERSION="~> 5.0" CHECK=parallel_spec
35+
rvm: 2.4.5
36+
stage: spec
37+
-
38+
env: PUPPET_GEM_VERSION="~> 6.0" CHECK=parallel_spec
39+
rvm: 2.5.7
40+
stage: spec
41+
-
42+
env: DEPLOY_TO_FORGE=yes
43+
stage: deploy
44+
branches:
45+
only:
46+
- master
47+
- /^v\d/
48+
notifications:
49+
email: false

.yardopts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--markup markdown

Gemfile

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
source ENV['GEM_SOURCE'] || 'https://rubygems.org'
2+
3+
def location_for(place_or_version, fake_version = nil)
4+
git_url_regex = %r{\A(?<url>(https?|git)[:@][^#]*)(#(?<branch>.*))?}
5+
file_url_regex = %r{\Afile:\/\/(?<path>.*)}
6+
7+
if place_or_version && (git_url = place_or_version.match(git_url_regex))
8+
[fake_version, { git: git_url[:url], branch: git_url[:branch], require: false }].compact
9+
elsif place_or_version && (file_url = place_or_version.match(file_url_regex))
10+
['>= 0', { path: File.expand_path(file_url[:path]), require: false }]
11+
else
12+
[place_or_version, { require: false }]
13+
end
14+
end
15+
16+
ruby_version_segments = Gem::Version.new(RUBY_VERSION.dup).segments
17+
minor_version = ruby_version_segments[0..1].join('.')
18+
19+
group :development do
20+
gem "fast_gettext", '1.1.0', require: false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.1.0')
21+
gem "fast_gettext", require: false if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.1.0')
22+
gem "json_pure", '<= 2.0.1', require: false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.0.0')
23+
gem "json", '= 1.8.1', require: false if Gem::Version.new(RUBY_VERSION.dup) == Gem::Version.new('2.1.9')
24+
gem "json", '= 2.0.4', require: false if Gem::Requirement.create('~> 2.4.2').satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
25+
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))
26+
gem "rb-readline", '= 0.5.5', require: false, platforms: [:mswin, :mingw, :x64_mingw]
27+
gem "puppet-module-posix-default-r#{minor_version}", '~> 0.4', require: false, platforms: [:ruby]
28+
gem "puppet-module-posix-dev-r#{minor_version}", '~> 0.4', require: false, platforms: [:ruby]
29+
gem "puppet-module-win-default-r#{minor_version}", '~> 0.4', require: false, platforms: [:mswin, :mingw, :x64_mingw]
30+
gem "puppet-module-win-dev-r#{minor_version}", '~> 0.4', require: false, platforms: [:mswin, :mingw, :x64_mingw]
31+
end
32+
33+
puppet_version = ENV['PUPPET_GEM_VERSION']
34+
facter_version = ENV['FACTER_GEM_VERSION']
35+
hiera_version = ENV['HIERA_GEM_VERSION']
36+
37+
gems = {}
38+
39+
gems['puppet'] = location_for(puppet_version)
40+
41+
# If facter or hiera versions have been specified via the environment
42+
# variables
43+
44+
gems['facter'] = location_for(facter_version) if facter_version
45+
gems['hiera'] = location_for(hiera_version) if hiera_version
46+
47+
if Gem.win_platform? && puppet_version =~ %r{^(file:///|git://)}
48+
# If we're using a Puppet gem on Windows which handles its own win32-xxx gem
49+
# dependencies (>= 3.5.0), set the maximum versions (see PUP-6445).
50+
gems['win32-dir'] = ['<= 0.4.9', require: false]
51+
gems['win32-eventlog'] = ['<= 0.6.5', require: false]
52+
gems['win32-process'] = ['<= 0.7.5', require: false]
53+
gems['win32-security'] = ['<= 0.2.5', require: false]
54+
gems['win32-service'] = ['0.8.8', require: false]
55+
end
56+
57+
gems.each do |gem_name, gem_params|
58+
gem gem_name, *gem_params
59+
end
60+
61+
# Evaluate Gemfile.local and ~/.gemfile if they exist
62+
extra_gemfiles = [
63+
"#{__FILE__}.local",
64+
File.join(Dir.home, '.gemfile'),
65+
]
66+
67+
extra_gemfiles.each do |gemfile|
68+
if File.file?(gemfile) && File.readable?(gemfile)
69+
eval(File.read(gemfile), binding)
70+
end
71+
end
72+
# vim: syntax=ruby

0 commit comments

Comments
 (0)