Skip to content

Commit 438257c

Browse files
authored
3.10.2 (#115)
* Minors * Better Windows * lints * Fixes and enhanchements * Service works * Fixed v4 validate_cmd * Preparing new release * Updated changelog
1 parent 4b7c333 commit 438257c

16 files changed

+274
-179
lines changed

.vscode/settings.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"cSpell.words": [
3+
"cidfile"
4+
]
5+
}

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# CHANGELOG
22

3+
## 3.10.2
4+
5+
- Fixed options param in tp::conf where use_v4 is false
6+
- Windows improvements
7+
38
## 3.10.1
49

510
- Changed CI containers used

data/Linux.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
tp::tp_owner: 'root'
3+
tp::tp_group: 'root'

data/windows.yaml

Lines changed: 12 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,41 @@
11
---
2-
tp::tp_owner: 'Administrator'
3-
tp::tp_group: 'Administrators'
4-
tp::info_script_path: 'C:/ProgramData/PuppetLabs/bin/run_info.ps1'
5-
tp::debug_script_path: 'C:/ProgramData/PuppetLabs/bin/run_debug.ps1'
6-
2+
tp::tp_owner: ~
3+
tp::tp_group: ~
4+
#tp::tp_owner: 'Administrator'
5+
#tp::tp_group: 'Administrators'
6+
tp::info_script_path: 'C:/ProgramData/PuppetLabs/tp/bin/run_info.ps1'
7+
tp::debug_script_path: 'C:/ProgramData/PuppetLabs/tp/bin/run_debug.ps1'
8+
#tp::cli::ensure: 'absent'
9+
#tp::ensure: 'absent'
710
# tp 4 new entrypoints
811
## tp cli configurations
912
tp::tp_params:
1013
global:
14+
owner: ~
15+
group: ~
16+
mode: '0775'
1117
tp:
1218
path: 'C:/ProgramData/PuppetLabs/tp/bin/tp'
13-
args:
14-
owner: 'Administrator'
15-
group: 'Administrators'
1619
conf:
1720
path: 'C:/ProgramData/PuppetLabs/tp'
18-
args:
19-
ensure: 'directory'
20-
owner: 'Administrator'
21-
group: 'Administrators'
2221
data:
2322
path: 'C:/ProgramData/PuppetLabs/tp/lib'
24-
args:
25-
ensure: 'directory'
26-
owner: 'Administrator'
27-
group: 'Administrators'
2823
bin:
2924
path: 'C:/ProgramData/PuppetLabs/tp/bin'
3025
args:
31-
ensure: 'directory'
32-
owner: 'Administrator'
33-
group: 'Administrators'
34-
source: 'puppet:///modules/tp/bin'
26+
source: 'puppet:///modules/tp/bin_windows'
3527
destination:
3628
path: 'C:/ProgramData/PuppetLabs/tp'
3729
user:
3830
tp:
3931
path: '~/.tp/bin/tp'
40-
args:
41-
mode: '0755'
4232
conf:
4333
path: '~/.tp/etc'
44-
args:
45-
ensure: 'directory'
46-
mode: '0755'
4734
data:
4835
path: '~/.tp/lib'
49-
args:
50-
ensure: 'directory'
51-
mode: '0755'
5236
bin:
5337
path: '~/.tp/bin'
5438
args:
55-
ensure: 'directory'
56-
mode: '0755'
5739
source: 'puppet:///modules/tp/bin'
5840
destination:
5941
path: '~/.tp/bin'

functions/get_version.pp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ function tp::get_version (
66
Hash $_settings = {},
77
Enum['full', 'major'] $_version_type = 'full',
88
) {
9-
if $_version_type == 'major' {
10-
$real_version = pick_default(getvar('_settings.release.latest_version_major'))
9+
if $_version_type == 'major' and getvar('_settings.release.latest_version_major') {
10+
$real_version = getvar('_settings.release.latest_version_major')
1111
} elsif $_version != undef and $_ensure != 'absent' {
1212
$real_version = $_version
1313
} elsif $_ensure !~ /^present$|^latest$|^absent$/ {

manifests/cli.pp

Lines changed: 73 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
$real_options = $options_defaults + $options
4949

5050
$real_ruby_path = $ruby_path ? {
51-
undef => $facts['aio_agent_version'] ? {
51+
undef => getvar('facts.aio_agent_version') ? {
5252
undef => '/usr/bin/env ruby',
5353
'' => '/usr/bin/env ruby',
5454
default => $facts['os']['family'] ? {
@@ -61,92 +61,90 @@
6161

6262
File {
6363
ensure => $file_ensure,
64-
mode => $real_tp_params['mode'],
65-
owner => $real_tp_params['owner'],
66-
group => $real_tp_params['group'],
64+
mode => $tp::tp_dirs_mode,
65+
owner => $tp::tp_dirs_owner,
66+
group => $tp::tp_dirs_group,
6767
}
6868

69-
if $cli_enable {
70-
$dirs = [$tp::tp_dir , "${tp::tp_dir}/app" , "${tp::tp_dir}/shellvars" , "${tp::tp_dir}/test", "${tp::tp_dir}/info", "${tp::tp_dir}/debug"]
71-
$dirs.each | $d | {
72-
file { $d:
73-
ensure => $dir_ensure,
74-
purge => $purge_dirs,
75-
force => $purge_dirs,
76-
recurse => $purge_dirs,
77-
}
69+
$dirs = [$tp::tp_dir , "${tp::tp_dir}/app" , "${tp::tp_dir}/shellvars" , "${tp::tp_dir}/test", "${tp::tp_dir}/info", "${tp::tp_dir}/debug"]
70+
$dirs.each | $d | {
71+
file { $d:
72+
ensure => $dir_ensure,
73+
purge => $purge_dirs,
74+
force => $purge_dirs,
75+
recurse => $purge_dirs,
7876
}
79-
$work_dirs = [$tp::data_dir, $tp::download_dir , $tp::extract_dir , $tp::flags_dir]
80-
$work_dirs.each | $d | {
81-
file { $d:
82-
ensure => $dir_ensure,
77+
}
78+
$work_dirs = [$tp::data_dir, $tp::download_dir , $tp::extract_dir , $tp::flags_dir]
79+
$work_dirs.each | $d | {
80+
file { $d:
81+
ensure => $dir_ensure,
8382
# purge => $purge_dirs,
8483
# force => $purge_dirs,
8584
# recurse => $purge_dirs,
86-
}
87-
}
88-
$epp_params = {
89-
'real_ruby_path' => $real_ruby_path,
90-
'options' => $real_options,
91-
'suppress_tp_warnings' => $suppress_tp_warnings,
92-
'suppress_tp_output' => $suppress_tp_output,
93-
'tp_dir' => $tp::tp_dir,
94-
}
95-
file { $tp::tp_path:
96-
path => $tp::tp_path,
97-
content => epp('tp/tp.epp', $epp_params),
98-
}
99-
100-
if $facts['os']['family'] == 'windows' {
101-
file { "${tp::tp_path}.bat":
102-
content => epp('tp/tp.bat.epp'),
103-
}
104-
} else {
105-
file { '/usr/sbin/tp':
106-
ensure => link,
107-
target => $tp::tp_path,
108-
}
10985
}
86+
}
87+
$epp_params = {
88+
'real_ruby_path' => $real_ruby_path,
89+
'options' => $real_options,
90+
'suppress_tp_warnings' => $suppress_tp_warnings,
91+
'suppress_tp_output' => $suppress_tp_output,
92+
'tp_dir' => $tp::tp_dir,
93+
}
94+
file { $tp::tp_path:
95+
path => $tp::tp_path,
96+
content => epp('tp/tp.epp', $epp_params),
97+
}
11098

111-
file { 'bin dir':
112-
ensure => $dir_ensure,
113-
path => "${tp::tp_dir}/bin",
114-
source => $real_tp_params['bin']['args']['source'],
115-
recurse => true,
116-
}
117-
file { 'info scripts':
118-
ensure => $dir_ensure,
119-
path => "${tp::tp_dir}/bin/run_info",
120-
source => $info_source,
121-
recurse => true,
99+
if $facts['os']['family'] == 'windows' {
100+
file { "${tp::tp_path}.bat":
101+
content => epp('tp/tp.bat.epp'),
122102
}
123-
file { 'package_info':
124-
mode => '0755',
125-
path => "${tp::tp_dir}/bin/run_info/package_info",
126-
content => epp('tp/run_info/package_info.epp'),
103+
} else {
104+
file { '/usr/sbin/tp':
105+
ensure => link,
106+
target => $tp::tp_path,
127107
}
108+
}
128109

129-
file { $info_script_path:
130-
mode => '0755',
131-
path => $info_script_path,
132-
content => epp($info_script_template, { 'options' => $real_options }),
133-
}
110+
file { 'bin dir':
111+
ensure => $dir_ensure,
112+
path => "${tp::tp_dir}/bin",
113+
source => $real_tp_params['bin']['args']['source'],
114+
recurse => true,
115+
}
116+
file { 'info scripts':
117+
ensure => $dir_ensure,
118+
path => "${tp::tp_dir}/bin/run_info",
119+
source => $info_source,
120+
recurse => true,
121+
}
122+
file { 'package_info':
123+
mode => '0755',
124+
path => "${tp::tp_dir}/bin/run_info/package_info",
125+
content => epp('tp/run_info/package_info.epp'),
126+
}
134127

135-
file { 'debug scripts':
136-
ensure => $dir_ensure,
137-
path => "${tp::tp_dir}/bin/run_debug",
138-
source => $debug_source,
139-
}
140-
file { 'package_debug':
141-
mode => '0755',
142-
path => "${tp::tp_dir}/bin/run_debug/package_debug",
143-
content => epp('tp/run_debug/package_debug.epp'),
144-
}
145-
file { $debug_script_path:
146-
mode => '0755',
147-
path => $debug_script_path,
148-
content => epp($debug_script_template, { 'options' => $real_options }),
149-
}
128+
file { $info_script_path:
129+
mode => '0755',
130+
path => $info_script_path,
131+
content => epp($info_script_template, { 'options' => $real_options }),
132+
}
133+
134+
file { 'debug scripts':
135+
ensure => $dir_ensure,
136+
path => "${tp::tp_dir}/bin/run_debug",
137+
source => $debug_source,
138+
}
139+
file { 'package_debug':
140+
mode => '0755',
141+
path => "${tp::tp_dir}/bin/run_debug/package_debug",
142+
content => epp('tp/run_debug/package_debug.epp'),
143+
}
144+
file { $debug_script_path:
145+
mode => '0755',
146+
path => $debug_script_path,
147+
content => epp($debug_script_template, { 'options' => $real_options }),
150148
}
151149
}
152150
}

manifests/conf.pp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -394,15 +394,14 @@
394394
$default_validate_cmd = $validate_cmd ? {
395395
'' => undef,
396396
String => $validate_cmd,
397-
Hash => pick_default(getvar("settings.validate_cmd.${base_dir}"), undef),
397+
Hash => getvar("settings.validate_cmd.${base_dir}"),
398398
Undef => undef,
399399
}
400400
$real_validate_cmd = $validate_syntax ? {
401401
undef => $default_validate_cmd,
402402
true => $default_validate_cmd,
403403
false => undef,
404404
}
405-
406405
# Resources
407406
if $path_parent_create {
408407
$path_parent = dirname($real_path)
@@ -446,7 +445,7 @@
446445
$settings = $tp_settings + $settings_hash
447446

448447
$tp_options = tp_lookup($app,"options::${base_file}",$data_module,'merge')
449-
$options = $tp_options + $options_hash
448+
$options = deep_merge($tp_options,$options_hash,$my_options,)
450449

451450
if $file and $file != '' {
452451
$prefix = $scope ? {
@@ -490,7 +489,7 @@
490489

491490
# If user doesn't provide a $content, $template or $epp but provides $options_hash we check
492491
# if on tinydata is set config_file_format
493-
if $content_params =~ Undef and $settings[config_file_format] and $options_hash != {} {
492+
if $content_params =~ Undef and $settings[config_file_format] and $options != {} {
494493
$manage_content = $settings[config_file_format] ? {
495494
'yaml' => to_yaml($options_hash),
496495
'json' => to_json($options_hash),
@@ -532,6 +531,7 @@
532531
}
533532

534533
$default_validate_cmd = $settings['validate_cmd'] ? {
534+
'' => undef,
535535
String => $settings['validate_cmd'],
536536
Hash => $settings['validate_cmd'][$base_dir],
537537
Undef => undef,

manifests/copy_file.pp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,15 @@
2525
if $overwrite {
2626
$exec_creates = undef
2727
$exec_unless = "diff ${source} ${path} >/dev/null"
28+
$cp_force = '-f'
2829
} else {
2930
$exec_creates = $path
3031
$exec_unless = undef
32+
$cp_force = ''
3133
}
3234
if $ensure == 'present' {
3335
exec { "tp::copy_file ${title}":
34-
command => "cp ${source} ${path}",
36+
command => "cp ${cp_force} ${source} ${path}",
3537
path => $facts['path'],
3638
creates => $exec_creates,
3739
unless => $exec_unless,

manifests/create_dir.pp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
define tp::create_dir (
1111
Optional[String] $owner = undef,
1212
Optional[String] $group = undef,
13-
Optional[Stdlib::Filemode] $mode = undef,
13+
Optional[Stdlib::Filemode] $mode = undef,
1414
Stdlib::AbsolutePath $path = $title,
1515
) {
1616
$mkdir_command = $facts['os']['family'] ? {
@@ -23,10 +23,10 @@
2323
}
2424

2525
exec { "Create directory ${title}":
26-
command => $mkdir_command,
27-
path => $facts['path'],
28-
creates => $path,
29-
provider => $command_provider,
26+
command => $mkdir_command,
27+
path => $facts['path'],
28+
creates => $path,
29+
# provider => $command_provider,
3030
}
3131

3232
if $facts['os']['family'] != 'windows' {
@@ -45,10 +45,11 @@
4545
}
4646
}
4747
if $mode {
48+
$short_mode = regsubst($mode, '^0', '')
4849
exec { "chmod ${mode} ${title}":
4950
command => "chmod '${mode}' '${path}'",
5051
path => '/bin:/sbin:/usr/sbin:/usr/bin',
51-
onlyif => "[ 0\$(stat -c '%a' '${path}') != '${mode}' ]",
52+
onlyif => "[ \$(stat -c '%a' '${path}') != '${short_mode}' ]",
5253
}
5354
}
5455
}

0 commit comments

Comments
 (0)