#21 Use local vars in shell functions to avoid scoping issue
Merged 8 years ago by pbrobinson. Opened 8 years ago by maxamillion.
maxamillion/releng global-function-var-cleanup  into  master

file modified
+2 -2
@@ -75,8 +75,8 @@ 

  done

  

  set_ostree_kickstart() {

-     ks=$1

-     url=$2

+     local ks=$1

+     local url=$2

      sed -i -e "s|--url=[^ ]*|--url=\"${url}\"|g" ${ks}

      sed -i -e "s|ostree remote add.*|ostree remote add --set=gpg-verify=false fedora-atomic '"${url}"'|g" ${ks}

  }

file modified
+3 -3
@@ -51,14 +51,14 @@ 

  touch "${logfile}"

  function log()

  {

-     message="${1}"

+     local message="${1}"

      echo "$(date --utc) build${DIST}: ${message}" | tee -a "${logfile}" >&2

  }

  

  function send_fedmsg()

  {

-     log="${1}"

-     topic="${2}"

+     local log="${1}"

+     local topic="${2}"

      # Emit a message using bodhi's cert (since we should be running as "masher").

      echo "{\"log\": \"${log}\", \"branch\": \"$BRANCHED\", \"arch\": \"$ARCH\"}" | fedmsg-logger \

          --cert-prefix bodhi \

no initial comment