From e7978f5671c8266759b325ee8036b8394191489f Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Mon, 15 Jun 2020 15:07:15 +0000 Subject: [PATCH] gcloud: Add function to detect whether we are running on GCP Signed-off-by: Michael Tremer --- config/cfgroot/general-functions.pl | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/config/cfgroot/general-functions.pl b/config/cfgroot/general-functions.pl index 6ddad28d0d..376b6a09a9 100644 --- a/config/cfgroot/general-functions.pl +++ b/config/cfgroot/general-functions.pl @@ -1296,4 +1296,12 @@ sub running_on_ec2() { return 0; } +sub running_on_gcp() { + if (-e "/var/run/gcp-instance-id") { + return 1; + } + + return 0; +} + 1; -- 2.39.2