Skip to content

Commit

Permalink
Stop redeclaring variables from params
Browse files Browse the repository at this point in the history
It really seems unnecessary.
  • Loading branch information
Morgan Haskel committed Feb 21, 2015
1 parent e75e603 commit 7c5a62f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 14 deletions.
6 changes: 2 additions & 4 deletions manifests/pin.pp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
$originator = '', # o=
$label = '' # l=
) {
$preferences_d = $apt::params::preferences_d

if $order != '' and !is_integer($order) {
fail('Only integers are allowed in the apt::pin order param')
}
Expand Down Expand Up @@ -65,8 +63,8 @@
$file_name = regsubst($title, '[^0-9a-z\-_\.]', '_', 'IG')

$path = $order ? {
'' => "${preferences_d}/${file_name}.pref",
default => "${preferences_d}/${order}-${file_name}.pref",
'' => "${::apt::preferences_d}/${file_name}.pref",
default => "${::apt::preferences_d}/${order}-${file_name}.pref",
}
file { "${file_name}.pref":
ensure => $ensure,
Expand Down
9 changes: 4 additions & 5 deletions manifests/ppa.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
define apt::ppa(
$ensure = 'present',
$release = $::lsbdistcodename,
$options = $apt::params::ppa_options,
$options = $::apt::ppa_options,
) {
$sources_list_d = $apt::params::sources_list_d

if ! $release {
fail('lsbdistcodename fact not available: release parameter required')
Expand Down Expand Up @@ -46,7 +45,7 @@
exec { "add-apt-repository-${name}":
environment => $proxy_env,
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',
logoutput => 'on_failure',
notify => Exec['apt_update'],
Expand All @@ -56,14 +55,14 @@
],
}

file { "${sources_list_d}/${sources_list_d_filename}":
file { "${::apt::sources_list_d}/${sources_list_d_filename}":
ensure => file,
require => Exec["add-apt-repository-${name}"],
}
}
else {

file { "${sources_list_d}/${sources_list_d_filename}":
file { "${::apt::sources_list_d}/${sources_list_d_filename}":
ensure => 'absent',
notify => Exec['apt_update'],
}
Expand Down
5 changes: 1 addition & 4 deletions manifests/source.pp
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@
validate_string($architecture)
validate_bool($trusted_source)

$sources_list_d = $apt::params::sources_list_d
$provider = $apt::params::provider

if $release == 'UNDEF' {
if $::lsbdistcodename == undef {
fail('lsbdistcodename fact not available: release parameter required')
Expand All @@ -35,7 +32,7 @@

file { "${name}.list":
ensure => $ensure,
path => "${sources_list_d}/${name}.list",
path => "${::apt::sources_list_d}/${name}.list",
owner => root,
group => root,
mode => '0644',
Expand Down
2 changes: 1 addition & 1 deletion manifests/update.pp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
$_refresh = true
}
exec { 'apt_update':
command => "${apt::params::provider} update",
command => "${::apt::provider} update",
logoutput => 'on_failure',
refreshonly => $_refresh,
timeout => $apt::update_timeout,
Expand Down

0 comments on commit 7c5a62f

Please sign in to comment.