Skip to content

Commit

Permalink
Added support for tinydata keys config_file_params and config_dir_par…
Browse files Browse the repository at this point in the history
…ams. Fixed support for repo_filename
  • Loading branch information
alvagante committed Jul 19, 2018
1 parent 530cf18 commit 1b82a47
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
6 changes: 5 additions & 1 deletion manifests/conf.pp
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@
before => File[$manage_path],
}
}
file { $manage_path:
$file_params = {
ensure => $ensure,
source => $source,
content => $manage_content,
Expand All @@ -334,6 +334,10 @@
validate_cmd => $manage_validate_cmd,
}

file { $manage_path:
* => $file_params + pick($settings[config_file_params],{})
}

# Debugging
if $debug == true {
$debug_scope = inline_template('<%= scope.to_hash.reject { |k,v| k.to_s =~ /(uptime.*|path|timestamp|free|.*password.*)/ } %>')
Expand Down
5 changes: 4 additions & 1 deletion manifests/dir.pp
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@
* => $vcsrepo_defaults + $vcsrepo_options,
}
} else {
file { $manage_path:
$file_params = {
ensure => $manage_ensure,
source => $source,
path => $manage_path,
Expand All @@ -255,6 +255,9 @@
purge => $purge,
force => $force,
}
file { $manage_path:
* => $file_params + pick($settings[config_dir_params],{})
}
}

# Debugging
Expand Down
11 changes: 6 additions & 5 deletions manifests/repo.pp
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,11 @@
Exec['tp_apt_update'] -> Package[$settings[package_name]]
}

if !defined(File["${title}.list"])
$aptrepo_title = pick($settings[repo_filename],$title)
if !defined(File["${aptrepo_title}.list"])
and !empty($settings[key])
and !empty($settings[key_url])
and !empty($settings[repo_url]) {
$aptrepo_title = pick($settings[repo_filename],$title)
file { "${aptrepo_title}.list":
ensure => $ensure,
path => "/etc/apt/sources.list.d/${title}.list",
Expand All @@ -187,19 +187,20 @@
command => "wget -O - ${settings[key_url]} | apt-key add -",
unless => "apt-key list | grep -q ${settings[key]}",
path => '/bin:/sbin:/usr/bin:/usr/sbin',
before => File["${title}.list"],
before => File["${aptrepo_title}.list"],
user => 'root',
}
}

if !defined(Exec["tp_aptkey_adv_${settings[key]}"])
and !empty($settings[key])
and !empty($settings[apt_key_server]) {
and !empty($settings[apt_key_server])
and !empty($settings[apt_key_fingerprint]) {
exec { "tp_aptkey_adv_${settings[key]}":
command => "apt-key adv --keyserver ${settings[apt_key_server]} --recv ${settings[apt_key_fingerprint]}",
unless => "apt-key list | grep -q ${settings[key]}",
path => '/bin:/sbin:/usr/bin:/usr/sbin',
before => File["${title}.list"],
before => File["${aptrepo_title}.list"],
user => 'root',
}
}
Expand Down
2 changes: 2 additions & 0 deletions types/settings.pp
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@
Optional[config_file_owner] => String,
Optional[config_file_group] => String,
Optional[config_file_mode] => String,
Optional[config_file_params] => Hash,

Optional[config_dir_path] => Stdlib::Absolutepath,
Optional[config_dir_owner] => String,
Optional[config_dir_group] => String,
Optional[config_dir_mode] => String,
Optional[config_dir_recurse] => Boolean,
Optional[config_dir_params] => Hash,

Optional[log_file_path] => Stdlib::Absolutepath,
Optional[pid_file_path] => Stdlib::Absolutepath,
Expand Down

0 comments on commit 1b82a47

Please sign in to comment.