MODULES-2190 - Fix anchor issues
authorMorgan Haskel <morgan@puppetlabs.com>
Fri, 17 Jul 2015 23:19:33 +0000 (16:19 -0700)
committerMorgan Haskel <morgan@puppetlabs.com>
Tue, 21 Jul 2015 17:19:15 +0000 (10:19 -0700)
manifests/init.pp
manifests/ppa.pp
manifests/setting.pp
manifests/source.pp
spec/classes/apt_spec.rb
spec/defines/ppa_spec.rb
spec/defines/setting_spec.rb
spec/defines/source_spec.rb

index 48c4f53050e8c8baaac5e3a86c307fbc0a38dc36..578d73356e5655d8f5374da85dda369da33b8600 100644 (file)
@@ -26,7 +26,7 @@ class apt(
   }
 
   $_update = merge($::apt::update_defaults, $update)
   }
 
   $_update = merge($::apt::update_defaults, $update)
-  include apt::update
+  include ::apt::update
 
   validate_hash($purge)
   if $purge['sources.list'] {
 
   validate_hash($purge)
   if $purge['sources.list'] {
@@ -99,7 +99,7 @@ class apt(
     group   => root,
     mode    => '0644',
     content => $sources_list_content,
     group   => root,
     mode    => '0644',
     content => $sources_list_content,
-    notify  => Exec['apt_update'],
+    notify  => Class['apt::update'],
   }
 
   file { 'sources.list.d':
   }
 
   file { 'sources.list.d':
@@ -110,7 +110,7 @@ class apt(
     mode    => '0644',
     purge   => $_purge['sources.list.d'],
     recurse => $_purge['sources.list.d'],
     mode    => '0644',
     purge   => $_purge['sources.list.d'],
     recurse => $_purge['sources.list.d'],
-    notify  => Exec['apt_update'],
+    notify  => Class['apt::update'],
   }
 
   file { 'preferences':
   }
 
   file { 'preferences':
@@ -119,7 +119,7 @@ class apt(
     owner  => root,
     group  => root,
     mode   => '0644',
     owner  => root,
     group  => root,
     mode   => '0644',
-    notify => Exec['apt_update'],
+    notify => Class['apt::update'],
   }
 
   file { 'preferences.d':
   }
 
   file { 'preferences.d':
@@ -130,11 +130,9 @@ class apt(
     mode    => '0644',
     purge   => $_purge['preferences.d'],
     recurse => $_purge['preferences.d'],
     mode    => '0644',
     purge   => $_purge['preferences.d'],
     recurse => $_purge['preferences.d'],
-    notify  => Exec['apt_update'],
+    notify  => Class['apt::update'],
   }
 
   }
 
-  anchor { 'apt_first': } -> Class['apt::update'] -> anchor { 'apt_last': }
-
   # manage sources if present
   if $sources {
     create_resources('apt::source', $sources)
   # manage sources if present
   if $sources {
     create_resources('apt::source', $sources)
index f3e2bfda040c82f3890fce47947949590c04c338..6352352c8d54711baeffecb0871c0dfa17bfc4eb 100644 (file)
@@ -45,7 +45,7 @@ define apt::ppa(
       unless      => "/usr/bin/test -s ${::apt::sources_list_d}/${sources_list_d_filename}",
       user        => 'root',
       logoutput   => 'on_failure',
       unless      => "/usr/bin/test -s ${::apt::sources_list_d}/${sources_list_d_filename}",
       user        => 'root',
       logoutput   => 'on_failure',
-      notify      => Exec['apt_update'],
+      notify      => Class['apt::update'],
       require     => $_require,
     }
 
       require     => $_require,
     }
 
@@ -57,7 +57,7 @@ define apt::ppa(
   else {
     file { "${::apt::sources_list_d}/${sources_list_d_filename}":
       ensure => 'absent',
   else {
     file { "${::apt::sources_list_d}/${sources_list_d_filename}":
       ensure => 'absent',
-      notify => Exec['apt_update'],
+      notify => Class['apt::update'],
     }
   }
 }
     }
   }
 }
index 59d0dd4dfe0b0eec2891c483f51526249b84f24e..d723eb2c53103b0db61f7a3bf3155620d90ace90 100644 (file)
@@ -47,7 +47,7 @@ define apt::setting (
   $_ext  = $::apt::params::config_files[$setting_type]['ext']
 
   if $notify_update {
   $_ext  = $::apt::params::config_files[$setting_type]['ext']
 
   if $notify_update {
-    $_notify = Exec['apt_update']
+    $_notify = Class['apt::update']
   } else {
     $_notify = undef
   }
   } else {
     $_notify = undef
   }
index 734f375f21fa88135b24a3a7ba10ecd55f20f756..1307a3a552be523dfd02f988066eccf47ced7b2a 100644 (file)
@@ -23,7 +23,8 @@ define apt::source(
   validate_bool($allow_unsigned)
   validate_hash($include)
 
   validate_bool($allow_unsigned)
   validate_hash($include)
 
-  include 'apt::params'
+  # This is needed for compat with 1.8.x
+  include ::apt
 
   $_before = Apt::Setting["list-${title}"]
 
 
   $_before = Apt::Setting["list-${title}"]
 
index 1c8cac7a03c27fd5ee43a9b7e70a816420809d38..5a71fb581a6a7d612a7d9ece3b73af118f5ad480 100644 (file)
@@ -3,16 +3,16 @@ describe 'apt' do
   let(:facts) { { :lsbdistid => 'Debian', :osfamily => 'Debian', :lsbdistcodename => 'wheezy', :puppetversion   => Puppet.version} }
 
   context 'defaults' do
   let(:facts) { { :lsbdistid => 'Debian', :osfamily => 'Debian', :lsbdistcodename => 'wheezy', :puppetversion   => Puppet.version} }
 
   context 'defaults' do
-    it { is_expected.to contain_file('sources.list').that_notifies('Exec[apt_update]').only_with({
+    it { is_expected.to contain_file('sources.list').that_notifies('Class[Apt::Update]').only_with({
       :ensure  => 'file',
       :path    => '/etc/apt/sources.list',
       :owner   => 'root',
       :group   => 'root',
       :mode    => '0644',
       :ensure  => 'file',
       :path    => '/etc/apt/sources.list',
       :owner   => 'root',
       :group   => 'root',
       :mode    => '0644',
-      :notify  => 'Exec[apt_update]',
+      :notify  => 'Class[Apt::Update]',
     })}
 
     })}
 
-    it { is_expected.to contain_file('sources.list.d').that_notifies('Exec[apt_update]').only_with({
+    it { is_expected.to contain_file('sources.list.d').that_notifies('Class[Apt::Update]').only_with({
       :ensure  => 'directory',
       :path    => '/etc/apt/sources.list.d',
       :owner   => 'root',
       :ensure  => 'directory',
       :path    => '/etc/apt/sources.list.d',
       :owner   => 'root',
@@ -20,19 +20,19 @@ describe 'apt' do
       :mode    => '0644',
       :purge   => false,
       :recurse => false,
       :mode    => '0644',
       :purge   => false,
       :recurse => false,
-      :notify  => 'Exec[apt_update]',
+      :notify  => 'Class[Apt::Update]',
     })}
 
     })}
 
-    it { is_expected.to contain_file('preferences').that_notifies('Exec[apt_update]').only_with({
+    it { is_expected.to contain_file('preferences').that_notifies('Class[Apt::Update]').only_with({
       :ensure  => 'file',
       :path    => '/etc/apt/preferences',
       :owner   => 'root',
       :group   => 'root',
       :mode    => '0644',
       :ensure  => 'file',
       :path    => '/etc/apt/preferences',
       :owner   => 'root',
       :group   => 'root',
       :mode    => '0644',
-      :notify  => 'Exec[apt_update]',
+      :notify  => 'Class[Apt::Update]',
     })}
 
     })}
 
-    it { is_expected.to contain_file('preferences.d').that_notifies('Exec[apt_update]').only_with({
+    it { is_expected.to contain_file('preferences.d').that_notifies('Class[Apt::Update]').only_with({
       :ensure  => 'directory',
       :path    => '/etc/apt/preferences.d',
       :owner   => 'root',
       :ensure  => 'directory',
       :path    => '/etc/apt/preferences.d',
       :owner   => 'root',
@@ -40,7 +40,7 @@ describe 'apt' do
       :mode    => '0644',
       :purge   => false,
       :recurse => false,
       :mode    => '0644',
       :purge   => false,
       :recurse => false,
-      :notify  => 'Exec[apt_update]',
+      :notify  => 'Class[Apt::Update]',
     })}
 
     it 'should lay down /etc/apt/apt.conf.d/15update-stamp' do
     })}
 
     it 'should lay down /etc/apt/apt.conf.d/15update-stamp' do
index c110e50f43dfc5c4a54e725b702a7cc7dfad250a..b7a2f6c0046cba98a205f2b6dd5ba004e8986cc1 100644 (file)
@@ -18,7 +18,7 @@ describe 'apt::ppa' do
 
     let(:title) { 'ppa:needs/such.substitution/wow' }
     it { is_expected.to_not contain_package('python-software-properties') }
 
     let(:title) { 'ppa:needs/such.substitution/wow' }
     it { is_expected.to_not contain_package('python-software-properties') }
-    it { is_expected.to contain_exec('add-apt-repository-ppa:needs/such.substitution/wow').that_notifies('Exec[apt_update]').with({
+    it { is_expected.to contain_exec('add-apt-repository-ppa:needs/such.substitution/wow').that_notifies('Class[Apt::Update]').with({
       :environment => [],
       :command     => '/usr/bin/add-apt-repository -y ppa:needs/such.substitution/wow',
       :unless      => '/usr/bin/test -s /etc/apt/sources.list.d/needs-such_substitution-wow-natty.list',
       :environment => [],
       :command     => '/usr/bin/add-apt-repository -y ppa:needs/such.substitution/wow',
       :unless      => '/usr/bin/test -s /etc/apt/sources.list.d/needs-such_substitution-wow-natty.list',
@@ -57,7 +57,7 @@ describe 'apt::ppa' do
 
     let(:title) { 'ppa:needs/such.substitution/wow' }
     it { is_expected.to contain_package('software-properties-common') }
 
     let(:title) { 'ppa:needs/such.substitution/wow' }
     it { is_expected.to contain_package('software-properties-common') }
-    it { is_expected.to contain_exec('add-apt-repository-ppa:needs/such.substitution/wow').that_notifies('Exec[apt_update]').with({
+    it { is_expected.to contain_exec('add-apt-repository-ppa:needs/such.substitution/wow').that_notifies('Class[Apt::Update]').with({
       'environment' => [],
       'command'     => '/usr/bin/add-apt-repository -y ppa:needs/such.substitution/wow',
       'unless'      => '/usr/bin/test -s /etc/apt/sources.list.d/needs-such_substitution-wow-natty.list',
       'environment' => [],
       'command'     => '/usr/bin/add-apt-repository -y ppa:needs/such.substitution/wow',
       'unless'      => '/usr/bin/test -s /etc/apt/sources.list.d/needs-such_substitution-wow-natty.list',
@@ -94,7 +94,7 @@ describe 'apt::ppa' do
 
     let(:title) { 'ppa:needs/such.substitution/wow' }
     it { is_expected.to_not contain_package('python-software-properties') }
 
     let(:title) { 'ppa:needs/such.substitution/wow' }
     it { is_expected.to_not contain_package('python-software-properties') }
-    it { is_expected.to contain_exec('add-apt-repository-ppa:needs/such.substitution/wow').that_notifies('Exec[apt_update]').with({
+    it { is_expected.to contain_exec('add-apt-repository-ppa:needs/such.substitution/wow').that_notifies('Class[Apt::Update]').with({
       'environment' => [],
       'command'     => '/usr/bin/add-apt-repository -y ppa:needs/such.substitution/wow',
       'unless'      => '/usr/bin/test -s /etc/apt/sources.list.d/needs-such_substitution-wow-natty.list',
       'environment' => [],
       'command'     => '/usr/bin/add-apt-repository -y ppa:needs/such.substitution/wow',
       'unless'      => '/usr/bin/test -s /etc/apt/sources.list.d/needs-such_substitution-wow-natty.list',
@@ -135,7 +135,7 @@ describe 'apt::ppa' do
     let(:title) { 'ppa:foo' }
     it { is_expected.to compile.with_all_deps }
     it { is_expected.to contain_package('software-properties-common') }
     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({
+    it { is_expected.to contain_exec('add-apt-repository-ppa:foo').that_notifies('Class[Apt::Update]').with({
       :environment => [],
       :command     => '/usr/bin/add-apt-repository  ppa:foo',
       :unless      => '/usr/bin/test -s /etc/apt/sources.list.d/foo-trusty.list',
       :environment => [],
       :command     => '/usr/bin/add-apt-repository  ppa:foo',
       :unless      => '/usr/bin/test -s /etc/apt/sources.list.d/foo-trusty.list',
@@ -169,7 +169,7 @@ describe 'apt::ppa' do
     end
     let(:title) { 'ppa:foo' }
     it { is_expected.to contain_package('software-properties-common') }
     end
     let(:title) { 'ppa:foo' }
     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({
+    it { is_expected.to contain_exec('add-apt-repository-ppa:foo').that_notifies('Class[Apt::Update]').with({
       :environment => ['http_proxy=http://localhost:8080'],
       :command     => '/usr/bin/add-apt-repository  ppa:foo',
       :unless      => '/usr/bin/test -s /etc/apt/sources.list.d/foo-trusty.list',
       :environment => ['http_proxy=http://localhost:8080'],
       :command     => '/usr/bin/add-apt-repository  ppa:foo',
       :unless      => '/usr/bin/test -s /etc/apt/sources.list.d/foo-trusty.list',
@@ -203,7 +203,7 @@ describe 'apt::ppa' do
     end
     let(:title) { 'ppa:foo' }
     it { is_expected.to contain_package('software-properties-common') }
     end
     let(:title) { 'ppa:foo' }
     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({
+    it { is_expected.to contain_exec('add-apt-repository-ppa:foo').that_notifies('Class[Apt::Update]').with({
       :environment => ['http_proxy=http://localhost:8180'],
       :command     => '/usr/bin/add-apt-repository  ppa:foo',
       :unless      => '/usr/bin/test -s /etc/apt/sources.list.d/foo-trusty.list',
       :environment => ['http_proxy=http://localhost:8180'],
       :command     => '/usr/bin/add-apt-repository  ppa:foo',
       :unless      => '/usr/bin/test -s /etc/apt/sources.list.d/foo-trusty.list',
@@ -237,7 +237,7 @@ describe 'apt::ppa' do
     end
     let(:title) { 'ppa:foo' }
     it { is_expected.to contain_package('software-properties-common') }
     end
     let(:title) { 'ppa:foo' }
     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({
+    it { is_expected.to contain_exec('add-apt-repository-ppa:foo').that_notifies('Class[Apt::Update]').with({
       :environment => ['http_proxy=http://localhost:8180', 'https_proxy=https://localhost:8180'],
       :command     => '/usr/bin/add-apt-repository  ppa:foo',
       :unless      => '/usr/bin/test -s /etc/apt/sources.list.d/foo-trusty.list',
       :environment => ['http_proxy=http://localhost:8180', 'https_proxy=https://localhost:8180'],
       :command     => '/usr/bin/add-apt-repository  ppa:foo',
       :unless      => '/usr/bin/test -s /etc/apt/sources.list.d/foo-trusty.list',
@@ -267,7 +267,7 @@ describe 'apt::ppa' do
         :ensure => 'absent'
       }
     end
         :ensure => 'absent'
       }
     end
-    it { is_expected.to contain_file('/etc/apt/sources.list.d/foo-trusty.list').that_notifies('Exec[apt_update]').with({
+    it { is_expected.to contain_file('/etc/apt/sources.list.d/foo-trusty.list').that_notifies('Class[Apt::Update]').with({
       :ensure => 'absent',
     })
     }
       :ensure => 'absent',
     })
     }
index b109ea6b6b499834f0ac0a6ae7472f6f55136c2a..07d94ef4802e8b38bc8debe3371986c9f910794f 100644 (file)
@@ -16,25 +16,25 @@ describe 'apt::setting' do
 
     context 'with title=conf-teddybear ' do
       let(:params) { default_params }
 
     context 'with title=conf-teddybear ' do
       let(:params) { default_params }
-      it { is_expected.to contain_file('/etc/apt/apt.conf.d/50teddybear').that_notifies('Exec[apt_update]') }
+      it { is_expected.to contain_file('/etc/apt/apt.conf.d/50teddybear').that_notifies('Class[Apt::Update]') }
     end
 
     context 'with title=pref-teddybear' do
       let(:title) { 'pref-teddybear' }
       let(:params) { default_params }
     end
 
     context 'with title=pref-teddybear' do
       let(:title) { 'pref-teddybear' }
       let(:params) { default_params }
-      it { is_expected.to contain_file('/etc/apt/preferences.d/50teddybear').that_notifies('Exec[apt_update]') }
+      it { is_expected.to contain_file('/etc/apt/preferences.d/50teddybear').that_notifies('Class[Apt::Update]') }
     end
 
     context 'with title=list-teddybear' do
       let(:title) { 'list-teddybear' }
       let(:params) { default_params }
     end
 
     context 'with title=list-teddybear' do
       let(:title) { 'list-teddybear' }
       let(:params) { default_params }
-      it { is_expected.to contain_file('/etc/apt/sources.list.d/teddybear.list').that_notifies('Exec[apt_update]') }
+      it { is_expected.to contain_file('/etc/apt/sources.list.d/teddybear.list').that_notifies('Class[Apt::Update]') }
     end
 
     context 'with source' do
       let(:params) { { :source => 'puppet:///la/die/dah' } }
       it {
     end
 
     context 'with source' do
       let(:params) { { :source => 'puppet:///la/die/dah' } }
       it {
-        is_expected.to contain_file('/etc/apt/apt.conf.d/50teddybear').that_notifies('Exec[apt_update]').with({
+        is_expected.to contain_file('/etc/apt/apt.conf.d/50teddybear').that_notifies('Class[Apt::Update]').with({
         :ensure => 'file',
         :owner  => 'root',
         :group  => 'root',
         :ensure => 'file',
         :owner  => 'root',
         :group  => 'root',
@@ -45,7 +45,7 @@ describe 'apt::setting' do
 
     context 'with content' do
       let(:params) { default_params }
 
     context 'with content' do
       let(:params) { default_params }
-      it { is_expected.to contain_file('/etc/apt/apt.conf.d/50teddybear').that_notifies('Exec[apt_update]').with({
+      it { is_expected.to contain_file('/etc/apt/apt.conf.d/50teddybear').that_notifies('Class[Apt::Update]').with({
         :ensure  => 'file',
         :owner   => 'root',
         :group   => 'root',
         :ensure  => 'file',
         :owner   => 'root',
         :group   => 'root',
@@ -103,12 +103,12 @@ describe 'apt::setting' do
 
   describe 'with priority=100' do
     let(:params) { default_params.merge({ :priority => 100 }) }
 
   describe 'with priority=100' do
     let(:params) { default_params.merge({ :priority => 100 }) }
-    it { is_expected.to contain_file('/etc/apt/apt.conf.d/100teddybear').that_notifies('Exec[apt_update]') }
+    it { is_expected.to contain_file('/etc/apt/apt.conf.d/100teddybear').that_notifies('Class[Apt::Update]') }
   end
 
   describe 'with ensure=absent' do
     let(:params) { default_params.merge({ :ensure => 'absent' }) }
   end
 
   describe 'with ensure=absent' do
     let(:params) { default_params.merge({ :ensure => 'absent' }) }
-    it { is_expected.to contain_file('/etc/apt/apt.conf.d/50teddybear').that_notifies('Exec[apt_update]').with({
+    it { is_expected.to contain_file('/etc/apt/apt.conf.d/50teddybear').that_notifies('Class[Apt::Update]').with({
       :ensure => 'absent',
     })}
   end
       :ensure => 'absent',
     })}
   end
index c9863dd96f12216601ffdf7308a07305802ac76d..8a2cfcc7475698bb477061131c885475eb15ea28 100644 (file)
@@ -70,6 +70,8 @@ describe 'apt::source' do
       }).with_content(/hello.there wheezy main\n/)
       }
 
       }).with_content(/hello.there wheezy main\n/)
       }
 
+      it { is_expected.to contain_file('/etc/apt/sources.list.d/my_source.list').that_notifies('Class[Apt::Update]')}
+
       it { is_expected.to contain_apt__pin('my_source').that_comes_before('Apt::Setting[list-my_source]').with({
         :ensure       => 'present',
         :priority     => 1001,
       it { is_expected.to contain_apt__pin('my_source').that_comes_before('Apt::Setting[list-my_source]').with({
         :ensure       => 'present',
         :priority     => 1001,