Skip to content

Commit

Permalink
- Fixed codedeploy EC2 Launch Bundle on ubuntu.
Browse files Browse the repository at this point in the history
  • Loading branch information
gitwater committed Apr 6, 2021
1 parent a7229ff commit ab86a7a
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/paco/application/ec2_launch_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -2076,8 +2076,10 @@ def lb_add_codedeploy(self, bundle_name, resource):
codedeploy_lb = LaunchBundle(resource, self, bundle_name)
if resource.instance_ami_type_generic in ['amazon', 'centos']:
uninstall_command='yum erase codedeploy-agent -y'
package_exists_command='yum list installed codedeploy-agent >/dev/null 2>&1'
else:
uninstall_command='dpkg --purge codedeploy-agent -y'
package_exists_command='dpkg -l codedeploy-agent >/dev/null 2>&1'
launch_script = f"""#!/bin/bash
function stop_agent() {{
Expand Down Expand Up @@ -2137,8 +2139,14 @@ def lb_add_codedeploy(self, bundle_name, resource):
}}
function disable_launch_bundle() {{
stop_agent
{uninstall_command}
set +e
{package_exists_command}
RES=$?
set -e
if [ $RES -eq 0 ] ; then
stop_agent
{uninstall_command}
fi
}}
"""
codedeploy_lb.set_launch_script(launch_script, resource.launch_options.codedeploy_agent)
Expand Down

0 comments on commit ab86a7a

Please sign in to comment.