]> WPIA git - infra.git/commitdiff
upd: remove unneccesary quotes in [[
authorFelix Dörre <felix@dogcraft.de>
Sat, 3 Jun 2017 14:46:31 +0000 (16:46 +0200)
committerFelix Dörre <felix@dogcraft.de>
Fri, 9 Jun 2017 17:12:19 +0000 (19:12 +0200)
Word Splitting is disabled in [[ ]] expressions.

Change-Id: Ie2f4f229a84ea3acaa5a8a8ef814066ae1711504

commands
modules/hop/templates/commands.epp

index 4dd7f4d359c750410694ad7ac9b24544fc425586..6f6d00d7d19d1e7b74010adc4996e1b10db61b6b 100755 (executable)
--- a/commands
+++ b/commands
@@ -1,12 +1,12 @@
 #!/bin/bash
 com="$SSH_ORIGINAL_COMMAND"
-if [[ "$UID" == 0 ]]; then
+if [[ $UID == 0 ]]; then
     echo "Run script as non-root-user"
     exit
 fi
-if [[ "$com" == "update certs" || "$com" == "force update certs" ]]; then
+if [[ $com == "update certs" || $com == "force update certs" ]]; then
     force=false
-    if [[ "$com" == "force update certs" ]]; then
+    if [[ $com == "force update certs" ]]; then
         force=true
     fi
     folder=$(mktemp -d)
@@ -20,7 +20,7 @@ if [[ "$com" == "update certs" || "$com" == "force update certs" ]]; then
             openssl req -newkey rsa:4096 -subj "/CN=will-be-ignored" -nodes -out $folder/web.req -keyout $folder/web.key 2>/dev/null
             cat $folder/web.req
             read -r response
-            if [[ "$response" == "SUCCESS" ]]; then
+            if [[ $response == "SUCCESS" ]]; then
                 # read certificate count
                 read -r len
                 printf '' > $folder/web.crt
@@ -55,12 +55,12 @@ if [[ "$com" == "update certs" || "$com" == "force update certs" ]]; then
     [[ -f $folder/web.req ]] && rm $folder/web.req
     [[ -f $folder/web.key ]] && rm $folder/web.key
     rmdir $folder
-elif [[ "$com" == "reload certs" ]]; then
+elif [[ $com == "reload certs" ]]; then
     sudo puppet apply /etc/puppet/code/environments/production/manifests --verbose
     sudo lxc-attach -n front-nginx -- puppet agent --verbose --test
     sudo lxc-attach -n quiz -- puppet agent --verbose --test
     sudo lxc-attach -n gigi -- puppet agent --verbose --test
-elif [[ "$com" == "update crls" ]]; then
+elif [[ $com == "update crls" ]]; then
     if ! tar xv -C /data/crl; then
         echo "requiring tar"
         exit;
index 8cedfd94055612c4bb4c0c054b0308ee502919d6..7c91e146a67c644d541ac7e57e367f44f5d10cc0 100755 (executable)
@@ -1,12 +1,12 @@
 #!/bin/bash
 
 com="$SSH_ORIGINAL_COMMAND"
-if [[ "$com" == "update certs" || "$com" == "force update certs" ]]; then
+if [[ $com == "update certs" || $com == "force update certs" ]]; then
     exec ssh <%=$administrativeUser%>@10.0.3.1 "$com"
-elif [[ "$com" == "reload certs" ]]; then
+elif [[ $com == "reload certs" ]]; then
     # requires sudo --> requires terminal
     exec ssh -t <%=$administrativeUser%>@10.0.3.1 "reload certs"
-elif [[ "$com" == "update crls" ]]; then
+elif [[ $com == "update crls" ]]; then
     exec ssh  <%=$administrativeUser%>@10.0.3.1 "update crls"
 else
     echo $com