Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
rpelisse committed Sep 13, 2023
1 parent ce4e8b0 commit 206415e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
17 changes: 16 additions & 1 deletion ansible/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,25 @@ configureAnsible() {
loadJBossNetworkAPISecrets() {
if [ -e "${JBOSS_NETWORK_API_CREDENTIAL_FILE}" ]; then
# extra spaces in front of -e is to prevent its interpretation as an arg of echo
echo ' -e' rhn_username="$(readValueFromFile 'rhn_username' ${JBOSS_NETWORK_API_CREDENTIAL_FILE})" -e rhn_password="$(readValueFromFile 'rhn_password' ${JBOSS_NETWORK_API_CREDENTIAL_FILE}) -e omit_rhn_output=false"
echo ' -e' rhn_username="$(readRHNUsername)" -e rhn_password="$(readRHNPassword) -e omit_rhn_output=false"
fi
}

readValueFromField() {
local field_name=${1}
local cred_file=${2:-"${JBOSS_NETWORK_API_CREDENTIAL_FILE}"}

readValueFromFile "${field_name}" "${cred_file}"
}

readRHNUsername() {
readValueFromField 'rhn_username'
}

readRHNPassword() {
readValueFromField 'rhn_password'
}

readValueFromFile() {
local field=${1}
local file=${2}
Expand Down
2 changes: 2 additions & 0 deletions ansible/molecule/molecule.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ done
# shellcheck disable=SC2155
readonly EXTRA_ARGS="$(loadJBossNetworkAPISecrets)"
export EXTRA_ARGS
export REDHAT_PRODUCT_DOWNLOAD_CLIENT_ID=$(readRHNUsername)
export REDHAT_PRODUCT_DOWNLOAD_CLIENT_SECRET=$(readRHNPassord)

printEnv
echo "Running Molecule test on project: ${JOB_NAME}..."
Expand Down

0 comments on commit 206415e

Please sign in to comment.