Skip to content

Commit ff1909f

Browse files
committed
Make $pe_installer_source more flexible
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.
1 parent 4d54a13 commit ff1909f

File tree

4 files changed

+26
-10
lines changed

4 files changed

+26
-10
lines changed

REFERENCE.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -1862,7 +1862,8 @@ Data type: `Optional[String]`
18621862
The URL to download the Puppet Enterprise installer media from. If not
18631863
specified, PEAdm will attempt to download PE installation media from its
18641864
standard public source. When specified, PEAdm will download directly from the
1865-
URL given.
1865+
URL given. Can be an URL, that ends with a /, to a web directory that
1866+
contains the original archives or an absolute URL to the .tar.gz archive.
18661867

18671868
Default value: `undef`
18681869

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

23292331
Default value: `undef`
23302332

plans/install.pp

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
# The URL to download the Puppet Enterprise installer media from. If not
1616
# specified, PEAdm will attempt to download PE installation media from its
1717
# standard public source. When specified, PEAdm will download directly from the
18-
# URL given.
18+
# URL given. Can be an URL, that ends with a /, to a web directory that
19+
# contains the original archives or an absolute URL to the .tar.gz archive.
1920
# @param ldap_config
2021
# If specified, configures PE RBAC DS with the supplied configuration hash.
2122
# The parameter should be set to a valid set of connection settings as

plans/subplans/install.pp

+9-3
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@
3232
# The URL to download the Puppet Enterprise installer media from. If not
3333
# specified, PEAdm will attempt to download PE installation media from its
3434
# standard public source. When specified, PEAdm will download directly from the
35-
# URL given.
35+
# URL given. Can be an URL, that ends with a /, to a web directory that
36+
# contains the original archives or an absolute URL to the .tar.gz archive.
3637
#
3738
plan peadm::subplans::install (
3839
# Standard
@@ -229,8 +230,13 @@
229230
}
230231

231232
if $pe_installer_source {
232-
$pe_tarball_name = $pe_installer_source.split('/')[-1]
233-
$pe_tarball_source = $pe_installer_source
233+
if $pe_installer_source[-1] == '/' {
234+
$pe_tarball_name = "puppet-enterprise-${version}-${platform}.tar.gz"
235+
$pe_tarball_source = "${pe_installer_source}${pe_tarball_name}"
236+
} else {
237+
$pe_tarball_name = $pe_installer_source.split('/')[-1]
238+
$pe_tarball_source = $pe_installer_source
239+
}
234240
} else {
235241
$pe_tarball_name = "puppet-enterprise-${version}-${platform}.tar.gz"
236242
$pe_tarball_source = "https://s3.amazonaws.com/pe-builds/released/${version}/${pe_tarball_name}"

plans/upgrade.pp

+11-4
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
# The URL to download the Puppet Enterprise installer media from. If not
1616
# specified, PEAdm will attempt to download PE installation media from its
1717
# standard public source. When specified, PEAdm will download directly from the
18-
# URL given.
18+
# URL given. Can be an URL, that ends with a /, to a web directory that
19+
# contains the original archives or an absolute URL to the .tar.gz archive.
1920
# @param final_agent_state
2021
# Configures the state the puppet agent should be in on infrastructure nodes
2122
# after PE is upgraded successfully.
@@ -118,9 +119,15 @@
118119
$platform = run_task('peadm::precheck', $primary_target).first['platform']
119120

120121
if $pe_installer_source {
121-
$pe_tarball_name = $pe_installer_source.split('/')[-1]
122-
$pe_tarball_source = $pe_installer_source
123-
$_version = $pe_tarball_name.split('-')[2]
122+
if $pe_installer_source[-1] == '/' {
123+
$_version = $version
124+
$pe_tarball_name = "puppet-enterprise-${_version}-${platform}.tar.gz"
125+
$pe_tarball_source = "${pe_installer_source}${pe_tarball_name}"
126+
} else {
127+
$pe_tarball_name = $pe_installer_source.split('/')[-1]
128+
$pe_tarball_source = $pe_installer_source
129+
$_version = $pe_tarball_name.split('-')[2]
130+
}
124131
} else {
125132
$_version = $version
126133
$pe_tarball_name = "puppet-enterprise-${_version}-${platform}.tar.gz"

0 commit comments

Comments
 (0)