Update after code review

Simplified local variable declaration as suggested by phenixblue.

Signed-off-by: Joakim Roubert <joakim.roubert@axis.com>
This commit is contained in:
Joakim Roubert 2020-05-13 22:29:52 +02:00 committed by Joakim Roubert
parent 1f9704c713
commit 3fb0d1c15d

View File

@ -246,13 +246,12 @@ function get-or-generate-uuid(){
fi fi
# each line of the ssdmap looks like "${device} persistent-uuid" # each line of the ssdmap looks like "${device} persistent-uuid"
local myuuid
if grep -q "${device}" "${ssdmap}"; then if grep -q "${device}" "${ssdmap}"; then
#create symlink based on saved uuid #create symlink based on saved uuid
local myuuid
myuuid=$(grep "${device}" "${ssdmap}" | cut -d ' ' -f 2) myuuid=$(grep "${device}" "${ssdmap}" | cut -d ' ' -f 2)
else else
# generate new uuid and add it to the map # generate new uuid and add it to the map
local myuuid
if ! myuuid=$(uuidgen); then if ! myuuid=$(uuidgen); then
echo "Failed to generate valid UUID with uuidgen" >&2 echo "Failed to generate valid UUID with uuidgen" >&2
exit 2 exit 2