Skip to content

Commit

Permalink
scylla_util.py: On is_gce(), return False when it's on GKE
Browse files Browse the repository at this point in the history
GKE metadata server does not provide same metadata as GCE, we should not
return True on is_gce().
So try to fetch machine-type from metadata server, return False if it
404 not found.

Fixes scylladb#9471

Signed-off-by: Takuya ASADA <[email protected]>

Closes scylladb#9582
  • Loading branch information
syuu1228 authored and avikivity committed Nov 4, 2021
1 parent a64458e commit 9b4cf8c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions dist/common/scripts/scylla_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,11 @@ def is_gce_instance():
if af == socket.AF_INET:
addr, port = sa
if addr == "169.254.169.254":
# Make sure it is not on GKE
try:
gcp_instance().__instance_metadata("machine-type")
except urllib.error.HTTPError:
return False
return True
return False

Expand Down

0 comments on commit 9b4cf8c

Please sign in to comment.