Skip to content

Instantly share code, notes, and snippets.

Last active July 25, 2020 13:34
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
CodeDeploy ruby 2.5+ non empty directories fix
- source: files/codedeploy_install_instruction.patch
destination: /tmp
- location: scripts/
timeout: 300
runas: root
< # 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
patch /opt/codedeploy-agent/lib/instance_agent/plugins/codedeploy/install_instruction.rb /tmp/codedeploy_install_instruction.patch
systemctl restart amazon-cloudwatch-agent.service
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment