Skip to content

Commit

Permalink
Fix voxpupuliGH-205 raise exception on bad source paramters
Browse files Browse the repository at this point in the history
  • Loading branch information
nanliu authored and randradas committed Oct 30, 2016
1 parent 96b9c7f commit 2e3311d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions examples/bad_source.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
archive { '/tmp/jta-1.1.jar':
ensure => present,
source => $bad_variable,
}

2 changes: 2 additions & 0 deletions lib/puppet/provider/archive/ruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ def transfer_download(archive_filepath)
FileUtils.copy(Puppet::Util.uri_to_path(uri), temppath)
when %r{^s3}
s3_download(temppath)
when nil
raise(Puppet::Error, 'Unable to fetch archive, the source parameter is nil.')
else
raise(Puppet::Error, "Source file: #{resource[:source]} does not exists.") unless File.exist?(resource[:source])
FileUtils.copy(resource[:source], temppath)
Expand Down

0 comments on commit 2e3311d

Please sign in to comment.