Skip to content

Commit fd52eab

Browse files
committed
Puppet 8 compat
1 parent 47bc00c commit fd52eab

File tree

7 files changed

+16
-13
lines changed

7 files changed

+16
-13
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
- settings are computed in tp::install and used in tp::install::* defines
1111
- get_version and url_replace functions accept an addtional version type paramter
1212
- Widened support for variables in tinydata
13+
- Removed legacy facts for Puppet 8 compatibility
1314

1415
## 3.9.1
1516

manifests/install.pp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -223,11 +223,13 @@
223223
$real_version = tp::get_version($ensure,$version,$tp_settings)
224224
$real_majversion = tp::get_version($ensure,$version,$tp_settings,'major')
225225
$real_filename = pick(tp::url_replace(pick(getvar("tp_settings.${real_install_method}.file_name"),$app), $real_version, $real_majversion), $app) # lint:ignore:140chars
226-
if getvar('tp_settings.release.base_url') {
227-
$real_base_url = tp::url_replace(pick(getvar("tp_settings.${real_install_method}.base_url"), $app), $real_version, $real_majversion)
228-
$real_url = "${real_base_url}/${real_filename}"
229-
} else {
230-
tp::fail($on_missing_data, "tp::install::release - ${app} - Missing tinydata: settings.${real_install_method}.base_url") # lint:ignore:140chars
226+
if $use_v4 {
227+
if getvar('tp_settings.release.base_url') {
228+
$real_base_url = tp::url_replace(pick(getvar("tp_settings.${real_install_method}.base_url"), $app), $real_version, $real_majversion)
229+
$real_url = "${real_base_url}/${real_filename}"
230+
} else {
231+
tp::fail($on_missing_data, "tp::install::release - ${app} - Missing tinydata: settings.${real_install_method}.base_url") # lint:ignore:140chars
232+
}
231233
}
232234

233235
$extracted_dir = getvar('tp_settings.release.extracted_dir') ? {
@@ -255,7 +257,7 @@
255257
}),
256258
}),
257259
release => delete_undef_values({
258-
base_url => $real_base_url,
260+
base_url => pick_default($real_base_url),
259261
file_name => $real_filename,
260262
url => $real_url,
261263
extracted_dir => $extracted_dir,

metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "example42-tp",
3-
"version": "3.9.1",
3+
"version": "3.9.2",
44
"author": "example42",
55
"summary": "Tiny Puppet",
66
"license": "Apache-2.0",

templates/spec/osfamily.epp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
EPP: <%= $osfamily %>
1+
EPP: <%= $os['family'] %>

templates/spec/osfamily.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
ERB: <%= @osfamily %>
1+
ERB: <%= @os['family'] %>

templates/tp.epp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ TP_TEST_DIR = '<%= $tp_dir %>/test'
3131
TP_INFO_DIR = '<%= $tp_dir %>/info'
3232
TP_DEBUG_DIR = '<%= $tp_dir %>/debug'
3333

34-
<% if $osfamily == 'windows' { -%>
34+
<% if $os['family'] == 'windows' { -%>
3535
TINYDATA_DIRS = [
3636
"#{ENV['HOMEPATH']}/.puppetlabs/etc/code/modules/tinydata/data",
3737
- 'C:/Program Files/Puppet Labs/Puppet/puppet/modules/tinydata/data'
@@ -275,7 +275,7 @@ def desktop_apply(desktop_name,extra_options)
275275
repo_dirname=File.basename(repo_dir)
276276
local_modulepath=`puppet config print modulepath`.strip
277277
if File.exist?("#{repo_dir}/environment.conf")
278-
<% if $osfamily == 'windows' { -%>
278+
<% if $os['family'] == 'windows' { -%>
279279
modulepath="--modulepath #{repo_dir}/site:#{local_modulepath}:C:/ProgramData/PuppetLabs/code/environments/production/modules"
280280
<% } else { -%>
281281
modulepath="--modulepath #{repo_dir}/site:#{local_modulepath}:/etc/puppetlabs/code/environments/production/modules"

templates/tp.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ TP_TEST_DIR = '<%= @tp_dir %>/test'
2727
TP_INFO_DIR = '<%= @tp_dir %>/info'
2828
TP_RUN_INFO_DIR = '<%= @tp_dir %>/run_info'
2929

30-
<% if @osfamily == 'windows' -%>
30+
<% if @os['family'] == 'windows' -%>
3131
TINYDATA_DIRS = [
3232
"#{ENV['HOMEPATH']}/.puppetlabs/etc/code/modules/tinydata/data",
3333
- 'C:/Program Files/Puppet Labs/Puppet/puppet/modules/tinydata/data'
@@ -255,7 +255,7 @@ def desktop_apply(desktop_name,extra_options)
255255
repo_dirname=File.basename(repo_dir)
256256
local_modulepath=`puppet config print modulepath`.strip
257257
if File.exist?("#{repo_dir}/environment.conf")
258-
<% if @osfamily == 'windows' -%>
258+
<% if @os['family'] == 'windows' -%>
259259
modulepath="--modulepath #{repo_dir}/site:#{local_modulepath}:C:/ProgramData/PuppetLabs/code/environments/production/modules"
260260
<% else -%>
261261
modulepath="--modulepath #{repo_dir}/site:#{local_modulepath}:/etc/puppetlabs/code/environments/production/modules"

0 commit comments

Comments
 (0)