Add symlink copy force option at CopyCommand #203
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue #143:
TL;DR
To fix an error that occurs when the target location is not a regular file, Add symlink copy force option to CopyCommand.
A long story why OVERWRITE option doesn't work correctly
When creating a deployment, codedeploy handles files that already exist in a deployment target location but weren't part of the previous successful deployment with fileExistsBehavior option. If the option is OVERWRITE, the deployment should replace files in the target location to the source files.
However, OVERWRITE doesn't work as expected when some conditions are met.
Suppose my source file is source and destination is target_dir/source. Since I set fileExistsBehavior as OVERWRITE, I want to have a result of target_dir/source regardless of existence of the destination file. But if target_dir/source already exists, only 1 out of 4 cases works correctly.
That is, only case (1) is accidentally handled without a problem due to default behavior of FileUtils.copy. But since other cases are rare, it has not been a big problem.
If the target location was a directory (2, 4 Case), I didn't think it was the intended situation. So in this instance, explicitly exception was generated.