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