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