From cc083cf2ee8a72c06816ba4d8358938d38f53707 Mon Sep 17 00:00:00 2001 From: Igor Lefter Date: Wed, 5 Jun 2019 00:20:32 +0300 Subject: [PATCH] Fix interpolations and bash vars usage --- .../files/install_rancher_agent.sh.tpl | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/terraform/modules/aws-rancher-k8s-host/files/install_rancher_agent.sh.tpl b/terraform/modules/aws-rancher-k8s-host/files/install_rancher_agent.sh.tpl index 2c98fb32..6b1fbb38 100644 --- a/terraform/modules/aws-rancher-k8s-host/files/install_rancher_agent.sh.tpl +++ b/terraform/modules/aws-rancher-k8s-host/files/install_rancher_agent.sh.tpl @@ -27,27 +27,27 @@ fi # This is assumed to have the format /dev/sd[f-p] (e.g. /dev/sdf, /dev/sdp) DEVICE_NAME_INPUT='${volume_device_name}' -if [ $$DEVICE_NAME_INPUT != '' ]; then +if [ "$${DEVICE_NAME_INPUT}" != '' ]; then MOUNT_PATH='${volume_mount_path}' # Extract the last character of the device name - LAST_CHAR=$$(echo -n $$DEVICE_NAME_INPUT | tail -c 1) + LAST_CHAR=$(echo -n $${DEVICE_NAME_INPUT} | tail -c 1) # Finding the device name the OS is using the last character of the device name # This assumes the OS will map the device name to a format such as "/dev/xvd?" # where '?' is the last character of the device name chosen by the user - if [ -b /dev/xvd$$LAST_CHAR ]; then - INSTANCE_STORE_BLOCK_DEVICE=/dev/xvd$$LAST_CHAR + if [ -b /dev/xvd$${LAST_CHAR} ]; then + INSTANCE_STORE_BLOCK_DEVICE=/dev/xvd$${LAST_CHAR} fi echo $${INSTANCE_STORE_BLOCK_DEVICE} if [ -b $${INSTANCE_STORE_BLOCK_DEVICE} ]; then - sudo mke2fs -E nodiscard -L $$MOUNT_PATH -j $${INSTANCE_STORE_BLOCK_DEVICE} && + sudo mke2fs -E nodiscard -L $${MOUNT_PATH} -j $${INSTANCE_STORE_BLOCK_DEVICE} && sudo tune2fs -r 0 $${INSTANCE_STORE_BLOCK_DEVICE} && - echo "LABEL=$$MOUNT_PATH $$MOUNT_PATH ext4 defaults,noatime 1 1" >> /etc/fstab && - sudo mkdir $$MOUNT_PATH && - sudo mount $$MOUNT_PATH + echo "LABEL=$${MOUNT_PATH} $${MOUNT_PATH} ext4 defaults,noatime 1 1" >> /etc/fstab && + sudo mkdir $${MOUNT_PATH} && + sudo mount $${MOUNT_PATH} fi fi