Stop redeclaring variables from params

It really seems unnecessary.
This commit is contained in:
Morgan Haskel 2015-02-20 11:15:23 -08:00
parent e75e603d33
commit 7c5a62f13e
4 changed files with 8 additions and 14 deletions

View file

@ -16,8 +16,6 @@ define apt::pin(
$originator = '', # o= $originator = '', # o=
$label = '' # l= $label = '' # l=
) { ) {
$preferences_d = $apt::params::preferences_d
if $order != '' and !is_integer($order) { if $order != '' and !is_integer($order) {
fail('Only integers are allowed in the apt::pin order param') fail('Only integers are allowed in the apt::pin order param')
} }
@ -65,8 +63,8 @@ define apt::pin(
$file_name = regsubst($title, '[^0-9a-z\-_\.]', '_', 'IG') $file_name = regsubst($title, '[^0-9a-z\-_\.]', '_', 'IG')
$path = $order ? { $path = $order ? {
'' => "${preferences_d}/${file_name}.pref", '' => "${::apt::preferences_d}/${file_name}.pref",
default => "${preferences_d}/${order}-${file_name}.pref", default => "${::apt::preferences_d}/${order}-${file_name}.pref",
} }
file { "${file_name}.pref": file { "${file_name}.pref":
ensure => $ensure, ensure => $ensure,

View file

@ -2,9 +2,8 @@
define apt::ppa( define apt::ppa(
$ensure = 'present', $ensure = 'present',
$release = $::lsbdistcodename, $release = $::lsbdistcodename,
$options = $apt::params::ppa_options, $options = $::apt::ppa_options,
) { ) {
$sources_list_d = $apt::params::sources_list_d
if ! $release { if ! $release {
fail('lsbdistcodename fact not available: release parameter required') fail('lsbdistcodename fact not available: release parameter required')
@ -46,7 +45,7 @@ define apt::ppa(
exec { "add-apt-repository-${name}": exec { "add-apt-repository-${name}":
environment => $proxy_env, environment => $proxy_env,
command => "/usr/bin/add-apt-repository ${options} ${name}", command => "/usr/bin/add-apt-repository ${options} ${name}",
unless => "/usr/bin/test -s ${sources_list_d}/${sources_list_d_filename}", unless => "/usr/bin/test -s ${::apt::sources_list_d}/${sources_list_d_filename}",
user => 'root', user => 'root',
logoutput => 'on_failure', logoutput => 'on_failure',
notify => Exec['apt_update'], notify => Exec['apt_update'],
@ -56,14 +55,14 @@ define apt::ppa(
], ],
} }
file { "${sources_list_d}/${sources_list_d_filename}": file { "${::apt::sources_list_d}/${sources_list_d_filename}":
ensure => file, ensure => file,
require => Exec["add-apt-repository-${name}"], require => Exec["add-apt-repository-${name}"],
} }
} }
else { else {
file { "${sources_list_d}/${sources_list_d_filename}": file { "${::apt::sources_list_d}/${sources_list_d_filename}":
ensure => 'absent', ensure => 'absent',
notify => Exec['apt_update'], notify => Exec['apt_update'],
} }

View file

@ -20,9 +20,6 @@ define apt::source(
validate_string($architecture) validate_string($architecture)
validate_bool($trusted_source) validate_bool($trusted_source)
$sources_list_d = $apt::params::sources_list_d
$provider = $apt::params::provider
if $release == 'UNDEF' { if $release == 'UNDEF' {
if $::lsbdistcodename == undef { if $::lsbdistcodename == undef {
fail('lsbdistcodename fact not available: release parameter required') fail('lsbdistcodename fact not available: release parameter required')
@ -35,7 +32,7 @@ define apt::source(
file { "${name}.list": file { "${name}.list":
ensure => $ensure, ensure => $ensure,
path => "${sources_list_d}/${name}.list", path => "${::apt::sources_list_d}/${name}.list",
owner => root, owner => root,
group => root, group => root,
mode => '0644', mode => '0644',

View file

@ -57,7 +57,7 @@ class apt::update {
$_refresh = true $_refresh = true
} }
exec { 'apt_update': exec { 'apt_update':
command => "${apt::params::provider} update", command => "${::apt::provider} update",
logoutput => 'on_failure', logoutput => 'on_failure',
refreshonly => $_refresh, refreshonly => $_refresh,
timeout => $apt::update_timeout, timeout => $apt::update_timeout,