Skip to content

Commit

Permalink
format codes
Browse files Browse the repository at this point in the history
  • Loading branch information
gdbtek committed Dec 2, 2019
1 parent 87a4c34 commit a651961
Show file tree
Hide file tree
Showing 19 changed files with 129 additions and 126 deletions.
15 changes: 7 additions & 8 deletions cookbooks/gocd/recipes/install-agent.bash
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,14 @@ function install()
serverHostname='127.0.0.1'
fi

local -r initConfigData=(
'__AGENT_INSTALL_FOLDER_PATH__' "${GOCD_AGENT_INSTALL_FOLDER_PATH}"
'__SERVER_HOSTNAME__' "${serverHostname}"
'__GO_HOME_FOLDER__' "$(getUserHomeFolder "${GOCD_USER_NAME}")"
'__USER_NAME__' "${GOCD_USER_NAME}"
createInitFileFromTemplate \
"${GOCD_AGENT_SERVICE_NAME}" \
"$(dirname "${BASH_SOURCE[0]}")/../templates" \
'__AGENT_INSTALL_FOLDER_PATH__' "${GOCD_AGENT_INSTALL_FOLDER_PATH}" \
'__SERVER_HOSTNAME__' "${serverHostname}" \
'__GO_HOME_FOLDER__' "$(getUserHomeFolder "${GOCD_USER_NAME}")" \
'__USER_NAME__' "${GOCD_USER_NAME}" \
'__GROUP_NAME__' "${GOCD_GROUP_NAME}"
)

createInitFileFromTemplate "${GOCD_AGENT_SERVICE_NAME}" "$(dirname "${BASH_SOURCE[0]}")/../templates" "${initConfigData[@]}"

# Start

Expand Down
13 changes: 6 additions & 7 deletions cookbooks/gocd/recipes/install-server.bash
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,13 @@ function install()

# Config Init

local -r initConfigData=(
'__SERVER_INSTALL_FOLDER_PATH__' "${GOCD_SERVER_INSTALL_FOLDER_PATH}"
'__GO_HOME_FOLDER__' "$(getUserHomeFolder "${GOCD_USER_NAME}")"
'__USER_NAME__' "${GOCD_USER_NAME}"
createInitFileFromTemplate \
"${GOCD_SERVER_SERVICE_NAME}" \
"$(dirname "${BASH_SOURCE[0]}")/../templates" \
'__SERVER_INSTALL_FOLDER_PATH__' "${GOCD_SERVER_INSTALL_FOLDER_PATH}" \
'__GO_HOME_FOLDER__' "$(getUserHomeFolder "${GOCD_USER_NAME}")" \
'__USER_NAME__' "${GOCD_USER_NAME}" \
'__GROUP_NAME__' "${GOCD_GROUP_NAME}"
)

createInitFileFromTemplate "${GOCD_SERVER_SERVICE_NAME}" "$(dirname "${BASH_SOURCE[0]}")/../templates" "${initConfigData[@]}"

# Start

Expand Down
7 changes: 4 additions & 3 deletions cookbooks/groovy/recipes/install.bash
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,10 @@ function install()

# Config Profile

local -r profileConfigData=('__INSTALL_FOLDER_PATH__' "${GROOVY_INSTALL_FOLDER_PATH}")

createFileFromTemplate "$(dirname "${BASH_SOURCE[0]}")/../templates/groovy.sh.profile" '/etc/profile.d/groovy.sh' "${profileConfigData[@]}"
createFileFromTemplate \
"$(dirname "${BASH_SOURCE[0]}")/../templates/groovy.sh.profile" \
'/etc/profile.d/groovy.sh' \
'__INSTALL_FOLDER_PATH__' "${GROOVY_INSTALL_FOLDER_PATH}"

# Display Version

Expand Down
6 changes: 4 additions & 2 deletions cookbooks/jenkins/libraries/app.bash
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,11 @@ function jenkinsMasterUnlock()
{
header 'UNLOCKING JENKINS'

local -r configData=('<useSecurity>true</useSecurity>' '<useSecurity>false</useSecurity>')
createFileFromTemplate \
"${JENKINS_INSTALL_FOLDER_PATH}/config.xml" \
"${JENKINS_INSTALL_FOLDER_PATH}/config.xml" \
'<useSecurity>true</useSecurity>' '<useSecurity>false</useSecurity>'

createFileFromTemplate "${JENKINS_INSTALL_FOLDER_PATH}/config.xml" "${JENKINS_INSTALL_FOLDER_PATH}/config.xml" "${configData[@]}"
cat "${JENKINS_INSTALL_FOLDER_PATH}/config.xml"

echo '2.0' > "${JENKINS_INSTALL_FOLDER_PATH}/jenkins.install.InstallUtil.lastExecVersion"
Expand Down
17 changes: 9 additions & 8 deletions cookbooks/jenkins/recipes/install-master.bash
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,20 @@ function install()

# Config Profile

local -r profileConfigData=('__INSTALL_FOLDER_PATH__' "${JENKINS_INSTALL_FOLDER_PATH}")

createFileFromTemplate "$(dirname "${BASH_SOURCE[0]}")/../templates/jenkins.sh.profile" '/etc/profile.d/jenkins.sh' "${profileConfigData[@]}"
createFileFromTemplate \
"$(dirname "${BASH_SOURCE[0]}")/../templates/jenkins.sh.profile" \
'/etc/profile.d/jenkins.sh' \
'__INSTALL_FOLDER_PATH__' "${JENKINS_INSTALL_FOLDER_PATH}"

# Config Cron

local -r cronConfigData=(
'__USER_NAME__' "${JENKINS_USER_NAME}"
'__GROUP_NAME__' "${JENKINS_GROUP_NAME}"
createFileFromTemplate \
"$(dirname "${BASH_SOURCE[0]}")/../templates/jenkins.cron" \
'/etc/cron.daily/jenkins' \
'__USER_NAME__' "${JENKINS_USER_NAME}" \
'__GROUP_NAME__' "${JENKINS_GROUP_NAME}" \
'__INSTALL_FOLDER_PATH__' "${JENKINS_INSTALL_FOLDER_PATH}"
)

createFileFromTemplate "$(dirname "${BASH_SOURCE[0]}")/../templates/jenkins.cron" '/etc/cron.daily/jenkins' "${cronConfigData[@]}"
chmod 755 '/etc/cron.daily/jenkins'

# Install
Expand Down
25 changes: 12 additions & 13 deletions cookbooks/kibana/recipes/install.bash
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,26 @@ function install()

# Config Server

local -r serverConfigData=(
createFileFromTemplate \
"${KIBANA_INSTALL_FOLDER_PATH}/config/kibana.yml" \
"${KIBANA_INSTALL_FOLDER_PATH}/config/kibana.yml" \
'http://localhost:9200' "${KIBANA_ELASTIC_SEARCH_URL}"
)

createFileFromTemplate "${KIBANA_INSTALL_FOLDER_PATH}/config/kibana.yml" "${KIBANA_INSTALL_FOLDER_PATH}/config/kibana.yml" "${serverConfigData[@]}"

# Config Profile

local -r profileConfigData=('__INSTALL_FOLDER_PATH__' "${KIBANA_INSTALL_FOLDER_PATH}")

createFileFromTemplate "$(dirname "${BASH_SOURCE[0]}")/../templates/kibana.sh.profile" '/etc/profile.d/kibana.sh' "${profileConfigData[@]}"
createFileFromTemplate \
"$(dirname "${BASH_SOURCE[0]}")/../templates/kibana.sh.profile" \
'/etc/profile.d/kibana.sh' \
'__INSTALL_FOLDER_PATH__' "${KIBANA_INSTALL_FOLDER_PATH}"

# Config Init

local -r initConfigData=(
'__INSTALL_FOLDER_PATH__' "${KIBANA_INSTALL_FOLDER_PATH}"
'__USER_NAME__' "${KIBANA_USER_NAME}"
createInitFileFromTemplate \
"${KIBANA_SERVICE_NAME}" \
"$(dirname "${BASH_SOURCE[0]}")/../templates" \
'__INSTALL_FOLDER_PATH__' "${KIBANA_INSTALL_FOLDER_PATH}" \
'__USER_NAME__' "${KIBANA_USER_NAME}" \
'__GROUP_NAME__' "${KIBANA_GROUP_NAME}"
)

createInitFileFromTemplate "${KIBANA_SERVICE_NAME}" "$(dirname "${BASH_SOURCE[0]}")/../templates" "${initConfigData[@]}"

# Start

Expand Down
21 changes: 11 additions & 10 deletions cookbooks/mongodb/recipes/install.bash
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,22 @@ function install()

# Config Profile

local -r profileConfigData=('__INSTALL_FOLDER_PATH__' "${MONGODB_INSTALL_FOLDER_PATH}")

createFileFromTemplate "$(dirname "${BASH_SOURCE[0]}")/../templates/mongodb.sh.profile" '/etc/profile.d/mongodb.sh' "${profileConfigData[@]}"
createFileFromTemplate \
"$(dirname "${BASH_SOURCE[0]}")/../templates/mongodb.sh.profile" \
'/etc/profile.d/mongodb.sh' \
'__INSTALL_FOLDER_PATH__' "${MONGODB_INSTALL_FOLDER_PATH}"

# Config Init

local -r initConfigData=(
'__INSTALL_FOLDER_PATH__' "${MONGODB_INSTALL_FOLDER_PATH}"
'__INSTALL_DATA_FOLDER__' "${MONGODB_INSTALL_DATA_FOLDER}"
'__USER_NAME__' "${MONGODB_USER_NAME}"
'__GROUP_NAME__' "${MONGODB_GROUP_NAME}"
createInitFileFromTemplate \
"${MONGODB_SERVICE_NAME}" \
"$(dirname "${BASH_SOURCE[0]}")/../templates" \
'__INSTALL_FOLDER_PATH__' "${MONGODB_INSTALL_FOLDER_PATH}" \
'__INSTALL_DATA_FOLDER__' "${MONGODB_INSTALL_DATA_FOLDER}" \
'__USER_NAME__' "${MONGODB_USER_NAME}" \
'__GROUP_NAME__' "${MONGODB_GROUP_NAME}" \
'__PORT__' "${MONGODB_PORT}"
)

createInitFileFromTemplate "${MONGODB_SERVICE_NAME}" "$(dirname "${BASH_SOURCE[0]}")/../templates" "${initConfigData[@]}"
chown -R "$(whoami):$(whoami)" "${MONGODB_INSTALL_FOLDER_PATH}"

# Start
Expand Down
14 changes: 8 additions & 6 deletions cookbooks/mysql/recipes/install.bash
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,10 @@ function install()

# Config Server

local -r serverConfigData=('__PORT__' "${MYSQL_PORT}")

createFileFromTemplate "$(dirname "${BASH_SOURCE[0]}")/../templates/my.cnf.conf" "${MYSQL_INSTALL_FOLDER_PATH}/my.cnf" "${serverConfigData[@]}"
createFileFromTemplate \
"$(dirname "${BASH_SOURCE[0]}")/../templates/my.cnf.conf" \
"${MYSQL_INSTALL_FOLDER_PATH}/my.cnf" \
'__PORT__' "${MYSQL_PORT}"

# Config Service

Expand All @@ -45,9 +46,10 @@ function install()

# Config Profile

local -r profileConfigData=('__INSTALL_FOLDER_PATH__' "${MYSQL_INSTALL_FOLDER_PATH}")

createFileFromTemplate "$(dirname "${BASH_SOURCE[0]}")/../templates/mysql.sh.profile" '/etc/profile.d/mysql.sh' "${profileConfigData[@]}"
createFileFromTemplate \
"$(dirname "${BASH_SOURCE[0]}")/../templates/mysql.sh.profile" \
'/etc/profile.d/mysql.sh' \
'__INSTALL_FOLDER_PATH__' "${MYSQL_INSTALL_FOLDER_PATH}"

# Start

Expand Down
4 changes: 2 additions & 2 deletions cookbooks/nginx/attributes/default.bash
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

export NGINX_PORT='80'

export AMAZON_LINUX_ID='centos'
export AMAZON_LINUX_VERSION_ID='7'
export NGINX_AMAZON_LINUX_ID='centos'
export NGINX_AMAZON_LINUX_VERSION_ID='7'
19 changes: 10 additions & 9 deletions cookbooks/nginx/recipes/install.bash
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ function install()

source "${releaseFilePath}"

local -r configData=('__DISTRIBUTION_CODE_NAME__' "${DISTRIB_CODENAME}")
createFileFromTemplate \
"$(dirname "${BASH_SOURCE[0]}")/../templates/nginx.list.apt" \
'/etc/apt/sources.list.d/nginx.list' \
'__DISTRIBUTION_CODE_NAME__' "${DISTRIB_CODENAME}"

createFileFromTemplate "$(dirname "${BASH_SOURCE[0]}")/../templates/nginx.list.apt" '/etc/apt/sources.list.d/nginx.list' "${configData[@]}"
curl -s -L 'http://nginx.org/keys/nginx_signing.key' --retry 12 --retry-delay 5 | apt-key add -
apt-get update -m
else
Expand All @@ -30,18 +32,17 @@ function install()

if [[ "${ID}" = 'amzn' ]]
then
ID="${AMAZON_LINUX_ID}"
VERSION_ID="${AMAZON_LINUX_VERSION_ID}"
ID="${NGINX_AMAZON_LINUX_ID}"
VERSION_ID="${NGINX_AMAZON_LINUX_VERSION_ID}"
fi

# Generate Repo File

local -r configData=(
'__PLATFORM_FAMILY__' "${ID}"
createFileFromTemplate \
"$(dirname "${BASH_SOURCE[0]}")/../templates/nginx.repo" \
'/etc/yum.repos.d/nginx.repo' \
'__PLATFORM_FAMILY__' "${ID}" \
'__PLATFORM_VERSION__' "$(awk -F '.' '{ print $1 }' <<< "${VERSION_ID}")"
)

createFileFromTemplate "$(dirname "${BASH_SOURCE[0]}")/../templates/nginx.repo" '/etc/yum.repos.d/nginx.repo' "${configData[@]}"
fi

# Install
Expand Down
7 changes: 4 additions & 3 deletions cookbooks/node/recipes/install.bash
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,10 @@ function install()

# Config Profile

local -r profileConfigData=('__INSTALL_FOLDER_PATH__' "${NODE_INSTALL_FOLDER_PATH}")

createFileFromTemplate "$(dirname "${BASH_SOURCE[0]}")/../templates/node.sh.profile" '/etc/profile.d/node.sh' "${profileConfigData[@]}"
createFileFromTemplate \
"$(dirname "${BASH_SOURCE[0]}")/../templates/node.sh.profile" \
'/etc/profile.d/node.sh' \
'__INSTALL_FOLDER_PATH__' "${NODE_INSTALL_FOLDER_PATH}"

# Clean Up

Expand Down
14 changes: 8 additions & 6 deletions cookbooks/pm2/recipes/install.bash
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,17 @@ function install()

# Config Profile

local -r profileConfigData=('__HOME_FOLDER__' "${userHome}/.pm2")

createFileFromTemplate "$(dirname "${BASH_SOURCE[0]}")/../templates/pm2.sh.profile" '/etc/profile.d/pm2.sh' "${profileConfigData[@]}"
createFileFromTemplate \
"$(dirname "${BASH_SOURCE[0]}")/../templates/pm2.sh.profile" \
'/etc/profile.d/pm2.sh' \
'__HOME_FOLDER__' "${userHome}/.pm2"

# Config Log Rotate

local -r logrotateConfigData=('__HOME_FOLDER__' "${userHome}/.pm2")

createFileFromTemplate "$(dirname "${BASH_SOURCE[0]}")/../templates/pm2.logrotate" '/etc/logrotate.d/pm2' "${logrotateConfigData[@]}"
createFileFromTemplate \
"$(dirname "${BASH_SOURCE[0]}")/../templates/pm2.logrotate" \
'/etc/logrotate.d/pm2' \
'__HOME_FOLDER__' "${userHome}/.pm2"

# Clean Up

Expand Down
7 changes: 4 additions & 3 deletions cookbooks/python/recipes/install.bash
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ function install()

# Config Profile

local -r profileConfigData=('__INSTALL_FOLDER_PATH__' "${PYTHON_INSTALL_FOLDER_PATH}")

createFileFromTemplate "$(dirname "${BASH_SOURCE[0]}")/../templates/python.sh.profile" '/etc/profile.d/python.sh' "${profileConfigData[@]}"
createFileFromTemplate \
"$(dirname "${BASH_SOURCE[0]}")/../templates/python.sh.profile" \
'/etc/profile.d/python.sh' \
'__INSTALL_FOLDER_PATH__' "${PYTHON_INSTALL_FOLDER_PATH}"

# Display Version

Expand Down
18 changes: 10 additions & 8 deletions cookbooks/selenium-server/libraries/app.bash
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,20 @@ function installRole()

local -r configFile="${SELENIUM_SERVER_INSTALL_FOLDER_PATH}/selenium-server-${role}.json"

createFileFromTemplate "$(dirname "${BASH_SOURCE[0]}")/../templates/selenium-server-${role}.json.conf" "${configFile}" "${serverConfigDataRole[@]}"
createFileFromTemplate \
"$(dirname "${BASH_SOURCE[0]}")/../templates/selenium-server-${role}.json.conf" \
"${configFile}" \
"${serverConfigDataRole[@]}"

# Config Init

local -r initConfigData=(
'__INSTALL_FILE__' "${jarFile}"
'__CONFIG_FILE__' "${configFile}"
'__USER_NAME__' "${SELENIUM_SERVER_USER_NAME}"
createInitFileFromTemplate \
"selenium-server-${role}" \
"$(dirname "${BASH_SOURCE[0]}")/../templates" \
'__INSTALL_FILE__' "${jarFile}" \
'__CONFIG_FILE__' "${configFile}" \
'__USER_NAME__' "${SELENIUM_SERVER_USER_NAME}" \
'__GROUP_NAME__' "${SELENIUM_SERVER_GROUP_NAME}"
)

createInitFileFromTemplate "selenium-server-${role}" "$(dirname "${BASH_SOURCE[0]}")/../templates" "${initConfigData[@]}"

# Start

Expand Down
6 changes: 2 additions & 4 deletions cookbooks/selenium-server/recipes/install-hub.bash
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,9 @@ function install()

# Install

local -r serverConfigData=(
installRole \
'hub' \
'__PORT__' "${SELENIUM_SERVER_PORT}"
)

installRole 'hub' "${serverConfigData[@]}"

# Display Open Ports

Expand Down
10 changes: 4 additions & 6 deletions cookbooks/selenium-server/recipes/install-node.bash
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,11 @@ function install()

# Install Role

local -r serverConfigData=(
'__PORT__' "${SELENIUM_SERVER_PORT}"
'__HUB_PORT__' "${SELENIUM_SERVER_HUB_PORT}"
installRole \
'node' \
'__PORT__' "${SELENIUM_SERVER_PORT}" \
'__HUB_PORT__' "${SELENIUM_SERVER_HUB_PORT}" \
'__HUB_HOST__' "${SELENIUM_SERVER_HUB_HOST}"
)

installRole 'node' "${serverConfigData[@]}"

# Display Open Ports

Expand Down
11 changes: 5 additions & 6 deletions cookbooks/splunkforwarder/recipes/install.bash
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,12 @@ function install()

if [[ "$(existCommand 'systemctl')" = 'true' ]]
then
local -r initConfigData=(
'__GROUP_NAME__' "${SPLUNKFORWARDER_GROUP_NAME}"
'__INSTALL_FOLDER_PATH__' "${SPLUNKFORWARDER_INSTALL_FOLDER_PATH}"
createInitFileFromTemplate \
"${SPLUNKFORWARDER_SERVICE_NAME}" \
"$(dirname "${BASH_SOURCE[0]}")/../templates" \
'__GROUP_NAME__' "${SPLUNKFORWARDER_GROUP_NAME}" \
'__INSTALL_FOLDER_PATH__' "${SPLUNKFORWARDER_INSTALL_FOLDER_PATH}" \
'__USER_NAME__' "${SPLUNKFORWARDER_USER_NAME}"
)

createInitFileFromTemplate "${SPLUNKFORWARDER_SERVICE_NAME}" "$(dirname "${BASH_SOURCE[0]}")/../templates" "${initConfigData[@]}"
else
"${SPLUNKFORWARDER_INSTALL_FOLDER_PATH}/bin/splunk" enable boot-start --accept-license --answer-yes --no-prompt
fi
Expand Down
Loading

0 comments on commit a651961

Please sign in to comment.