Last active
July 25, 2020 13:34
-
-
Save WhiteyDude/fd8744440a021b3bb2d1b6cb40ff93ac to your computer and use it in GitHub Desktop.
CodeDeploy ruby 2.5+ non empty directories fix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
files: | |
- source: files/codedeploy_install_instruction.patch | |
destination: /tmp | |
hooks: | |
AfterInstall: | |
- location: scripts/patch_codedeploy_and_restart.sh | |
timeout: 300 | |
runas: root |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
212,215c212,215 | |
< # TODO (AWSGLUE-713): handle the exception if the directory is non-empty; | |
< # this might mean the customer has put files in this directory and we should | |
< # probably ignore the error and move on | |
< FileUtils.rmdir(@file_path) | |
--- | |
> begin | |
> FileUtils.rmdir(@file_path) | |
> rescue Errno::ENOTEMPTY | |
> end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
patch /opt/codedeploy-agent/lib/instance_agent/plugins/codedeploy/install_instruction.rb /tmp/codedeploy_install_instruction.patch | |
systemctl restart amazon-cloudwatch-agent.service |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Replication of already accepted PR (aws/aws-codedeploy-agent#201) which unfortunately hasn't been added to AWS official release yet.
This is a workaround until that PR hits official release for people running > ruby 2.5 as opposed to the Amazon Linux 2 default of 2.0.0 (yuck).
Could move script to BeforeInstall most likely if you have issues on first run like some people have