aws-codedeploy-agent
aws-codedeploy-agent copied to clipboard
Generate a normal copy when installing a symlink of a directory
Closes aws/aws-codedeploy-agent#152.
Summary
This PR makes the installer checks each file if it is a symlink of a directory, and generates normal_copy instead of directory_copy.
Description of changes:
When the installer(lib/instance_agent/plugins/codedeploy/installer.rb) runs, it generates instructions for copying source files to the deploy destination. The installer recursively generates mkdir for directory files and copy instructions for regular files.
The problem occurs when a src file is a symlink of a directory. Although the symlink itself IS a regular file, File.directory?(dir_symlink) still returns true. Since Dir.entries(dir_symlink) also works as if it is a normal directory, children files of the symlink are copied instead of the symlink itself.
This PR adds a symlink check as well as a directory check when generating instructions.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Coverage increased (+0.05%) to 92.149% when pulling 0f4e34b5649847610e115bd716bd7f678f1eb856 on what-is-quality:fix-directory-symlink into 9dcc4d9f23df4fe338aba0c656ae6d888a6d24ba on aws:master.
Thanks for solving this issue! This affects us at @Spendesk and we currently need to resort to recreating the symlinks manually in an AfterInstall hooks.
Is there something that's preventing the fix from being merged?