|
|
088c30 |
From ded01bd47c65636e59dc332d06fb8acb982ec677 Mon Sep 17 00:00:00 2001
|
|
|
088c30 |
From: Emanuele Giuseppe Esposito <eesposit@redhat.com>
|
|
|
088c30 |
Date: Fri, 14 Jan 2022 16:41:52 +0100
|
|
|
088c30 |
Subject: [PATCH 4/6] Update dscheck_VMware's rpctool check (#970)
|
|
|
088c30 |
|
|
|
088c30 |
RH-Author: Emanuele Giuseppe Esposito <eesposit@redhat.com>
|
|
|
088c30 |
RH-MergeRequest: 44: Datasource for VMware
|
|
|
088c30 |
RH-Commit: [4/6] 509f68596f2d8f32027677f756b9d81e6a507ff1
|
|
|
088c30 |
RH-Bugzilla: 2026587
|
|
|
088c30 |
RH-Acked-by: Mohamed Gamal Morsy <mmorsy@redhat.com>
|
|
|
088c30 |
RH-Acked-by: Eduardo Otubo <otubo@redhat.com>
|
|
|
088c30 |
|
|
|
088c30 |
commit 7781dec3306e9467f216cfcb36b7e10a8b38547a
|
|
|
088c30 |
Author: Shreenidhi Shedi <53473811+sshedi@users.noreply.github.com>
|
|
|
088c30 |
Date: Fri Aug 13 00:40:39 2021 +0530
|
|
|
088c30 |
|
|
|
088c30 |
Update dscheck_VMware's rpctool check (#970)
|
|
|
088c30 |
|
|
|
088c30 |
This patch updates the dscheck_VMware function's use of "vmware-rpctool".
|
|
|
088c30 |
|
|
|
088c30 |
When checking to see if a "guestinfo" property is set.
|
|
|
088c30 |
Because a successful exit code can occur even if there is an empty
|
|
|
088c30 |
string returned, it is possible that the VMware datasource will be
|
|
|
088c30 |
loaded as a false-positive. This patch ensures that in addition to
|
|
|
088c30 |
validating the exit code, the emitted output is also examined to ensure
|
|
|
088c30 |
a non-empty value is returned by rpctool before returning "${DS_FOUND}"
|
|
|
088c30 |
from "dscheck_VMware()".
|
|
|
088c30 |
|
|
|
088c30 |
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
|
|
|
088c30 |
---
|
|
|
088c30 |
tools/ds-identify | 15 +++++++++------
|
|
|
088c30 |
1 file changed, 9 insertions(+), 6 deletions(-)
|
|
|
088c30 |
|
|
|
088c30 |
diff --git a/tools/ds-identify b/tools/ds-identify
|
|
|
088c30 |
index c01eae3d..0e12298f 100755
|
|
|
088c30 |
--- a/tools/ds-identify
|
|
|
088c30 |
+++ b/tools/ds-identify
|
|
|
088c30 |
@@ -141,6 +141,7 @@ error() {
|
|
|
088c30 |
debug 0 "$@"
|
|
|
088c30 |
stderr "$@"
|
|
|
088c30 |
}
|
|
|
088c30 |
+
|
|
|
088c30 |
warn() {
|
|
|
088c30 |
set -- "WARN:" "$@"
|
|
|
088c30 |
debug 0 "$@"
|
|
|
088c30 |
@@ -344,7 +345,6 @@ geom_label_status_as() {
|
|
|
088c30 |
return $ret
|
|
|
088c30 |
}
|
|
|
088c30 |
|
|
|
088c30 |
-
|
|
|
088c30 |
read_fs_info_freebsd() {
|
|
|
088c30 |
local oifs="$IFS" line="" delim=","
|
|
|
088c30 |
local ret=0 labels="" dev="" label="" ftype="" isodevs=""
|
|
|
088c30 |
@@ -404,7 +404,6 @@ cached() {
|
|
|
088c30 |
[ -n "$1" ] && _RET="$1" && return || return 1
|
|
|
088c30 |
}
|
|
|
088c30 |
|
|
|
088c30 |
-
|
|
|
088c30 |
detect_virt() {
|
|
|
088c30 |
local virt="${UNAVAILABLE}" r="" out=""
|
|
|
088c30 |
if [ -d /run/systemd ]; then
|
|
|
088c30 |
@@ -450,7 +449,7 @@ detect_virt() {
|
|
|
088c30 |
read_virt() {
|
|
|
088c30 |
cached "$DI_VIRT" && return 0
|
|
|
088c30 |
detect_virt
|
|
|
088c30 |
- DI_VIRT=${_RET}
|
|
|
088c30 |
+ DI_VIRT="$(echo "${_RET}" | tr '[:upper:]' '[:lower:]')"
|
|
|
088c30 |
}
|
|
|
088c30 |
|
|
|
088c30 |
is_container() {
|
|
|
088c30 |
@@ -1370,16 +1369,20 @@ vmware_has_rpctool() {
|
|
|
088c30 |
command -v vmware-rpctool >/dev/null 2>&1
|
|
|
088c30 |
}
|
|
|
088c30 |
|
|
|
088c30 |
+vmware_rpctool_guestinfo() {
|
|
|
088c30 |
+ vmware-rpctool "info-get guestinfo.${1}" 2>/dev/null | grep "[[:alnum:]]"
|
|
|
088c30 |
+}
|
|
|
088c30 |
+
|
|
|
088c30 |
vmware_rpctool_guestinfo_metadata() {
|
|
|
088c30 |
- vmware-rpctool "info-get guestinfo.metadata"
|
|
|
088c30 |
+ vmware_rpctool_guestinfo "metadata"
|
|
|
088c30 |
}
|
|
|
088c30 |
|
|
|
088c30 |
vmware_rpctool_guestinfo_userdata() {
|
|
|
088c30 |
- vmware-rpctool "info-get guestinfo.userdata"
|
|
|
088c30 |
+ vmware_rpctool_guestinfo "userdata"
|
|
|
088c30 |
}
|
|
|
088c30 |
|
|
|
088c30 |
vmware_rpctool_guestinfo_vendordata() {
|
|
|
088c30 |
- vmware-rpctool "info-get guestinfo.vendordata"
|
|
|
088c30 |
+ vmware_rpctool_guestinfo "vendordata"
|
|
|
088c30 |
}
|
|
|
088c30 |
|
|
|
088c30 |
dscheck_VMware() {
|
|
|
088c30 |
--
|
|
|
088c30 |
2.27.0
|
|
|
088c30 |
|