define apt::builddep() {
include apt::update
- Class['apt'] -> Apt::Builddep[$name]
-
exec { "apt-builddep-${name}":
command => "/usr/bin/apt-get -y --force-yes build-dep ${name}",
notify => Exec['apt_update'],
case $ensure {
present: {
- anchor { "apt::key/${title}":; }
+ anchor { "apt::key/${title}": }
if defined(Exec["apt::key ${upkey} absent"]) {
fail("Cannot ensure Apt::Key[${upkey}] present; ${upkey} already ensured absent")
}
if !defined(Anchor["apt::key ${upkey} present"]) {
- anchor { "apt::key ${upkey} present":; }
+ anchor { "apt::key ${upkey} present": }
}
if !defined(Exec[$digest]) {
define apt::ppa(
$release = $::lsbdistcodename
) {
-
- Class['apt'] -> Apt::Ppa[$title]
-
include apt::params
include apt::update
fail('lsbdistcodename fact not available: release parameter required')
}
-
$filename_without_slashes = regsubst($name,'/','-','G')
- $filename_without_ppa = regsubst($filename_without_slashes, '^ppa:','','G')
- $sources_list_d_filename = "${filename_without_ppa}-${release}.list"
+ $filename_without_ppa = regsubst($filename_without_slashes, '^ppa:','','G')
+ $sources_list_d_filename = "${filename_without_ppa}-${release}.list"
if ! defined(Package['python-software-properties']) {
package { 'python-software-properties': }
exec { "add-apt-repository-${name}":
command => "/usr/bin/add-apt-repository ${name}",
creates => "${sources_list_d}/${sources_list_d_filename}",
- require => Package['python-software-properties'],
+ require => [ File[$sources_list_d],
+ Package['python-software-properties'] ],
notify => Exec['apt_update'],
}
file { "${sources_list_d}/${sources_list_d_filename}":
ensure => file,
- require => Exec["add-apt-repository-${name}"];
+ require => Exec["add-apt-repository-${name}"],
}
# Need anchor to provide containment for dependencies.
let(:title) { 'my_package' }
- describe "should succeed with a Class['apt']" do
- let(:pre_condition) { 'class {"apt": } ' }
-
+ describe "should require apt-get update" do
it { should contain_exec("apt_update").with({
'command' => "/usr/bin/apt-get update",
'refreshonly' => true
})
}
- end
-
- describe "should fail without Class['apt']" do
- it { expect {should contain_exec("apt-update-#{title}").with({
- 'command' => "/usr/bin/apt-get update",
- 'refreshonly' => true
- }).to raise_error(Puppet::Error)
- }
+ it { should contain_anchor("apt::builddep::my_package").with({
+ 'require' => 'Class[Apt::Update]',
+ })
}
end
it { should contain_exec("add-apt-repository-#{t}").with(
'command' => "/usr/bin/add-apt-repository #{t}",
'creates' => "/etc/apt/sources.list.d/#{filename}",
- 'require' => "Package[python-software-properties]",
+ 'require' => ["File[/etc/apt/sources.list.d]", "Package[python-software-properties]"],
'notify' => "Exec[apt_update]"
)
}