Merge pull request #479 from mhaskel/update_anchors
authorDaniele Sluijters <daenney@users.noreply.github.com>
Wed, 25 Mar 2015 07:30:11 +0000 (08:30 +0100)
committerDaniele Sluijters <daenney@users.noreply.github.com>
Wed, 25 Mar 2015 07:30:11 +0000 (08:30 +0100)
(MODULES-1156, MODULES-769) Update anchors

manifests/init.pp
manifests/ppa.pp
manifests/setting.pp
spec/defines/ppa_spec.rb
spec/defines/setting_spec.rb

index 453df3171f3e0191cf4ff9018229a6297f85582e..140e171c50b008cb8f57d8596cfe77ca8f958476 100644 (file)
@@ -133,10 +133,7 @@ class apt(
     notify  => Exec['apt_update'],
   }
 
-  # Need anchor to provide containment for dependencies.
-  anchor { 'apt::update':
-    require => Class['apt::update'],
-  }
+  contain 'apt::update'
 
   # manage sources if present
   if $sources {
index 5fc7f3c50384d911585e0345e8c5060ba4377ba5..5d4c8903d5c6d9968c64e255f63cc61466554326 100644 (file)
@@ -60,9 +60,4 @@ define apt::ppa(
       notify => Exec['apt_update'],
     }
   }
-
-  # Need anchor to provide containment for dependencies.
-  anchor { "apt::ppa::${name}":
-    require => Class['apt::update'],
-  }
 }
index bc0e15a8d52099d969c52257afb19aae2f819781..ab844602326bc166d1cc6bf934db19905cbea098 100644 (file)
@@ -60,10 +60,4 @@ define apt::setting (
     source  => $source,
     notify  => $_notify,
   }
-
-  if $notify_update {
-    anchor { "apt::setting::${name}":
-      require => Class['apt::update']
-    }
-  }
 }
index 7c0d072c08e84d38fccf49f6d90c0c287f921e5b..30a09a48a09642007d28679a784749cb24cd8739 100644 (file)
@@ -27,10 +27,18 @@ describe 'apt::ppa' do
     }
   end
 
-  describe 'apt included, no proxy' do
+  describe 'ppa depending on ppa, MODULES-1156' do
     let :pre_condition do
       'class { "apt": }'
     end
+  end
+
+  describe 'apt included, no proxy' do
+    let :pre_condition do
+      'class { "apt": }
+      apt::ppa { "ppa:foo2": }
+      '
+    end
     let :facts do
       {
         :lsbdistrelease  => '14.04',
@@ -42,11 +50,13 @@ describe 'apt::ppa' do
     end
     let :params do
       {
-        :options => '',
+        :options        => '',
         :package_manage => true,
+        :require        => 'Apt::Ppa[ppa:foo2]',
       }
     end
     let(:title) { 'ppa:foo' }
+    it { is_expected.to compile.with_all_deps }
     it { is_expected.to contain_package('software-properties-common') }
     it { is_expected.to contain_exec('add-apt-repository-ppa:foo').that_notifies('Exec[apt_update]').with({
       :environment => [],
index d69ae45a7e7e2bb6ae9e8ea0abd9f1c2adeb7b6f..6f09f9ccf084447a62838f3544eefcc4e265f587 100644 (file)
@@ -55,6 +55,21 @@ describe 'apt::setting' do
     end
   end
 
+  describe 'settings requiring settings, MODULES-769' do
+    let(:pre_condition) do
+      'class { "apt": }
+      apt::setting { "list-teddybear": content => "foo" }
+      '
+    end
+    let(:facts) { { :lsbdistid => 'Debian', :osfamily => 'Debian', :lsbdistcodename => 'wheezy' } }
+    let(:title) { 'conf-teddybear' }
+    let(:default_params) { { :content => 'di' } }
+
+    let(:params) { default_params.merge({ :require => 'Apt::Setting[list-teddybear]' }) }
+
+    it { is_expected.to compile.with_all_deps }
+  end
+
   describe 'when trying to pull one over' do
     context 'with source and content' do
       let(:params) { default_params.merge({ :source => 'la' }) }