4 changes: 1 addition & 3 deletions .fixtures.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ fixtures:
service: "puppetlabs/service"
package: "puppetlabs/package"
reboot: "puppetlabs/reboot"
node_manager:
repo: "WhatsARanjit/node_manager"
ref: "0.7.5"
repositories:
facts: "https://github.com/puppetlabs/puppetlabs-facts.git"
puppet_agent: "https://github.com/puppetlabs/puppetlabs-puppet_agent.git"
Expand All @@ -17,6 +14,7 @@ fixtures:
bolt_shim: "https://github.com/puppetlabs/puppetlabs-bolt_shim"
format: "https://github.com/voxpupuli/puppet-format"
container_inventory: "https://gitlab.com/nwops/bolt-container_inventory"
node_manager: "https://github.com/puppetlabs/puppetlabs-node_manager.git"
symlinks:
"peadm": "#{source_dir}"
"peadm_spec": "#{source_dir}/spec/acceptance/peadm_spec"
4 changes: 1 addition & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ on:
jobs:
Spec:
if: ${{ github.repository_owner == 'puppetlabs' }}
# Temporary workaround for allowing locking node_manager less than latest
# uses: "puppetlabs/cat-github-actions/.github/workflows/module_ci.yml@main"
uses: "./.github/workflows/module_ci.yml"
uses: "puppetlabs/cat-github-actions/.github/workflows/module_ci.yml@main"
secrets: "inherit"

Acceptance:
Expand Down
92 changes: 0 additions & 92 deletions .github/workflows/module_ci.yml

This file was deleted.

4 changes: 1 addition & 3 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ on:
jobs:
Spec:
if: ${{ github.repository_owner == 'puppetlabs' }}
# Temporary workaround for allowing locking node_manager less than latest
# uses: "puppetlabs/cat-github-actions/.github/workflows/module_ci.yml@main"
uses: "./.github/workflows/module_ci.yml"
uses: "puppetlabs/cat-github-actions/.github/workflows/module_ci.yml@main"
secrets: "inherit"

Acceptance:
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ All 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).

## [v3.21.0](https://github.com/puppetlabs/puppetlabs-peadm/tree/v3.21.0) - 2024-07-15

[Full Changelog](https://github.com/puppetlabs/puppetlabs-peadm/compare/v3.20.0...v3.21.0)

### Added

- PE-38219 - Support air gapped installation while using a Windows as Jump host [#438](https://github.com/puppetlabs/puppetlabs-peadm/pull/438) ([cathal41](https://github.com/cathal41))

## [v3.20.0](https://github.com/puppetlabs/puppetlabs-peadm/tree/v3.20.0) - 2024-07-01

[Full Changelog](https://github.com/puppetlabs/puppetlabs-peadm/compare/v3.19.0...v3.20.0)
Expand Down
2 changes: 1 addition & 1 deletion Puppetfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
# The following directive installs modules to the managed moduledir.
moduledir '.modules'

mod 'WhatsARanjit/node_manager', '0.7.5'
mod 'puppetlabs/node_manager', '1.0.1'
mod 'puppet/format', '1.1.1'
mod 'puppetlabs/stdlib', '9.5.0'
7 changes: 7 additions & 0 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
* [`infrastatus`](#infrastatus): Runs puppet infra status and returns the output
* [`mkdir_p_file`](#mkdir_p_file): Create a file with the specified content at the specified location
* [`mv`](#mv): Wrapper task for mv command
* [`os_identification`](#os_identification): Return the operating system runnin gon the target as a string
* [`pe_install`](#pe_install): Install Puppet Enterprise from a tarball
* [`pe_ldap_config`](#pe_ldap_config): Set the ldap config in the PE console
* [`pe_uninstall`](#pe_uninstall): Uninstall Puppet Enterprise
Expand Down Expand Up @@ -1242,6 +1243,12 @@ Data type: `String`

New path of file

### <a name="os_identification"></a>`os_identification`

Return the operating system runnin gon the target as a string

**Supports noop?** false

### <a name="pe_install"></a>`pe_install`

Install Puppet Enterprise from a tarball
Expand Down
9 changes: 0 additions & 9 deletions bolt-project.yaml

This file was deleted.

3 changes: 2 additions & 1 deletion manifests/setup/node_manager.pp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@
# We modify this group's rule such that all PE infrastructure nodes will be
# members.
node_group { 'PE Infrastructure Agent':
rule => ['or',
purge_behavior => rule,
rule => ['or',
['~', ['trusted', 'extensions', peadm::oid('peadm_role')], '^puppet/'],
['~', ['fact', 'pe_server_version'], '.+']
],
Expand Down
6 changes: 3 additions & 3 deletions metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "puppetlabs-peadm",
"version": "3.20.0",
"version": "3.21.0",
"author": "puppetlabs",
"summary": "Bolt plans used to deploy an at-scale Puppet Enterprise architecture",
"license": "Apache-2.0",
Expand All @@ -13,8 +13,8 @@
"version_requirement": ">= 9.0.0 < 10.0.0"
},
{
"name": "WhatsARanjit/node_manager",
"version_requirement": "0.7.5"
"name": "puppetlabs/node_manager",
"version_requirement": ">= 1.0.1 < 2.0.0"
},
{
"name": "puppetlabs/bolt_shim",
Expand Down
19 changes: 18 additions & 1 deletion plans/util/retrieve_and_upload.pp
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,28 @@
|-HEREDOC
# lint:endignore

$operating_system = run_task('peadm::os_identification', 'local://localhost')
$os_string =$operating_system.first.value['_output']

if 'windows' in $os_string {
$exists = run_command("[System.IO.File]::Exists('${local_path}')", 'local://localhost')
if $exists.first['stdout'].chomp == 'false' {
run_task('peadm::download', 'local://localhost',
source => $source,
path => $local_path,
)
}

$result_size = run_task('peadm::filesize', 'local://localhost',
path => $local_path,
)
$local_size = $result_size.first.value['_output']
} else {
$exists = without_default_logging() || {
run_command("test -e '${local_path}'", 'local://localhost',
_catch_errors => true,
).ok()
}

unless $exists {
run_task('peadm::download', 'local://localhost',
source => $source,
Expand All @@ -45,6 +61,7 @@
$local_size = run_task('peadm::filesize', 'local://localhost',
path => $local_path,
).first['size']
}

$targets_needing_file = run_task('peadm::filesize', $nodes,
path => $upload_path,
Expand Down
2 changes: 1 addition & 1 deletion spec/docker/Puppetfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ moduledir '.modules'
mod 'puppet/format', '1.0.0'
mod 'puppetlabs/bolt_shim', '0.3.2'
mod 'puppetlabs/apply_helpers', '0.3.0'
mod 'WhatsARanjit/node_manager', '0.7.5'
mod 'puppetlabs/node_manager', '1.0.1'
mod 'puppetlabs/ruby_task_helper', '0.5.1'
mod 'puppetlabs/stdlib', '7.1.0'
mod 'nwops/container_inventory', '0.1.1'
4 changes: 2 additions & 2 deletions spec/docker/bolt-project.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ modules:
- name: puppetlabs/stdlib
version_requirement: ">= 6.5.0 < 8.0.0"
- puppetlabs/ruby_task_helper
- name: WhatsARanjit/node_manager
version_requirement: "0.7.5"
- name: puppetlabs/node_manager
version_requirement: ">= 1.0.1 < 2.0.0"
- puppetlabs/apply_helpers
- puppetlabs/bolt_shim
- puppet/format
1 change: 1 addition & 0 deletions spec/plans/util/retrieve_and_upload_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
include BoltSpec::Plans

it 'file needs downloaded and needs uploaded' do
expect_task('peadm::os_identification')
expect_command("test -e '/tmp/download'").error_with('kind' => 'nope', 'msg' => 'The command failed with exit code 1')
expect_task('peadm::download')
expect_task('peadm::filesize').be_called_times(2).return_for_targets(
Expand Down
6 changes: 3 additions & 3 deletions tasks/download.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
"default": "hkp://keyserver.ubuntu.com:80"
}
},
"input_method": "environment",
"implementations": [
{"name": "download.sh"}
]
{"name": "download.sh", "requirements": ["shell"], "input_method": "environment"},
{"name": "download.ps1", "requirements": ["powershell"], "input_method": "powershell"}
]
}
12 changes: 12 additions & 0 deletions tasks/download.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# download.ps1
Param(
$source,
$path
)

try {
[Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}; $webClient = New-Object System.Net.WebClient; $webClient.DownloadFile($source, $path);
}catch {
Write-Host "Installer failed with Exception: $_.Exception.Message"
Exit 1
}
4 changes: 2 additions & 2 deletions tasks/filesize.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"description": "Path to the file to return the size of"
}
},
"input_method": "environment",
"implementations": [
{"name": "filesize.sh"}
{"name": "filesize.sh", "requirements": ["shell"], "input_method": "environment"},
{"name": "filesize.ps1", "requirements": ["powershell"], "input_method": "powershell"}
]
}
28 changes: 28 additions & 0 deletions tasks/filesize.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# filesize.ps1
Param(
$path
)
if ([string]::IsNullOrEmpty($path)){
Write-Host "No path provided to filesize"
Exit 1
}
try {

# Get the File
$File = Get-Item -Path $path
# Get the File Size
$size = $File.Length

# Output a JSON result for ease of Task usage in Puppet Task Plans
if ($size -eq $null) {
Write-Host "{'size': '$null'}"
}else{
Write-Host "{'size': '$size'}"
}

return $size

}catch {
Write-Host "Installer failed with Exception: $_.Exception.Message"
Exit 1
}
9 changes: 9 additions & 0 deletions tasks/os_identification.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"description": "Return the operating system runnin gon the target as a string",
"parameters": { },
"implementations": [
{"name": "os_identification.sh", "requirements": ["shell"], "input_method": "environment"},
{"name": "os_identification.ps1", "requirements": ["powershell"]}
]
}

18 changes: 18 additions & 0 deletions tasks/os_identification.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# os_identification.ps1
try {

$os = [System.Environment]::OSVersion.Platform

if ($os -eq "Win32NT") {
$osfamily = "windows"
}elseif ($os -eq "Unix") {
$osfamily = "unix"
}else {
$osfamily = "unknown"
}

return $osfamily
}catch {
Write-Host "Installer failed with Exception: $_.Exception.Message"
Exit 1
}
18 changes: 18 additions & 0 deletions tasks/os_identification.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
osfamily="linux"
elif [[ "$OSTYPE" == "darwin"* ]]; then
osfamily="macOS"
elif [[ "$OSTYPE" == "cygwin" ]]; then
osfamily="cygwin"
elif [[ "$OSTYPE" == "msys" ]]; then
osfamily="msys"
elif [[ "$OSTYPE" == "win32" ]]; then
osfamily="windows"
elif [[ "$OSTYPE" == "freebsd"* ]]; then
osfamily="freebsd"
else
osfamily="unknown"
fi

echo $osfamily