Skip to content

Commit 4c46997

Browse files
committed
chore: check extracted partition value is a number
1 parent 9da2671 commit 4c46997

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

ansible/files/admin_api_scripts/grow_fs.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ fi
2121
# └─nvme0n1p3 / -> nvme0n1p3 -> 3
2222
ROOT_PARTITION_NUMBER=$(lsblk -no NAME,MOUNTPOINT | grep ' /$' | awk '{print $1;}' | sed 's/.*nvme[0-9]n[0-9]p//g')
2323

24+
if ! [[ "$ROOT_PARTITION_NUMBER" =~ ^[0-9]+$ ]]; then
25+
echo "Error: ROOT_PARTITION_NUMBER is not a valid number: $ROOT_PARTITION_NUMBER"
26+
exit 1
27+
fi
28+
2429
if [ -b /dev/nvme1n1 ] ; then
2530
if [[ "${VOLUME_TYPE}" == "data" ]]; then
2631
resize2fs /dev/nvme1n1

0 commit comments

Comments
 (0)