Skip to content

Commit 9d993bd

Browse files
committed
Story #15673: Trying to avoid "career-ender" problems.
1 parent 1689feb commit 9d993bd

File tree

4 files changed

+18
-18
lines changed

4 files changed

+18
-18
lines changed

deployment/pki/scripts/lib/ca.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ function generate_ca_intermediate {
9292
function init_config_ca {
9393
local CA_DIR="${1}"
9494

95-
# Suppression de la configuration existante.
96-
rm -Rf "${CONFIG_DIR}/${CA_DIR}"
95+
# Deleting existing configuration but fail if variables are undefined
96+
rm -vRf "${CONFIG_DIR:?}/${CA_DIR:?}"
9797
mkdir -p "${CONFIG_DIR}/${CA_DIR}"
9898
touch "${CONFIG_DIR}/${CA_DIR}/index.txt"
9999
echo '01' > "${CONFIG_DIR}/${CA_DIR}/serial"
@@ -132,11 +132,11 @@ function main() {
132132
if [ "${ERASE}" == "true" ]; then
133133
if [ -d ${CA_DIR} ]; then
134134
# We remove all generated CA
135-
find "${CA_DIR}/" -mindepth 1 -maxdepth 1 -type d -exec rm -Rf {} \;
135+
find "${CA_DIR:?}/" -mindepth 1 -maxdepth 1 -type d -exec rm -vRf {} \;
136136
fi
137137
if [ -d ${CONFIG_DIR} ]; then
138138
# We remove all configurations linked to CA (except main config files)
139-
find "${CONFIG_DIR}/" -mindepth 1 -maxdepth 1 -type d -exec rm -Rf {} \;
139+
find "${CONFIG_DIR:?}/" -mindepth 1 -maxdepth 1 -type d -exec rm -vRf {} \;
140140
fi
141141
fi
142142

@@ -184,7 +184,7 @@ function main() {
184184
if [ -d ${TEMP_CERTS} ]; then
185185
pki_logger "=============================================="
186186
pki_logger "Cleaning of temporary tempcerts directories"
187-
rm -Rf ${TEMP_CERTS}
187+
rm -vRf ${TEMP_CERTS:?}
188188
fi
189189
pki_logger "=============================================="
190190
pki_logger "End of CA creation procedure"

deployment/pki/scripts/lib/certs.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -284,10 +284,10 @@ function main {
284284
if [ "${ERASE}" == "true" ]; then
285285
if [ -d ${CERTIFICATE_DIR} ]; then
286286
# We remove all generated certs
287-
find ${CERTIFICATE_DIR} -type f -name *.crt -exec rm -f {} \;
288-
find ${CERTIFICATE_DIR} -type f -name *.key -exec rm -f {} \;
289-
find ${CERTIFICATE_DIR} -type f -name *.pem -exec rm -f {} \;
290-
find ${CERTIFICATE_DIR} -type d -empty -delete
287+
find ${CERTIFICATE_DIR:?} -type f -name *.crt -exec rm -vf {} \;
288+
find ${CERTIFICATE_DIR:?} -type f -name *.key -exec rm -vf {} \;
289+
find ${CERTIFICATE_DIR:?} -type f -name *.pem -exec rm -vf {} \;
290+
find ${CERTIFICATE_DIR:?} -type d -empty -delete
291291
fi
292292
fi
293293
if [ ! -d ${CERTIFICATE_DIR} ]; then
@@ -304,7 +304,7 @@ function main {
304304
if [ -d ${TEMP_CERTS} ]; then
305305
pki_logger "=============================================="
306306
pki_logger "Cleaning of temporary tempcerts directories"
307-
rm -Rf ${TEMP_CERTS}
307+
rm -vRf ${TEMP_CERTS:?}
308308
fi
309309
pki_logger "=============================================="
310310
pki_logger "End of certificates creation procedure"

deployment/pki/scripts/lib/commons.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ function purge_directory {
4545
return 1
4646
fi
4747

48-
find "${DIR_TO_PURGE}" -type f -name "*.attr" -exec rm -f {} \;
49-
find "${DIR_TO_PURGE}" -type f -name "*.old" -exec rm -f {} \;
50-
find "${DIR_TO_PURGE}" -type f -name "*.req" -exec rm -f {} \;
48+
find "${DIR_TO_PURGE:?}" -type f -name "*.attr" -exec rm -vf {} \;
49+
find "${DIR_TO_PURGE:?}" -type f -name "*.old" -exec rm -vf {} \;
50+
find "${DIR_TO_PURGE:?}" -type f -name "*.req" -exec rm -vf {} \;
5151
}
5252

5353
function generatePassphrase {

deployment/pki/scripts/lib/stores.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ function generateTrustStore {
120120
fi
121121

122122
if [ -f "${TRUST_STORE}" ]; then
123-
rm -vf "${TRUST_STORE}"
123+
rm -vf "${TRUST_STORE:?}"
124124
fi
125125

126126
# Add the public client ca certificates to the truststore
@@ -201,7 +201,7 @@ function generateHostKeystore {
201201
local TMP_P12_PASSWORD="${6}"
202202

203203
if [ -f ${KEYSTORE} ]; then
204-
rm -f ${KEYSTORE}
204+
rm -vf ${KEYSTORE:?}
205205
fi
206206

207207
pki_logger "Generate p12"
@@ -220,7 +220,7 @@ function generateHostKeystore {
220220
if [ "${DEV_MODE}" != "true" ]; then
221221
if [ -f ${P12_KEYSTORE} ]; then
222222
pki_logger " /!\ Delete p12: ${P12_KEYSTORE}"
223-
rm -vf ${P12_KEYSTORE}
223+
rm -vf ${P12_KEYSTORE:?}
224224
fi
225225
fi
226226
}
@@ -255,7 +255,7 @@ function main() {
255255
initVault keystores ${ERASE}
256256

257257
# Remove old keystores & servers directories
258-
find ${REPERTOIRE_KEYSTORES} -mindepth 1 -maxdepth 1 -type d -exec rm -vrf {} \;
258+
find ${REPERTOIRE_KEYSTORES:?} -mindepth 1 -maxdepth 1 -type d -exec rm -vrf {} \;
259259

260260
# Generate the server keystores for vitamui-services except ui- components
261261
for COMPONENT in $(ls ${CERTIFICATE_DIR}/vitamui-services/server/ | grep -v -e "README" -e "^ui-" ); do
@@ -307,7 +307,7 @@ function main() {
307307
if [ "${DEV_MODE}" != "true" ]; then
308308
if [ -f ${P12_KEYSTORE} ]; then
309309
pki_logger " /!\ Delete p12: ${P12_KEYSTORE}"
310-
rm -vf ${P12_KEYSTORE}
310+
rm -vf ${P12_KEYSTORE:?}
311311
fi
312312
fi
313313

0 commit comments

Comments
 (0)