Commit 5632629b authored by Arie Peterson's avatar Arie Peterson 🐚
Browse files

Do a sanity check on the disk_slot received from Cosmos2 by the driver

parent 1d6d6cb1
......@@ -134,6 +134,18 @@ domount() {
debug "disk_slot: $diskSlot"
# Do a sanity check on the disk slot number.
if ! [[ "$diskSlot" =~ ^[0-9]+$ ]]
errorMessage="disk_slot is not a non-negative integer: $diskSlot"
exitWithFailure "$errorMessage"
if [[ $diskSlot -eq 0 ]]
errorMessage="disk_slot is 0; we refuse to mount /dev/xvda1 as that is usually the OS disk!"
exitWithFailure "$errorMessage"
# Convert numeric disk slot index to device letter, so
# 0 becomes a, 1 becomes b, etc.
diskLetter=$(printf \\$(printf '%03o' $((97 + $diskSlot))))
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment