From 342d2845682ceae5cb0f6c7828b69fc40d388bd4 Mon Sep 17 00:00:00 2001 From: Ikiru Yoshizaki <3856350+guitarrapc@users.noreply.github.com> Date: Tue, 13 Aug 2019 16:21:14 +0900 Subject: [PATCH 1/2] fix: mkdir failed and ec2 infinitely re-launch no-problem with first launch, but could not recover after 2nd launch. cloud-init error message indicate mkdir failed. $ sudo cat /var/log/cloud-init-output.log mkdir: cannot create directory '/verdaccio/conf': File exists --- contrib/aws/cloudformation-ec2-efs.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/aws/cloudformation-ec2-efs.yaml b/contrib/aws/cloudformation-ec2-efs.yaml index 61612d9cf..781f3dd3c 100644 --- a/contrib/aws/cloudformation-ec2-efs.yaml +++ b/contrib/aws/cloudformation-ec2-efs.yaml @@ -159,7 +159,7 @@ Resources: mount -a -t efs defaults # Create/update the config & password files. - mkdir "$BASE/conf" + mkdir "$BASE/conf" -p curl -o "$BASE/conf/htpasswd" "${VerdaccioHtpasswdUrl}" curl -o "$BASE/conf/config.yaml" "${VerdaccioConfigUrl}" From 9006146a59904487c53e4d3c13111c2a53b77499 Mon Sep 17 00:00:00 2001 From: Ikiru Yoshizaki <3856350+guitarrapc@users.noreply.github.com> Date: Wed, 14 Aug 2019 23:38:34 +0900 Subject: [PATCH 2/2] fix: use test + mkdir for strict dir check --- contrib/aws/cloudformation-ec2-efs.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/aws/cloudformation-ec2-efs.yaml b/contrib/aws/cloudformation-ec2-efs.yaml index 781f3dd3c..2bb7d9fde 100644 --- a/contrib/aws/cloudformation-ec2-efs.yaml +++ b/contrib/aws/cloudformation-ec2-efs.yaml @@ -159,7 +159,7 @@ Resources: mount -a -t efs defaults # Create/update the config & password files. - mkdir "$BASE/conf" -p + [[ -d "$BASE/conf" ]] || mkdir "$BASE/conf" curl -o "$BASE/conf/htpasswd" "${VerdaccioHtpasswdUrl}" curl -o "$BASE/conf/config.yaml" "${VerdaccioConfigUrl}"