prepare_s3_checkouts

in scm_helper/libraries/s3.rb [50:82]


      def prepare_s3_checkouts(scm_options)
        tmpdir = Dir.mktmpdir('opsworks')
        directory tmpdir do
          mode 0755
        end

        s3_bucket, s3_key, base_url, s3_region = OpsWorks::SCM::S3.parse_uri(scm_options[:repository])

        s3_file "#{tmpdir}/archive" do
          bucket s3_bucket
          remote_path s3_key
          region s3_region
          aws_access_key_id scm_options[:user]
          aws_secret_access_key scm_options[:password]
          owner "root"
          group "root"
          mode "0600"
          s3_url base_url
          action :create
        end

        execute 'extract files' do
          command "#{node[:opsworks_agent][:current_dir]}/bin/extract #{tmpdir}/archive"
        end

        execute 'create git repository' do
          cwd "#{tmpdir}/archive.d"
          command "find . -type d -name .git -exec rm -rf {} \\;; find . -type f -name .gitignore -exec rm -f {} \\;; git init; git add .; git config user.name 'AWS OpsWorks'; git config user.email 'root@localhost'; git commit -m 'Create temporary repository from downloaded contents.'"
        end

        "#{tmpdir}/archive.d"
      end