From 9373173db012fb5af02c9e622bef12312909e589 Mon Sep 17 00:00:00 2001 From: Igor Rzegocki Date: Fri, 16 Mar 2018 21:22:07 +0100 Subject: [PATCH] fix(source): Subdirectories on S3 are now properly handled --- libraries/drivers_source_s3.rb | 10 +++++----- .../aws_opsworks_app/dummy_project.json | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/libraries/drivers_source_s3.rb b/libraries/drivers_source_s3.rb index a42e43a7..1348ce17 100644 --- a/libraries/drivers_source_s3.rb +++ b/libraries/drivers_source_s3.rb @@ -32,11 +32,11 @@ def fetch(deploy_context) def prepare_archive_directories context.directory(archive_file_dir) do - mode '0700' + mode '0755' end context.directory(dummy_repository_dir) do - mode '0700' + mode '0755' end end @@ -46,7 +46,7 @@ def fetch_archive_from_s3 # rubocop:disable Metrics/MethodLength base_url = @base_url output = out - context.s3_file File.join(archive_file_dir, s3_key) do + context.s3_file File.join(archive_file_dir, File.basename(s3_key)) do bucket s3_bucket remote_path s3_key aws_access_key_id output[:user] @@ -62,11 +62,11 @@ def fetch_archive_from_s3 # rubocop:disable Metrics/MethodLength def prepare_dummy_git_repository chef_archive_file_dir = archive_file_dir chef_dummy_repository_dir = dummy_repository_dir - s3_key = @s3_key + file_name = File.basename(@s3_key) context.ruby_block 'extract' do block do - OpsworksRuby::Archive.new(File.join(chef_archive_file_dir, s3_key)).uncompress(chef_dummy_repository_dir) + OpsworksRuby::Archive.new(File.join(chef_archive_file_dir, file_name)).uncompress(chef_dummy_repository_dir) end end diff --git a/test/integration/data_bags/s3_thin_nginx_padrino_delayed_job/aws_opsworks_app/dummy_project.json b/test/integration/data_bags/s3_thin_nginx_padrino_delayed_job/aws_opsworks_app/dummy_project.json index a997a06b..baa038f8 100644 --- a/test/integration/data_bags/s3_thin_nginx_padrino_delayed_job/aws_opsworks_app/dummy_project.json +++ b/test/integration/data_bags/s3_thin_nginx_padrino_delayed_job/aws_opsworks_app/dummy_project.json @@ -4,7 +4,7 @@ "password": "xhFwHAMEr51z1+eKylU0zLZEzxwgleiaMcFikGW7", "ssh_key_comment": "Don't get cocky, this is are dummy AWS credentials only for this purpose", "type": "s3", - "url": "https://s3.eu-west-2.amazonaws.com/opsworks-ruby-dummy-app/s3_thin_nginx_padrino_delayed_job.tar.gz", + "url": "https://s3.eu-west-2.amazonaws.com/opsworks-ruby-dummy-app/test/s3_thin_nginx_padrino_delayed_job.tar.gz", "user": "AKIAJLVMILCB53T2UMQA" }, "attributes": {