From 49cec8934f118c3bb6fbc6264298e2c992015cfe Mon Sep 17 00:00:00 2001 From: Drew Hubl Date: Thu, 14 Jun 2018 16:51:11 -0700 Subject: [PATCH] Fix configuration directory and file permissions --- scripts/build_os_package.sh | 0 scripts/includes/common.sh | 16 ++++++---------- scripts/st2bootstrap-deb.sh | 16 ++++++---------- scripts/st2bootstrap-el6.sh | 16 ++++++---------- scripts/st2bootstrap-el7.sh | 16 ++++++---------- 5 files changed, 24 insertions(+), 40 deletions(-) mode change 100644 => 100755 scripts/build_os_package.sh diff --git a/scripts/build_os_package.sh b/scripts/build_os_package.sh old mode 100644 new mode 100755 diff --git a/scripts/includes/common.sh b/scripts/includes/common.sh index 2279e54e..570201a7 100644 --- a/scripts/includes/common.sh +++ b/scripts/includes/common.sh @@ -185,11 +185,9 @@ configure_st2_cli_config() { sudo mkdir -p ${ROOT_USER_CLI_CONFIG_DIRECTORY} fi - sudo sh -c "cat < ${ROOT_USER_CLI_CONFIG_PATH} -[credentials] -username = ${USERNAME} -password = ${PASSWORD} -EOT" + sudo sh -c st2 login --config ${ROOT_USER_CLI_CONFIG_PATH} \ + --write-password \ + --username ${USERNAME} --password ${PASSWORD} # Write config for root user if [ "${CURRENT_USER}" == "${ROOT_USER}" ]; then @@ -201,11 +199,9 @@ EOT" sudo mkdir -p ${CURRENT_USER_CLI_CONFIG_DIRECTORY} fi - sudo sh -c "cat < ${CURRENT_USER_CLI_CONFIG_PATH} -[credentials] -username = ${USERNAME} -password = ${PASSWORD} -EOT" + sudo sh -c st2 login --config ${CURRENT_USER_CLI_CONFIG_PATH} \ + --write-password \ + --username ${USERNAME} --password ${PASSWORD} # Fix the permissions sudo chown -R ${CURRENT_USER}:${CURRENT_USER} ${CURRENT_USER_CLI_CONFIG_DIRECTORY} diff --git a/scripts/st2bootstrap-deb.sh b/scripts/st2bootstrap-deb.sh index ebdd561e..d53fe716 100644 --- a/scripts/st2bootstrap-deb.sh +++ b/scripts/st2bootstrap-deb.sh @@ -302,11 +302,9 @@ configure_st2_cli_config() { sudo mkdir -p ${ROOT_USER_CLI_CONFIG_DIRECTORY} fi - sudo sh -c "cat < ${ROOT_USER_CLI_CONFIG_PATH} -[credentials] -username = ${USERNAME} -password = ${PASSWORD} -EOT" + sudo sh -c st2 login --config ${ROOT_USER_CLI_CONFIG_PATH} \ + --write-password \ + --username ${USERNAME} --password ${PASSWORD} # Write config for root user if [ "${CURRENT_USER}" == "${ROOT_USER}" ]; then @@ -318,11 +316,9 @@ EOT" sudo mkdir -p ${CURRENT_USER_CLI_CONFIG_DIRECTORY} fi - sudo sh -c "cat < ${CURRENT_USER_CLI_CONFIG_PATH} -[credentials] -username = ${USERNAME} -password = ${PASSWORD} -EOT" + sudo sh -c st2 login --config ${CURRENT_USER_CLI_CONFIG_PATH} \ + --write-password \ + --username ${USERNAME} --password ${PASSWORD} # Fix the permissions sudo chown -R ${CURRENT_USER}:${CURRENT_USER} ${CURRENT_USER_CLI_CONFIG_DIRECTORY} diff --git a/scripts/st2bootstrap-el6.sh b/scripts/st2bootstrap-el6.sh index dcde3d49..fd60042d 100644 --- a/scripts/st2bootstrap-el6.sh +++ b/scripts/st2bootstrap-el6.sh @@ -297,11 +297,9 @@ configure_st2_cli_config() { sudo mkdir -p ${ROOT_USER_CLI_CONFIG_DIRECTORY} fi - sudo sh -c "cat < ${ROOT_USER_CLI_CONFIG_PATH} -[credentials] -username = ${USERNAME} -password = ${PASSWORD} -EOT" + sudo sh -c st2 login --config ${ROOT_USER_CLI_CONFIG_PATH} \ + --write-password \ + --username ${USERNAME} --password ${PASSWORD} # Write config for root user if [ "${CURRENT_USER}" == "${ROOT_USER}" ]; then @@ -313,11 +311,9 @@ EOT" sudo mkdir -p ${CURRENT_USER_CLI_CONFIG_DIRECTORY} fi - sudo sh -c "cat < ${CURRENT_USER_CLI_CONFIG_PATH} -[credentials] -username = ${USERNAME} -password = ${PASSWORD} -EOT" + sudo sh -c st2 login --config ${CURRENT_USER_CLI_CONFIG_PATH} \ + --write-password \ + --username ${USERNAME} --password ${PASSWORD} # Fix the permissions sudo chown -R ${CURRENT_USER}:${CURRENT_USER} ${CURRENT_USER_CLI_CONFIG_DIRECTORY} diff --git a/scripts/st2bootstrap-el7.sh b/scripts/st2bootstrap-el7.sh index 07eb2715..e6897fca 100644 --- a/scripts/st2bootstrap-el7.sh +++ b/scripts/st2bootstrap-el7.sh @@ -297,11 +297,9 @@ configure_st2_cli_config() { sudo mkdir -p ${ROOT_USER_CLI_CONFIG_DIRECTORY} fi - sudo sh -c "cat < ${ROOT_USER_CLI_CONFIG_PATH} -[credentials] -username = ${USERNAME} -password = ${PASSWORD} -EOT" + sudo sh -c st2 login --config ${ROOT_USER_CLI_CONFIG_PATH} \ + --write-password \ + --username ${USERNAME} --password ${PASSWORD} # Write config for root user if [ "${CURRENT_USER}" == "${ROOT_USER}" ]; then @@ -313,11 +311,9 @@ EOT" sudo mkdir -p ${CURRENT_USER_CLI_CONFIG_DIRECTORY} fi - sudo sh -c "cat < ${CURRENT_USER_CLI_CONFIG_PATH} -[credentials] -username = ${USERNAME} -password = ${PASSWORD} -EOT" + sudo sh -c st2 login --config ${CURRENT_USER_CLI_CONFIG_PATH} \ + --write-password \ + --username ${USERNAME} --password ${PASSWORD} # Fix the permissions sudo chown -R ${CURRENT_USER}:${CURRENT_USER} ${CURRENT_USER_CLI_CONFIG_DIRECTORY}