Unverified Commit e1fd8d5e authored by earsdown's avatar earsdown Committed by GitHub
Browse files

Fixes postmap when ensure=absent (#202)

Fixes an issue where if a postfix map $ensure is 'absent' the postmap exec resource causes puppet runs to fail.
parent f3a280ab
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -80,8 +80,13 @@ define postfix::map (
    }
  }

  $generate_cmd = $ensure ? {
    'absent'  => "rm ${path}.db",
    'present' => "postmap ${path}",
  }

  exec {"generate ${name}.db":
    command     => "postmap ${path}",
    command     => $generate_cmd,
    path        => $::path,
    #creates    => "${name}.db", # this prevents postmap from being run !
    refreshonly => true,
+1 −1
Original line number Diff line number Diff line
@@ -110,7 +110,7 @@ describe 'postfix::map' do
        it { is_expected.to contain_file('postfix map foo').with_ensure('absent') }
        it { is_expected.to contain_file('postfix map foo').without_notify }
        it { is_expected.to contain_file('postfix map foo.db').with_ensure('absent') }
        it { is_expected.to contain_exec('generate foo.db') }
	it { is_expected.to contain_exec('generate foo.db').with(:command => 'rm /etc/postfix/foo.db') }
      end

      context 'when using pcre type' do