]> review.fuel-infra Code Review - puppet-modules/puppetlabs-apt.git/commitdiff
Merge pull request #442 from mhaskel/add_base_name
authorDaniele Sluijters <daenney@users.noreply.github.com>
Wed, 25 Feb 2015 17:22:37 +0000 (18:22 +0100)
committerDaniele Sluijters <daenney@users.noreply.github.com>
Wed, 25 Feb 2015 17:22:37 +0000 (18:22 +0100)
Add base_name parameter to apt::setting

1  2 
manifests/setting.pp
spec/defines/setting_spec.rb

index 7740fd6e24c7b5deb3220bfae1242f0f4718485e,8e46ed966d42e7d1683c1c150aa39b9cf2ccfee4..78f007fdbc6ff9815c5287fc67dab8c2b1501ec6
@@@ -19,10 -20,10 +20,11 @@@ define apt::setting 
  
    validate_re($setting_type, ['conf', 'pref', 'list'])
    validate_re($ensure,  ['file', 'present', 'absent'])
+   validate_string($base_name)
  
    unless is_integer($priority) {
 -    fail('apt::setting priority must be an integer')
 +    # need this to allow zero-padded priority.
 +    validate_re($priority, '^\d+$', 'apt::setting priority must be an integer or a zero-padded integer.')
    }
  
    if $source {
index 0abcead5d4a36b75b6bd45bb9afef69bcea6e82c,a597cb86632e41b4890c1f2e168bf2f79e491046..7b7c54efc452c4744072c901bbdbb722260532ac
@@@ -92,12 -92,24 +92,24 @@@ describe 'apt::setting' d
  
    describe 'with priority=100' do
      let(:params) { default_params.merge({ :priority => 100 }) }
 -    it { should contain_file('/etc/apt/apt.conf.d/100teddybear') }
 +    it { is_expected.to contain_file('/etc/apt/apt.conf.d/100teddybear') }
    end
  
+   describe 'with base_name=puppy' do
+     let(:params) { default_params.merge({ :base_name => 'puppy' }) }
+     it { should contain_file('/etc/apt/apt.conf.d/50puppy') }
+   end
+   describe 'with base_name=true' do
+     let(:params) { default_params.merge({ :base_name => true }) }
+       it do
+         expect { should compile }.to raise_error(Puppet::Error, /not a string/)
+       end
+   end
    describe 'with ensure=absent' do
      let(:params) { default_params.merge({ :ensure => 'absent' }) }
 -    it { should contain_file('/etc/apt/apt.conf.d/50teddybear').with({
 +    it { is_expected.to contain_file('/etc/apt/apt.conf.d/50teddybear').with({
        :ensure => 'absent',
      })}
    end