From d54af4ae78ac038d9675a051682ba63a47d93c71 Mon Sep 17 00:00:00 2001 From: Bram Prieshof Date: Mon, 20 Nov 2023 00:06:20 +0100 Subject: [PATCH] DistroInvetory Fixed bug in VM parsing Bug prevented stoped VM's form being added to the reported --- DistroInventory.sh | 2 +- functions.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/DistroInventory.sh b/DistroInventory.sh index 663db3a..e50ece8 100644 --- a/DistroInventory.sh +++ b/DistroInventory.sh @@ -46,9 +46,9 @@ if $CheckVM; then echo "$TYPE,$ID,$NAME,$STATUS,$DISTRO,$VERSION" | tee -a $InventoryFile else OSRELEASE=$(qm guest exec $ID -- cat /etc/os-release |jq -r '.["out-data"]') - ParseOSRelease fi fi + ParseOSRelease unset OSRELEASE OSYPE ID NAME STATUS DISTRO VERSION done unset TYPE diff --git a/functions.sh b/functions.sh index 3f3de0f..ff4e9f0 100644 --- a/functions.sh +++ b/functions.sh @@ -220,8 +220,8 @@ ParseOSRelease() VERSION="$VERSION ($VERSIONNAME)" fi else - DISTRO=N/A - VERSION=N/A + if [ -z ${DISTRO+x} ]; then local DISTRO=N/A;fi + if [ -z ${VERSION+x} ]; then local VERSION=N/A;fi fi echo "$TYPE,$ID,$NAME,$STATUS,$DISTRO,$VERSION" | tee -a $InventoryFile } \ No newline at end of file