Révision ece9be27
Do PDK convert
.gitignore | ||
---|---|---|
22 | 22 |
/convert_report.txt |
23 | 23 |
/update_report.txt |
24 | 24 |
.DS_Store |
25 |
.project |
|
26 |
.envrc |
|
27 |
/inventory.yaml |
.gitlab-ci.yml | ||
---|---|---|
10 | 10 |
- vendor/bundle |
11 | 11 |
|
12 | 12 |
before_script: |
13 |
- echo -e "machine code.immerda.ch\nlogin gitlab-ci-token\npassword $CI_JOB_TOKEN" > ~/.netrc |
|
13 | 14 |
- bundle -v |
14 | 15 |
- rm Gemfile.lock || true |
16 |
- "# Update system gems if requested. This is useful to temporarily workaround troubles in the test runner" |
|
17 |
- "# Set `rubygems_version` in the .sync.yml to set a value" |
|
18 |
- "# Ignore exit code of SIGPIPE'd yes to not fail with shell's pipefail set" |
|
19 |
- '[ -z "$RUBYGEMS_VERSION" ] || (yes || true) | gem update --system $RUBYGEMS_VERSION' |
|
15 | 20 |
- gem --version |
16 | 21 |
- bundle -v |
17 | 22 |
- bundle install --without system_tests --path vendor/bundle --jobs $(nproc) |
18 | 23 |
|
19 |
run syntax:
|
|
24 |
syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop-Ruby 2.5.7-Puppet ~> 6:
|
|
20 | 25 |
stage: syntax |
21 |
tags: |
|
22 |
- container |
|
26 |
image: ruby:2.5.7 |
|
23 | 27 |
script: |
24 | 28 |
- bundle exec rake syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop |
25 | 29 |
variables: |
26 |
PUPPET_GEM_VERSION: '~> 6.0'
|
|
30 |
PUPPET_GEM_VERSION: '~> 6' |
|
27 | 31 |
|
28 |
run parallel-spec puppet 6:
|
|
32 |
parallel_spec-Ruby 2.5.7-Puppet ~> 6:
|
|
29 | 33 |
stage: unit |
30 |
tags: |
|
31 |
- container |
|
34 |
image: ruby:2.5.7 |
|
32 | 35 |
script: |
33 | 36 |
- bundle exec rake parallel_spec |
34 | 37 |
variables: |
35 |
PUPPET_GEM_VERSION: '~> 6.0' |
|
38 |
PUPPET_GEM_VERSION: '~> 6' |
|
39 |
|
|
40 |
parallel_spec-Ruby 2.4.5-Puppet ~> 5: |
|
41 |
stage: unit |
|
42 |
image: ruby:2.4.5 |
|
43 |
script: |
|
44 |
- bundle exec rake parallel_spec |
|
45 |
variables: |
|
46 |
PUPPET_GEM_VERSION: '~> 5' |
|
47 |
|
.pdkignore | ||
---|---|---|
22 | 22 |
/convert_report.txt |
23 | 23 |
/update_report.txt |
24 | 24 |
.DS_Store |
25 |
.project |
|
26 |
.envrc |
|
27 |
/inventory.yaml |
|
25 | 28 |
/appveyor.yml |
26 | 29 |
/.fixtures.yml |
27 | 30 |
/Gemfile |
... | ... | |
30 | 33 |
/.gitlab-ci.yml |
31 | 34 |
/.pdkignore |
32 | 35 |
/Rakefile |
36 |
/rakelib/ |
|
33 | 37 |
/.rspec |
34 | 38 |
/.rubocop.yml |
35 | 39 |
/.travis.yml |
36 | 40 |
/.yardopts |
37 | 41 |
/spec/ |
42 |
/.vscode/ |
.rubocop.yml | ||
---|---|---|
1 | 1 |
--- |
2 |
require: rubocop-rspec |
|
2 |
require: |
|
3 |
- rubocop-rspec |
|
4 |
- rubocop-i18n |
|
3 | 5 |
AllCops: |
4 | 6 |
DisplayCopNames: true |
5 | 7 |
TargetRubyVersion: '2.1' |
... | ... | |
11 | 13 |
- "**/Gemfile" |
12 | 14 |
- "**/Rakefile" |
13 | 15 |
- pkg/**/* |
14 |
- spec/classes/*_spec.rb |
|
15 | 16 |
- spec/fixtures/**/* |
16 | 17 |
- vendor/**/* |
17 | 18 |
- "**/Puppetfile" |
... | ... | |
20 | 21 |
Metrics/LineLength: |
21 | 22 |
Description: People have wide screens, use them. |
22 | 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 |
|
23 | 31 |
RSpec/BeforeAfterAll: |
24 | 32 |
Description: Beware of using after(:all) as it may cause state to leak between tests. |
25 | 33 |
A necessary evil in acceptance testing. |
... | ... | |
32 | 40 |
Description: Prefer braces for chaining. Mostly an aesthetical choice. Better to |
33 | 41 |
be consistent then. |
34 | 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 |
|
35 | 47 |
Style/ClassAndModuleChildren: |
36 | 48 |
Description: Compact style reduces the required amount of indentation. |
37 | 49 |
EnforcedStyle: compact |
... | ... | |
81 | 93 |
Enabled: true |
82 | 94 |
Style/StringMethods: |
83 | 95 |
Enabled: true |
96 |
GetText/DecorateFunctionMessage: |
|
97 |
Enabled: false |
|
98 |
GetText/DecorateStringFormattingUsingInterpolation: |
|
99 |
Enabled: false |
|
100 |
GetText/DecorateStringFormattingUsingPercent: |
|
101 |
Enabled: false |
|
84 | 102 |
Layout/EndOfLine: |
85 | 103 |
Enabled: false |
86 | 104 |
Layout/IndentHeredoc: |
.sync.yml | ||
---|---|---|
1 |
--- |
|
2 |
.gitlab-ci.yml: |
|
3 |
custom: |
|
4 |
custom_before_steps: |
|
5 |
- echo -e "machine code.immerda.ch\nlogin gitlab-ci-token\npassword $CI_JOB_TOKEN" > ~/.netrc |
|
6 |
image: 'registry.code.immerda.ch/immerda/container-images/ruby/devel:2.7' |
|
7 |
|
|
8 |
.travis.yml: |
|
9 |
delete: true |
.vscode/extensions.json | ||
---|---|---|
1 |
{ |
|
2 |
"recommendations": [ |
|
3 |
"puppet.puppet-vscode", |
|
4 |
"rebornix.Ruby" |
|
5 |
] |
|
6 |
} |
CHANGELOG.md | ||
---|---|---|
1 |
# Changelog |
|
2 |
|
|
3 |
All notable changes to this project will be documented in this file. |
|
4 |
|
|
5 |
## Release 0.1.0 |
|
6 |
|
|
7 |
**Features** |
|
8 |
|
|
9 |
**Bugfixes** |
|
10 |
|
|
11 |
**Known Issues** |
Gemfile | ||
---|---|---|
17 | 17 |
minor_version = ruby_version_segments[0..1].join('.') |
18 | 18 |
|
19 | 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 "puppet-module-posix-default-r#{minor_version}", require: false, platforms: [:ruby] |
|
27 |
gem "puppet-module-posix-dev-r#{minor_version}", require: false, platforms: [:ruby] |
|
28 |
gem "puppet-module-win-default-r#{minor_version}", require: false, platforms: [:mswin, :mingw, :x64_mingw] |
|
29 |
gem "puppet-module-win-dev-r#{minor_version}", require: false, platforms: [:mswin, :mingw, :x64_mingw] |
|
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] |
|
30 | 31 |
end |
31 | 32 |
|
32 | 33 |
puppet_version = ENV['PUPPET_GEM_VERSION'] |
Rakefile | ||
---|---|---|
1 |
# frozen_string_literal: true |
|
2 |
|
|
3 |
require 'puppet_litmus/rake_tasks' if Bundler.rubygems.find_name('puppet_litmus').any? |
|
1 | 4 |
require 'puppetlabs_spec_helper/rake_tasks' |
2 | 5 |
require 'puppet-syntax/tasks/puppet-syntax' |
3 | 6 |
require 'puppet_blacksmith/rake_tasks' if Bundler.rubygems.find_name('puppet-blacksmith').any? |
... | ... | |
14 | 17 |
|
15 | 18 |
def changelog_project |
16 | 19 |
return unless Rake.application.top_level_tasks.include? "changelog" |
17 |
returnVal = nil || JSON.load(File.read('metadata.json'))['name'] |
|
18 |
raise "unable to find the changelog_project in .sync.yml or the name in metadata.json" if returnVal.nil? |
|
20 |
|
|
21 |
returnVal = nil |
|
22 |
returnVal ||= begin |
|
23 |
metadata_source = JSON.load(File.read('metadata.json'))['source'] |
|
24 |
metadata_source_match = metadata_source && metadata_source.match(%r{.*\/([^\/]*?)(?:\.git)?\Z}) |
|
25 |
|
|
26 |
metadata_source_match && metadata_source_match[1] |
|
27 |
end |
|
28 |
|
|
29 |
raise "unable to find the changelog_project in .sync.yml or calculate it from the source in metadata.json" if returnVal.nil? |
|
30 |
|
|
19 | 31 |
puts "GitHubChangelogGenerator project:#{returnVal}" |
20 | 32 |
returnVal |
21 | 33 |
end |
22 | 34 |
|
23 | 35 |
def changelog_future_release |
24 | 36 |
return unless Rake.application.top_level_tasks.include? "changelog" |
25 |
returnVal = JSON.load(File.read('metadata.json'))['version'] |
|
37 |
returnVal = "v%s" % JSON.load(File.read('metadata.json'))['version']
|
|
26 | 38 |
raise "unable to find the future_release (version) in metadata.json" if returnVal.nil? |
27 | 39 |
puts "GitHubChangelogGenerator future_release:#{returnVal}" |
28 | 40 |
returnVal |
... | ... | |
40 | 52 |
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)." |
41 | 53 |
config.add_pr_wo_labels = true |
42 | 54 |
config.issues = false |
43 |
config.merge_prefix = "### UNCATEGORIZED PRS; GO LABEL THEM"
|
|
55 |
config.merge_prefix = "### UNCATEGORIZED PRS; LABEL THEM ON GITHUB"
|
|
44 | 56 |
config.configure_sections = { |
45 | 57 |
"Changed" => { |
46 | 58 |
"prefix" => "### Changed", |
... | ... | |
48 | 60 |
}, |
49 | 61 |
"Added" => { |
50 | 62 |
"prefix" => "### Added", |
51 |
"labels" => ["feature", "enhancement"],
|
|
63 |
"labels" => ["enhancement", "feature"],
|
|
52 | 64 |
}, |
53 | 65 |
"Fixed" => { |
54 | 66 |
"prefix" => "### Fixed", |
55 |
"labels" => ["bugfix"], |
|
67 |
"labels" => ["bug", "documentation", "bugfix"],
|
|
56 | 68 |
}, |
57 | 69 |
} |
58 | 70 |
end |
... | ... | |
60 | 72 |
desc 'Generate a Changelog from GitHub' |
61 | 73 |
task :changelog do |
62 | 74 |
raise <<EOM |
63 |
The changelog tasks depends on unreleased features of the github_changelog_generator gem.
|
|
75 |
The changelog tasks depends on recent features of the github_changelog_generator gem.
|
|
64 | 76 |
Please manually add it to your .sync.yml for now, and run `pdk update`: |
65 | 77 |
--- |
66 | 78 |
Gemfile: |
67 | 79 |
optional: |
68 | 80 |
':development': |
69 | 81 |
- gem: 'github_changelog_generator' |
70 |
git: 'https://github.com/skywinder/github-changelog-generator' |
|
71 |
ref: '20ee04ba1234e9e83eb2ffb5056e23d641c7a018' |
|
72 |
condition: "Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.2.2')" |
|
82 |
version: '~> 1.15' |
|
83 |
condition: "Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.3.0')" |
|
73 | 84 |
EOM |
74 | 85 |
end |
75 | 86 |
end |
87 |
|
appveyor.yml | ||
---|---|---|
1 |
--- |
|
2 |
version: 1.1.x.{build} |
|
3 |
branches: |
|
4 |
only: |
|
5 |
- master |
|
6 |
- release |
|
7 |
skip_commits: |
|
8 |
message: /^\(?doc\)?.*/ |
|
9 |
clone_depth: 10 |
|
10 |
init: |
|
11 |
- SET |
|
12 |
- 'mkdir C:\ProgramData\PuppetLabs\code && exit 0' |
|
13 |
- 'mkdir C:\ProgramData\PuppetLabs\facter && exit 0' |
|
14 |
- 'mkdir C:\ProgramData\PuppetLabs\hiera && exit 0' |
|
15 |
- 'mkdir C:\ProgramData\PuppetLabs\puppet\var && exit 0' |
|
16 |
environment: |
|
17 |
matrix: |
|
18 |
- |
|
19 |
RUBY_VERSION: 24-x64 |
|
20 |
CHECK: syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop |
|
21 |
- |
|
22 |
PUPPET_GEM_VERSION: ~> 5.0 |
|
23 |
RUBY_VERSION: 24 |
|
24 |
CHECK: parallel_spec |
|
25 |
- |
|
26 |
PUPPET_GEM_VERSION: ~> 5.0 |
|
27 |
RUBY_VERSION: 24-x64 |
|
28 |
CHECK: parallel_spec |
|
29 |
- |
|
30 |
PUPPET_GEM_VERSION: ~> 6.0 |
|
31 |
RUBY_VERSION: 25 |
|
32 |
CHECK: parallel_spec |
|
33 |
- |
|
34 |
PUPPET_GEM_VERSION: ~> 6.0 |
|
35 |
RUBY_VERSION: 25-x64 |
|
36 |
CHECK: parallel_spec |
|
37 |
matrix: |
|
38 |
fast_finish: true |
|
39 |
install: |
|
40 |
- set PATH=C:\Ruby%RUBY_VERSION%\bin;%PATH% |
|
41 |
- bundle install --jobs 4 --retry 2 --without system_tests |
|
42 |
- type Gemfile.lock |
|
43 |
build: off |
|
44 |
test_script: |
|
45 |
- bundle exec puppet -V |
|
46 |
- ruby -v |
|
47 |
- gem -v |
|
48 |
- bundle -v |
|
49 |
- bundle exec rake %CHECK% |
|
50 |
notifications: |
|
51 |
- provider: Email |
|
52 |
to: |
|
53 |
- nobody@nowhere.com |
|
54 |
on_build_success: false |
|
55 |
on_build_failure: false |
|
56 |
on_build_status_changed: false |
data/common.yaml | ||
---|---|---|
1 |
--- {} |
hiera.yaml | ||
---|---|---|
1 |
--- |
|
2 |
version: 5 |
|
3 |
|
|
4 |
defaults: # Used for any hierarchy level that omits these keys. |
|
5 |
datadir: data # This path is relative to hiera.yaml's directory. |
|
6 |
data_hash: yaml_data # Use the built-in YAML backend. |
|
7 |
|
|
8 |
hierarchy: |
|
9 |
- name: "osfamily/major release" |
|
10 |
paths: |
|
11 |
# Used to distinguish between Debian and Ubuntu |
|
12 |
- "os/%{facts.os.name}/%{facts.os.release.major}.yaml" |
|
13 |
- "os/%{facts.os.family}/%{facts.os.release.major}.yaml" |
|
14 |
# Used for Solaris |
|
15 |
- "os/%{facts.os.family}/%{facts.kernelrelease}.yaml" |
|
16 |
- name: "osfamily" |
|
17 |
paths: |
|
18 |
- "os/%{facts.os.name}.yaml" |
|
19 |
- "os/%{facts.os.family}.yaml" |
|
20 |
- name: 'common' |
|
21 |
path: 'common.yaml' |
metadata.json | ||
---|---|---|
48 | 48 |
"version_requirement": ">= 4.10.0 < 7.0.0" |
49 | 49 |
} |
50 | 50 |
], |
51 |
"pdk-version": "1.9.1",
|
|
52 |
"template-url": "file:///opt/puppetlabs/pdk/share/cache/pdk-templates.git",
|
|
53 |
"template-ref": "1.9.1-0-g6945d31"
|
|
51 |
"pdk-version": "1.18.1",
|
|
52 |
"template-url": "https://github.com/puppetlabs/pdk-templates#1.18.1",
|
|
53 |
"template-ref": "tags/1.18.1-0-g3d2e75c"
|
|
54 | 54 |
} |
spec/default_facts.yml | ||
---|---|---|
3 | 3 |
# Facts specified here will override the values provided by rspec-puppet-facts. |
4 | 4 |
--- |
5 | 5 |
ipaddress: "172.16.254.254" |
6 |
ipaddress6: "FE80:0000:0000:0000:AAAA:AAAA:AAAA" |
|
6 | 7 |
is_pe: false |
7 | 8 |
macaddress: "AA:AA:AA:AA:AA:AA" |
spec/spec_helper.rb | ||
---|---|---|
1 |
# frozen_string_literal: true |
|
2 |
|
|
1 | 3 |
require 'puppetlabs_spec_helper/module_spec_helper' |
2 | 4 |
require 'rspec-puppet-facts' |
3 | 5 |
|
... | ... | |
25 | 27 |
end |
26 | 28 |
end |
27 | 29 |
|
30 |
# read default_facts and merge them over what is provided by facterdb |
|
31 |
default_facts.each do |fact, value| |
|
32 |
add_custom_fact fact, value |
|
33 |
end |
|
34 |
|
|
28 | 35 |
RSpec.configure do |c| |
29 | 36 |
c.default_facts = default_facts |
30 | 37 |
c.before :each do |
31 | 38 |
# set to strictest setting for testing |
32 | 39 |
# by default Puppet runs at warning level |
33 | 40 |
Puppet.settings[:strict] = :warning |
41 |
Puppet.settings[:strict_variables] = true |
|
34 | 42 |
end |
35 | 43 |
c.filter_run_excluding(bolt: true) unless ENV['GEM_BOLT'] |
36 | 44 |
c.after(:suite) do |
37 | 45 |
end |
38 | 46 |
end |
39 | 47 |
|
48 |
# Ensures that a module is defined |
|
49 |
# @param module_name Name of the module |
|
40 | 50 |
def ensure_module_defined(module_name) |
41 | 51 |
module_name.split('::').reduce(Object) do |last_module, next_module| |
42 | 52 |
last_module.const_set(next_module, Module.new) unless last_module.const_defined?(next_module, false) |
Formats disponibles : Unified diff