diff options
author | Scott Moser <smoser@brickies.net> | 2017-03-27 12:43:15 -0400 |
---|---|---|
committer | Scott Moser <smoser@brickies.net> | 2017-03-27 16:43:25 -0400 |
commit | 328fe5ab399b1f5b48d1985f41fc2ef66e368922 (patch) | |
tree | 97408b3b7d18aa783d55d9f3c522026e661a326d /tools | |
parent | 21632972df034c200578e1fbc121a07f20bb8774 (diff) | |
download | vyos-cloud-init-328fe5ab399b1f5b48d1985f41fc2ef66e368922.tar.gz vyos-cloud-init-328fe5ab399b1f5b48d1985f41fc2ef66e368922.zip |
GCE: Search GCE in ds-identify, consider serial number in check.
While documentation indicates that the smbios product name should
contain 'Google Compute Engine', experimentation and bug reports
indicate that is not always the case. The change here is to change
the check for GCE to also consider a serial number that starts with
'GoogleCompute-'.
Also, ds-identify was not currently searching for GCE if no config of
datasource_list was found. Most images have a datasource_list defined.
So update the list to include GCE.
LP: #1674861
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/ds-identify | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/tools/ds-identify b/tools/ds-identify index bf09a3ad..15d6600e 100755 --- a/tools/ds-identify +++ b/tools/ds-identify @@ -108,7 +108,7 @@ DI_DSNAME="" # this has to match the builtin list in cloud-init, it is what will # be searched if there is no setting found in config. DI_DSLIST_DEFAULT="MAAS ConfigDrive NoCloud AltCloud Azure Bigstep \ -CloudSigma CloudStack DigitalOcean Ec2 OpenNebula OpenStack OVF SmartOS" +CloudSigma CloudStack DigitalOcean Ec2 GCE OpenNebula OpenStack OVF SmartOS" DI_DSLIST="" DI_MODE="" DI_ON_FOUND="" @@ -383,6 +383,14 @@ dmi_product_name_matches() { return 1 } +dmi_product_serial_matches() { + is_container && return 1 + case "${DI_DMI_PRODUCT_SERIAL}" in + $1) return 0;; + esac + return 1 +} + dmi_product_name_is() { is_container && return 1 [ "${DI_DMI_PRODUCT_NAME}" = "$1" ] @@ -770,6 +778,10 @@ dscheck_GCE() { if dmi_product_name_is "Google Compute Engine"; then return ${DS_FOUND} fi + # product name is not guaranteed (LP: #1674861) + if dmi_product_serial_matches "GoogleCloud-*"; then + return ${DS_FOUND} + fi return ${DS_NOT_FOUND} } |