]> review.fuel-infra Code Review - puppet-modules/puppetlabs-apt.git/commitdiff
Merge pull request #56 from branan/travisci
authorDan Bode <bodepd@gmail.com>
Tue, 22 May 2012 16:21:52 +0000 (09:21 -0700)
committerDan Bode <bodepd@gmail.com>
Tue, 22 May 2012 16:21:52 +0000 (09:21 -0700)
Add files for travis CI

manifests/builddep.pp
manifests/key.pp
manifests/ppa.pp
spec/defines/builddep_spec.rb
spec/defines/ppa_spec.rb

index ce9d8fd6302ac02b4ba75e82539cc3fdfc71d101..997a2064f85e8c372c387c0c50255c4caffd27ba 100644 (file)
@@ -3,8 +3,6 @@
 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'],
index e87968d7fbb504f3f6e8ca8a2e38b2e344ca8566..037eec5288f789937ca492382064715df982034e 100644 (file)
@@ -29,14 +29,14 @@ define apt::key (
   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]) {
index 7800d3d388fd9efb714aa98e59df02fae1fb6e8a..64c65bbd09e41d595b902135d6fd5222138fb114 100644 (file)
@@ -3,9 +3,6 @@
 define apt::ppa(
   $release = $::lsbdistcodename
 ) {
-
-  Class['apt'] -> Apt::Ppa[$title]
-
   include apt::params
   include apt::update
 
@@ -15,10 +12,9 @@ define apt::ppa(
     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': }
@@ -27,13 +23,14 @@ define apt::ppa(
   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.
index 940c60c97b99ac6e5400e5f7bbe36c5760079910..4e2b698d93883b21043a0c18f9aed6e9ec9d598b 100644 (file)
@@ -3,22 +3,15 @@ describe 'apt::builddep', :type => :define do
 
   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
 
index ab86b93b2e35d0b145f1e601cebd139e7e066a9c..d57c1fb854b98d328a2daa87a3dd96a0a670e6b5 100644 (file)
@@ -29,7 +29,7 @@ describe 'apt::ppa', :type => :define do
       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]"
         )
       }