Skip to content

Commit

Permalink
Make $pe_installer_source more flexible
Browse files Browse the repository at this point in the history
This makes the peadm::install plan more flexible. Previously the
variable $pe_installer_source could point to an absolute URL directly to
the desired .tar.gz. Now it can also point to a web directory. Then
peadm will calculate the .tar.gz name and fetch it from the web
directory.
  • Loading branch information
bastelfreak committed Jul 26, 2024
1 parent 4d54a13 commit ff1909f
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 10 deletions.
6 changes: 4 additions & 2 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -1862,7 +1862,8 @@ Data type: `Optional[String]`
The URL to download the Puppet Enterprise installer media from. If not
specified, PEAdm will attempt to download PE installation media from its
standard public source. When specified, PEAdm will download directly from the
URL given.
URL given. Can be an URL, that ends with a /, to a web directory that
contains the original archives or an absolute URL to the .tar.gz archive.

Default value: `undef`

Expand Down Expand Up @@ -2324,7 +2325,8 @@ Data type: `Optional[String]`
The URL to download the Puppet Enterprise installer media from. If not
specified, PEAdm will attempt to download PE installation media from its
standard public source. When specified, PEAdm will download directly from the
URL given.
URL given. Can be an URL, that ends with a /, to a web directory that
contains the original archives or an absolute URL to the .tar.gz archive.

Default value: `undef`

Expand Down
3 changes: 2 additions & 1 deletion plans/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
# The URL to download the Puppet Enterprise installer media from. If not
# specified, PEAdm will attempt to download PE installation media from its
# standard public source. When specified, PEAdm will download directly from the
# URL given.
# URL given. Can be an URL, that ends with a /, to a web directory that
# contains the original archives or an absolute URL to the .tar.gz archive.
# @param ldap_config
# If specified, configures PE RBAC DS with the supplied configuration hash.
# The parameter should be set to a valid set of connection settings as
Expand Down
12 changes: 9 additions & 3 deletions plans/subplans/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
# The URL to download the Puppet Enterprise installer media from. If not
# specified, PEAdm will attempt to download PE installation media from its
# standard public source. When specified, PEAdm will download directly from the
# URL given.
# URL given. Can be an URL, that ends with a /, to a web directory that
# contains the original archives or an absolute URL to the .tar.gz archive.
#
plan peadm::subplans::install (
# Standard
Expand Down Expand Up @@ -229,8 +230,13 @@
}

if $pe_installer_source {
$pe_tarball_name = $pe_installer_source.split('/')[-1]
$pe_tarball_source = $pe_installer_source
if $pe_installer_source[-1] == '/' {
$pe_tarball_name = "puppet-enterprise-${version}-${platform}.tar.gz"
$pe_tarball_source = "${pe_installer_source}${pe_tarball_name}"
} else {
$pe_tarball_name = $pe_installer_source.split('/')[-1]
$pe_tarball_source = $pe_installer_source
}
} else {
$pe_tarball_name = "puppet-enterprise-${version}-${platform}.tar.gz"
$pe_tarball_source = "https://s3.amazonaws.com/pe-builds/released/${version}/${pe_tarball_name}"
Expand Down
15 changes: 11 additions & 4 deletions plans/upgrade.pp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
# The URL to download the Puppet Enterprise installer media from. If not
# specified, PEAdm will attempt to download PE installation media from its
# standard public source. When specified, PEAdm will download directly from the
# URL given.
# URL given. Can be an URL, that ends with a /, to a web directory that
# contains the original archives or an absolute URL to the .tar.gz archive.
# @param final_agent_state
# Configures the state the puppet agent should be in on infrastructure nodes
# after PE is upgraded successfully.
Expand Down Expand Up @@ -118,9 +119,15 @@
$platform = run_task('peadm::precheck', $primary_target).first['platform']

if $pe_installer_source {
$pe_tarball_name = $pe_installer_source.split('/')[-1]
$pe_tarball_source = $pe_installer_source
$_version = $pe_tarball_name.split('-')[2]
if $pe_installer_source[-1] == '/' {
$_version = $version
$pe_tarball_name = "puppet-enterprise-${_version}-${platform}.tar.gz"
$pe_tarball_source = "${pe_installer_source}${pe_tarball_name}"
} else {
$pe_tarball_name = $pe_installer_source.split('/')[-1]
$pe_tarball_source = $pe_installer_source
$_version = $pe_tarball_name.split('-')[2]
}
} else {
$_version = $version
$pe_tarball_name = "puppet-enterprise-${_version}-${platform}.tar.gz"
Expand Down

0 comments on commit ff1909f

Please sign in to comment.