DistroInvetory Fixed bug in VM parsing

Bug prevented stoped VM's form being added to the reported
This commit is contained in:
2023-11-20 00:06:20 +01:00
parent 092fcb1812
commit d54af4ae78
2 changed files with 3 additions and 3 deletions

View File

@@ -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

View File

@@ -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
}