Fix: bashate E011 warnings 73/67573/12
authorGuillaume Lambert <guillaume.lambert@orange.com>
Tue, 4 May 2021 09:01:41 +0000 (11:01 +0200)
committerGuillaume Lambert <guillaume.lambert@orange.com>
Tue, 11 May 2021 19:24:52 +0000 (21:24 +0200)
E011 rule ensures consistency of "then" directive being on the same line
as it's condition.
This is similar to E010 in the previous commit
but to ensure the consistency of if/elif statements.

Signed-off-by: Guillaume Lambert <guillaume.lambert@orange.com>
Change-Id: I6d3ff5b468fa47948b0123c017980e00a94cf82f

shell/docker-login.sh
shell/npm-config.sh
shell/openstack-kubernetes-create.sh
shell/package-listing.sh
shell/sysstat.sh

index 751ac20..d172a3b 100644 (file)
@@ -61,14 +61,12 @@ set_creds() {
     USER=$(echo "$CREDENTIAL" | cut -f1 -d:)
     PASS=$(echo "$CREDENTIAL" | cut -f2 -d:)
 
-    if [ -z "$USER" ]
-    then
+    if [ -z "$USER" ]; then
         echo "ERROR: No user provided"
         return 1
     fi
 
-    if [ -z "$PASS" ]
-    then
+    if [ -z "$PASS" ]; then
         echo "ERROR: No password provided"
         return 1
     fi
@@ -92,8 +90,7 @@ do_login() {
 ### Main ###
 
 # Loop through Registry and Ports to concatentate and login to nexus
-if [ "${DOCKER_REGISTRY:-none}" != 'none' ]
-then
+if [ "${DOCKER_REGISTRY:-none}" != 'none' ]; then
     for PORT in $REGISTRY_PORTS; do
         REGISTRY="${DOCKER_REGISTRY}:${PORT}"
 
@@ -105,11 +102,9 @@ then
 fi
 
 # Login to docker.io after determining if email is needed.
-if [ "${DOCKERHUB_REGISTRY:-none}" != 'none' ]
-then
+if [ "${DOCKERHUB_REGISTRY:-none}" != 'none' ]; then
     set_creds "$DOCKERHUB_REGISTRY"
-    if [ "${DOCKERHUB_EMAIL:-none}" != 'none' ]
-    then
+    if [ "${DOCKERHUB_EMAIL:-none}" != 'none' ]; then
         do_login "$DOCKERHUB_REGISTRY" "$DOCKERHUB_EMAIL"
     else
         do_login "$DOCKERHUB_REGISTRY" none
index 9684502..06bf5d1 100644 (file)
@@ -39,14 +39,12 @@ do_config() {
     USER=$(echo "$CREDENTIAL" | cut -f1 -d:)
     PASS=$(echo "$CREDENTIAL" | cut -f2 -d:)
 
-    if [ -z "$USER" ]
-    then
+    if [ -z "$USER" ]; then
         echo "ERROR: No user provided"
         return 1
     fi
 
-    if [ -z "$PASS" ]
-    then
+    if [ -z "$PASS" ]; then
         echo "ERROR: No password provided"
         return 1
     fi
index e94dc94..3d9d00b 100755 (executable)
@@ -64,8 +64,7 @@ while [ "$(openstack --os-cloud "$os_cloud" coe cluster show "$cluster_uuid" -c
   sleep 2m
 done
 
-if [ "$(openstack --os-cloud "$os_cloud" coe cluster show "$cluster_uuid" -c status -f value)" == "CREATE_FAILED" ]
-then
+if [ "$(openstack --os-cloud "$os_cloud" coe cluster show "$cluster_uuid" -c status -f value)" == "CREATE_FAILED" ]; then
   echo "Failed to create cluster: $cluster_uuid $(date)"
   openstack --os-cloud "$os_cloud" coe cluster delete "$cluster_uuid"
   sleep 5m
@@ -73,7 +72,6 @@ then
   exit 1
 fi
 
-if [ "$(openstack --os-cloud "$os_cloud" coe cluster show "$cluster_uuid" -c status -f value)" == "CREATE_COMPLETE" ]
-then
+if [ "$(openstack --os-cloud "$os_cloud" coe cluster show "$cluster_uuid" -c status -f value)" == "CREATE_COMPLETE" ]; then
   echo "Successfully created cluster: $cluster_uuid."
 fi
index 3760325..c0b5476 100755 (executable)
@@ -28,8 +28,7 @@ DIFF_PACKAGES=/tmp/packages_diff.txt
 # Swap to creating END_PACKAGES if we are running in a CI job (determined by if
 # we have a workspace env) or if the starting packages listing already exists.
 PACKAGES="${START_PACKAGES}"
-if [ "${workspace}" ] || [ -f "${START_PACKAGES}" ]
-then
+if [ "${workspace}" ] || [ -f "${START_PACKAGES}" ]; then
     PACKAGES="${END_PACKAGES}"
 fi
 
@@ -47,16 +46,14 @@ case "${OS_FAMILY}" in
     ;;
 esac
 
-if [ -f "${START_PACKAGES}" ] && [ -f "${END_PACKAGES}" ]
-then
+if [ -f "${START_PACKAGES}" ] && [ -f "${END_PACKAGES}" ]; then
     # ` || true` Ignore exit code because diff exits 1 when there is a diff
     diff "${START_PACKAGES}" "${END_PACKAGES}" > "${DIFF_PACKAGES}" || true
 fi
 
 # If running in a Jenkins job, then copy the created files to the archives
 # location
-if [ "${workspace}" ]
-then
+if [ "${workspace}" ]; then
     mkdir -p "${workspace}/archives/"
     cp -f /tmp/packages_*.txt "${workspace}/archives/"
 fi
index e071ad1..c72e23a 100644 (file)
@@ -22,7 +22,7 @@ case "$OS" in
                 fi
                 ;;
             14.04)
-                if [[ ! -f /etc/default/sysstat ]] ||
+                if [[ ! -f /etc/default/sysstat ]] || \
                       ! grep --quiet 'ENABLED="true"' /etc/default/sysstat; then
                     exit 0
                 fi