Skip to content

Commit

Permalink
apply feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
idanovinda committed Apr 8, 2024
1 parent 33fc301 commit e3f3146
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions postgres-appliance/scripts/configure_spilo.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,10 +412,7 @@ def get_provider():
return PROVIDER_GOOGLE
else:
# accessible on Openstack, will fail on AWS
r = requests.get(
url='http://169.254.169.254/openstack/latest/meta_data.json',
headers={'X-aws-ec2-metadata-token': token}
)
r = requests.get('http://169.254.169.254/openstack/latest/meta_data.json')
if r.ok:
# make sure the response is parsable - https://github.com/Azure/aad-pod-identity/issues/943 and
# https://github.com/zalando/spilo/issues/542
Expand Down Expand Up @@ -465,15 +462,7 @@ def get_instance_metadata(provider):
# Try get IP via OpenStack EC2-compatible API, if can't then fail back to auto-discovered one.
metadata['id'] = openstack_metadata['uuid']
url = 'http://169.254.169.254/2009-04-04/meta-data'
response = requests.put(
url='http://169.254.169.254/latest/api/token',
headers={'X-aws-ec2-metadata-token-ttl-seconds': '60'}
)
token = response.text
r = requests.get(
url=url,
headers={'X-aws-ec2-metadata-token': token}
)
r = requests.get(url)
if r.ok:
mapping.update({'ip': 'local-ipv4', 'id': 'instance-id'})
else:
Expand Down

0 comments on commit e3f3146

Please sign in to comment.