Skip to content

Commit

Permalink
Merge pull request #321 from puppetlabs/pdk2.6
Browse files Browse the repository at this point in the history
Pdk2.6.1
  • Loading branch information
davidsandilands authored Jan 31, 2023
2 parents bc7bc0e + 98d4bc3 commit e489d84
Show file tree
Hide file tree
Showing 52 changed files with 457 additions and 415 deletions.
38 changes: 38 additions & 0 deletions .devcontainer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# devcontainer


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

``` json
{
"name": "Puppet Development Kit (Community)",
"dockerFile": "Dockerfile",

// Set *default* container specific settings.json values on container create.
"settings": {
"terminal.integrated.profiles.linux": {
"bash": {
"path": "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",
}
```



16 changes: 5 additions & 11 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,17 @@
// 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"
"terminal.integrated.profiles.linux": {
"bash": {
"path": "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",
}
2 changes: 2 additions & 0 deletions .puppet-lint.rc
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
--relative
--no-strict_indent-check
--no-manifest_whitespace_missing_newline_end_of_file-check
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ require:
- rubocop-rspec
AllCops:
DisplayCopNames: true
TargetRubyVersion: '2.4'
TargetRubyVersion: '2.5'
Include:
- "**/*.rb"
Exclude:
Expand Down
9 changes: 6 additions & 3 deletions .sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
Gemfile:
required:
':development':
- gem: 'puppet-debugger'
version: '>= 0.18.0'
- gem: 'bolt'
version: '>= 3.10.0'
optional:
Expand All @@ -13,6 +11,7 @@ Gemfile:
version: '4.21.0' # Locked due to https://github.com/octokit/octokit.rb/issues/1391
Rakefile:
changelog_since_tag: '2.5.0'
default_disabled_lint_checks: ['strict_indent','manifest_whitespace_missing_newline_end_of_file']
extras:
- 'PuppetSyntax.exclude_paths = ["plans/**/*.pp", "spec/acceptance/**/plans/**/*.pp", "vendor/**/*"]'
spec/spec_helper.rb:
Expand All @@ -25,7 +24,11 @@ spec/spec_helper.rb:
- '.plan_cache.json'
- '.resource_types/'
- 'bolt-debug.log'
- 'spec/docker/**/*.tar.gz'
- 'spec/docker/**/*.asc'
- 'spec/docker/**/files/puppet-enterprise*'
- 'spec/docker/.task_cache.json'
.github/workflows/auto_release.yml:
unmanaged: false
unmanaged: true
.github/workflows/release.yml:
unmanaged: false
41 changes: 25 additions & 16 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,34 @@ def location_for(place_or_version, fake_version = nil)
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]
gem "puppet-debugger", '>= 0.18.0', require: false
gem "bolt", '>= 3.17.0', require: false
gem "github_changelog_generator", '>= 1.16.4', require: false
gem "octokit", '4.21.0', require: false
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', '< 3.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
gem "json", '= 2.5.1', require: false if Gem::Requirement.create(['>= 3.0.0', '< 3.0.5']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
gem "json", '= 2.6.1', require: false if Gem::Requirement.create(['>= 3.1.0', '< 3.1.3']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
gem "json", '= 2.6.3', require: false if Gem::Requirement.create(['>= 3.2.0', '< 4.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
gem "voxpupuli-puppet-lint-plugins", '~> 3.1', require: false
gem "facterdb", '~> 1.18', require: false
gem "metadata-json-lint", '>= 2.0.2', '< 4.0.0', require: false
gem "puppetlabs_spec_helper", '>= 3.0.0', '< 5.0.0', require: false
gem "rspec-puppet-facts", '~> 2.0', require: false
gem "codecov", '~> 0.2', require: false
gem "dependency_checker", '~> 0.2', require: false
gem "parallel_tests", '~> 3.4', require: false
gem "pry", '~> 0.10', require: false
gem "simplecov-console", '~> 0.5', require: false
gem "puppet-debugger", '~> 1.0', require: false
gem "rubocop", '= 1.6.1', require: false
gem "rubocop-performance", '= 1.9.1', require: false
gem "rubocop-rspec", '= 2.0.1', require: false
gem "rb-readline", '= 0.5.5', require: false, platforms: [:mswin, :mingw, :x64_mingw]
gem "bolt", '>= 3.10.0', require: false
gem "github_changelog_generator", require: false
gem "octokit", '4.21.0', require: false
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]
gem "puppet_litmus", '< 1.0.0', require: false, platforms: [:ruby]
gem "serverspec", '~> 2.41', require: false
end

puppet_version = ENV['PUPPET_GEM_VERSION']
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

This Puppet module contains Bolt plans used to deploy and manage Puppet Enterprise infrastructure. Plans are provided to automate common lifecycle activities in order to increase velocity and reduce the possibility of human error incurred by manually performing these activities.

The peadm module is able to deploy and manage Puppet Enterprise 2019.x Standard, Large, and Extra Large architectures.
The peadm module is able to deploy and manage Puppet Enterprise 2019.7 and higher for Standard, Large, and Extra Large architectures.

#### Table of Contents

Expand Down
2 changes: 2 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ def changelog_future_release
end

PuppetLint.configuration.send('disable_relative')
PuppetLint.configuration.send('disable_strict_indent')
PuppetLint.configuration.send('disable_manifest_whitespace_missing_newline_end_of_file')


if Bundler.rubygems.find_name('github_changelog_generator').any?
Expand Down
14 changes: 6 additions & 8 deletions examples/haproxy/compiler.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,20 @@
#
# lint:ignore:autoloader_layout
class examples::compiler {

@@haproxy::balancermember { "${::clientcert}_puppetserver_listener":
@@haproxy::balancermember { "${facts['clientcert']}_puppetserver_listener":
listening_service => 'puppetserver',
server_names => $::fqdn,
ipaddresses => $::ipaddress,
server_names => $facts['networking']['fqdn'],
ipaddresses => $facts['networking']['ip'],
ports => '8140',
options => 'check',
}

@@haproxy::balancermember { "${::clientcert}_pcp-broker_listener":
@@haproxy::balancermember { "${facts['clientcert']}_pcp-broker_listener":
listening_service => 'pcp-broker',
server_names => $::fqdn,
ipaddresses => $::ipaddress,
server_names => $facts['networking']['fqdn'],
ipaddresses => $facts['networking']['ip'],
ports => '8142',
options => 'check',
}

}
# lint:endignore
14 changes: 6 additions & 8 deletions examples/haproxy/load_balancer.pp
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
#
# lint:ignore:autoloader_layout
class examples::load_balancer {

class { 'haproxy':
global_options => {
'log' => "${::ipaddress} local2",
'log' => "${facts['facts[\'networking\'][\'ip\']']} local2",
'chroot' => '/var/lib/haproxy',
'pidfile' => '/var/run/haproxy.pid',
'maxconn' => 5000,
Expand All @@ -24,14 +23,14 @@
'client 2m',
'server 2m',
'http-request 120s',
]
}
],
},
}

haproxy::listen { 'puppetserver':
collect_exported => true,
mode => 'tcp',
ipaddress => $::ipaddress,
ipaddress => $facts['networking']['ip'],
ports => '8140',
options => {
option => ['tcplog'],
Expand All @@ -42,7 +41,7 @@
haproxy::listen { 'pcp-broker':
collect_exported => true,
mode => 'tcp',
ipaddress => $::ipaddress,
ipaddress => $facts['networking']['ip'],
ports => '8142',
options => {
option => ['tcplog'],
Expand All @@ -57,10 +56,9 @@
# TODO: split load balancing into two pools, A and B
haproxy::listen { 'puppetdb':
collect_exported => true,
ipaddress => $::ipaddress,
ipaddress => $facts['networking']['ip'],
ports => '8081',
options => {},
}

}
# lint:endignore
8 changes: 3 additions & 5 deletions examples/haproxy/puppetdb.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@
#
# lint:ignore:autoloader_layout
class examples::puppetdb {

# TODO: split load balancing into two pools, A and B
@@haproxy::balancermember { "${::clientcert}_puppetdb_listener":
@@haproxy::balancermember { "${facts['clientcert']}_puppetdb_listener":
listening_service => 'puppetdb',
server_names => $::fqdn,
ipaddresses => $::ipaddress,
server_names => $facts['networking']['fqdn'],
ipaddresses => $facts['networking']['ip'],
ports => '8081',
options => 'check',
}

}
# lint:endignore
25 changes: 13 additions & 12 deletions functions/assert_supported_architecture.pp
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,24 @@ function peadm::assert_supported_architecture (
] {
[true, false, false, false]: { # Standard or Large, no DR
({ 'disaster-recovery' => false, 'architecture' => $compiler_hosts ? {
undef => 'standard',
default => 'large',
}})
undef => 'standard',
default => 'large',
} })
}
[true, true, false, false]: { # Standard or Large, DR
[true, true, false, false]: { # Standard or Large, DR
({ 'disaster-recovery' => true, 'architecture' => $compiler_hosts ? {
undef => 'standard',
default => 'large',
}})
undef => 'standard',
default => 'large',
} })
}
[true, false, true, false]: { # Extra Large, no DR
[true, false, true, false]: { # Extra Large, no DR
({ 'disaster-recovery' => false, 'architecture' => 'extra-large' })
}
[true, true, true, true]: { # Extra Large, DR
[true, true, true, true]: { # Extra Large, DR
({ 'disaster-recovery' => true, 'architecture' => 'extra-large' })
}
default: { # Invalid
# lint:ignore:strict_indent
default: { # Invalid
out::message(inline_epp(@(HEREDOC)))
Invalid architecture! Recieved:
- primary
Expand Down Expand Up @@ -75,7 +76,7 @@ function peadm::assert_supported_architecture (
fail('Invalid architecture!')
}
}

# lint:endignore
# Return value
return({ 'supported' => true } + $result)
return({ 'supported' => true } + $result)
}
6 changes: 3 additions & 3 deletions functions/assert_supported_bolt_version.pp
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
# Accepts a parameter for the $supported_bolt_version for unit testing purposes
function peadm::assert_supported_bolt_version (
# No arguments
) >> Struct[{'supported' => Boolean}] {
) >> Struct[{ 'supported' => Boolean }] {
$supported_bolt_version = '>= 3.17.0 < 4.0.0'
$supported = (peadm::bolt_version() =~ SemVerRange($supported_bolt_version))

# lint:ignore:strict_indent
unless $supported {
fail(@("REASON"/L))
This version of puppetlabs-peadm requires Bolt version ${supported_bolt_version}.
Expand All @@ -19,6 +19,6 @@ function peadm::assert_supported_bolt_version (

| REASON
}

# lint:endignore
return({ 'supported' => $supported })
}
6 changes: 6 additions & 0 deletions functions/assert_supported_pe_version.pp
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,23 @@ function peadm::assert_supported_pe_version (
$supported = ($version =~ SemVerRange(">= ${oldest} <= ${newest}"))

if $permit_unsafe_versions {
# lint:ignore:strict_indent
warning(@("WARN"/L))
WARNING: Permitting unsafe PE versions. This is not supported or tested.
Proceeding with this action could result in a broken PE Infrastructure.
| WARN
# lint:endignore
}

if (!$supported and $permit_unsafe_versions) {
# lint:ignore:strict_indent
warning(@("WARN"/L))
WARNING: PE version ${version} is NOT SUPPORTED!
| WARN
# lint:endignore
}
elsif (!$supported) {
# lint:ignore:strict_indent
fail(@("REASON"/L))
This version of the puppetlabs-peadm module does not support PE ${version}.

Expand All @@ -32,6 +37,7 @@ function peadm::assert_supported_pe_version (
exists which supports that version of PE.

| REASON
# lint:endignore
}

return({ 'supported' => $supported })
Expand Down
Loading

0 comments on commit e489d84

Please sign in to comment.