Skip to content

Commit 25e8d04

Browse files
authored
fix(codedeploy): script installing CodeDeploy agent fails (#13758)
There is a typo in the UserData script that install the CodeDeploy Agent on EC2 instances for the server DeploymentGroup. Fixes #13755 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 63f78a6 commit 25e8d04

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

packages/@aws-cdk/aws-codedeploy/lib/server/deployment-group.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ export class ServerDeploymentGroup extends ServerDeploymentGroupBase {
356356
'if [ -z "$PKG_CMD" ]; then',
357357
'PKG_CMD=apt-get',
358358
'else',
359-
'PKG=CMD=yum',
359+
'PKG_CMD=yum',
360360
'fi',
361361
'$PKG_CMD update -y',
362362
'set +e', // make sure we don't exit on the next command failing (we check its exit code below)
@@ -367,8 +367,7 @@ export class ServerDeploymentGroup extends ServerDeploymentGroupBase {
367367
'$PKG_CMD install -y ruby',
368368
'fi',
369369
'AWS_CLI_PACKAGE_NAME=awscli',
370-
'if [[ "$PKG_CMD" = "yum" ]];',
371-
'then',
370+
'if [ "$PKG_CMD" = "yum" ]; then',
372371
'AWS_CLI_PACKAGE_NAME=aws-cli',
373372
'fi',
374373
'$PKG_CMD install -y $AWS_CLI_PACKAGE_NAME',

packages/@aws-cdk/aws-codedeploy/test/server/integ.deployment-group.expected.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -659,7 +659,7 @@
659659
"Fn::Join": [
660660
"",
661661
[
662-
"#!/bin/bash\nset +e\nPKG_CMD=`which yum 2>/dev/null`\nset -e\nif [ -z \"$PKG_CMD\" ]; then\nPKG_CMD=apt-get\nelse\nPKG=CMD=yum\nfi\n$PKG_CMD update -y\nset +e\n$PKG_CMD install -y ruby2.0\nRUBY2_INSTALL=$?\nset -e\nif [ $RUBY2_INSTALL -ne 0 ]; then\n$PKG_CMD install -y ruby\nfi\nAWS_CLI_PACKAGE_NAME=awscli\nif [[ \"$PKG_CMD\" = \"yum\" ]];\nthen\nAWS_CLI_PACKAGE_NAME=aws-cli\nfi\n$PKG_CMD install -y $AWS_CLI_PACKAGE_NAME\nTMP_DIR=`mktemp -d`\ncd $TMP_DIR\naws s3 cp s3://aws-codedeploy-",
662+
"#!/bin/bash\nset +e\nPKG_CMD=`which yum 2>/dev/null`\nset -e\nif [ -z \"$PKG_CMD\" ]; then\nPKG_CMD=apt-get\nelse\nPKG_CMD=yum\nfi\n$PKG_CMD update -y\nset +e\n$PKG_CMD install -y ruby2.0\nRUBY2_INSTALL=$?\nset -e\nif [ $RUBY2_INSTALL -ne 0 ]; then\n$PKG_CMD install -y ruby\nfi\nAWS_CLI_PACKAGE_NAME=awscli\nif [ \"$PKG_CMD\" = \"yum\" ]; then\nAWS_CLI_PACKAGE_NAME=aws-cli\nfi\n$PKG_CMD install -y $AWS_CLI_PACKAGE_NAME\nTMP_DIR=`mktemp -d`\ncd $TMP_DIR\naws s3 cp s3://aws-codedeploy-",
663663
{
664664
"Ref": "AWS::Region"
665665
},
@@ -884,4 +884,4 @@
884884
"Default": "/aws/service/ami-amazon-linux-latest/amzn-ami-hvm-x86_64-gp2"
885885
}
886886
}
887-
}
887+
}

packages/@aws-cdk/aws-codedeploy/test/server/test.deployment-group.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export = {
8181
'Fn::Join': [
8282
'',
8383
[
84-
'#!/bin/bash\nset +e\nPKG_CMD=`which yum 2>/dev/null`\nset -e\nif [ -z "$PKG_CMD" ]; then\nPKG_CMD=apt-get\nelse\nPKG=CMD=yum\nfi\n$PKG_CMD update -y\nset +e\n$PKG_CMD install -y ruby2.0\nRUBY2_INSTALL=$?\nset -e\nif [ $RUBY2_INSTALL -ne 0 ]; then\n$PKG_CMD install -y ruby\nfi\nAWS_CLI_PACKAGE_NAME=awscli\nif [[ "$PKG_CMD" = "yum" ]];\nthen\nAWS_CLI_PACKAGE_NAME=aws-cli\nfi\n$PKG_CMD install -y $AWS_CLI_PACKAGE_NAME\nTMP_DIR=`mktemp -d`\ncd $TMP_DIR\naws s3 cp s3://aws-codedeploy-',
84+
'#!/bin/bash\nset +e\nPKG_CMD=`which yum 2>/dev/null`\nset -e\nif [ -z "$PKG_CMD" ]; then\nPKG_CMD=apt-get\nelse\nPKG_CMD=yum\nfi\n$PKG_CMD update -y\nset +e\n$PKG_CMD install -y ruby2.0\nRUBY2_INSTALL=$?\nset -e\nif [ $RUBY2_INSTALL -ne 0 ]; then\n$PKG_CMD install -y ruby\nfi\nAWS_CLI_PACKAGE_NAME=awscli\nif [ "$PKG_CMD" = "yum" ]; then\nAWS_CLI_PACKAGE_NAME=aws-cli\nfi\n$PKG_CMD install -y $AWS_CLI_PACKAGE_NAME\nTMP_DIR=`mktemp -d`\ncd $TMP_DIR\naws s3 cp s3://aws-codedeploy-',
8585
{
8686
'Ref': 'AWS::Region',
8787
},

0 commit comments

Comments
 (0)