lib/chef/knife/s3_source.rb in knife-ec2-0.11.0.rc.0 vs lib/chef/knife/s3_source.rb in knife-ec2-0.11.0
- old
+ new
@@ -18,14 +18,24 @@
def bucket_obj
@bucket_obj ||= fog.directories.get(bucket)
end
def bucket
- URI(@url).host
+ uri = URI(@url)
+ if uri.scheme == "s3"
+ URI(@url).host
+ else
+ URI(@url).path.split("/")[1]
+ end
end
def path
- URI(@url).path.sub(/^\//, '')
+ uri = URI(@url)
+ if uri.scheme == "s3"
+ URI(@url).path.sub(/^\//, '')
+ else
+ URI(@url).path.split(bucket).last.sub(/^\//, '')
+ end
end
def fog
require 'fog' # lazy load the fog library to speed up the knife run
@fog ||= Fog::Storage::AWS.new(