From 82967a22fa2493773715f7da6e6cd9fa5df7f592 Mon Sep 17 00:00:00 2001 From: Nan Liu Date: Thu, 3 May 2012 10:22:49 -0700 Subject: [PATCH] (#11966) Update apt::ppa to use apt::update. Change apt::ppa define type to also use the apt::update class to invoke apt-get update once. --- manifests/builddep.pp | 2 +- manifests/ppa.pp | 7 ++----- spec/defines/ppa_spec.rb | 4 ++-- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/manifests/builddep.pp b/manifests/builddep.pp index 7a9dd33..35d8d30 100644 --- a/manifests/builddep.pp +++ b/manifests/builddep.pp @@ -7,6 +7,6 @@ define apt::builddep() { exec { "apt-builddep-${name}": command => "/usr/bin/apt-get -y --force-yes build-dep ${name}", - notify => Exec["apt update"], + notify => Exec['apt update'], } } diff --git a/manifests/ppa.pp b/manifests/ppa.pp index d27aca4..ca7f620 100644 --- a/manifests/ppa.pp +++ b/manifests/ppa.pp @@ -7,6 +7,7 @@ define apt::ppa( Class['apt'] -> Apt::Ppa[$title] include apt::params + include apt::update $sources_list_d = $apt::params::sources_list_d @@ -14,10 +15,6 @@ define apt::ppa( fail('lsbdistcodename fact not available: release parameter required') } - exec { "apt-update-${name}": - command => "${apt::params::provider} update", - refreshonly => true, - } $filename_without_slashes = regsubst($name,'/','-','G') $filename_without_ppa = regsubst($filename_without_slashes, '^ppa:','','G') @@ -25,8 +22,8 @@ define apt::ppa( exec { "add-apt-repository-${name}": command => "/usr/bin/add-apt-repository ${name}", - notify => Exec["apt-update-${name}"], creates => "${sources_list_d}/${sources_list_d_filename}", + notify => Exec['apt update'], } file { "${sources_list_d}/${sources_list_d_filename}": diff --git a/spec/defines/ppa_spec.rb b/spec/defines/ppa_spec.rb index 9583016..e353489 100644 --- a/spec/defines/ppa_spec.rb +++ b/spec/defines/ppa_spec.rb @@ -18,7 +18,7 @@ describe 'apt::ppa', :type => :define do t.sub(/^ppa:/,'').gsub('/','-') << "-" << "#{release}.list" end - it { should contain_exec("apt-update-#{t}").with( + it { should contain_exec("apt update").with( 'command' => '/usr/bin/apt-get update', 'refreshonly' => true ) @@ -26,7 +26,7 @@ describe 'apt::ppa', :type => :define do it { should contain_exec("add-apt-repository-#{t}").with( 'command' => "/usr/bin/add-apt-repository #{t}", - 'notify' => "Exec[apt-update-#{t}]", + 'notify' => "Exec[apt update]", 'creates' => "/etc/apt/sources.list.d/#{filename}" ) }