Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ffea40a

Browse filesBrowse files
authored
added warning message for virtual addressing style in aws/config (#41)
1 parent 1a0f54c commit ffea40a
Copy full SHA for ffea40a

File tree

Expand file treeCollapse file tree

1 file changed

+27
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+27
-0
lines changed
Open diff view settings
Collapse file

‎bin/awslocal‎

Copy file name to clipboardExpand all lines: bin/awslocal
+27Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import re
2424
from threading import Thread
2525

2626
PARENT_FOLDER = os.path.realpath(os.path.join(os.path.dirname(__file__), '..'))
27+
S3_VIRTUAL_ENDPOINT_HOSTNAME = 's3.localhost.localstack.cloud'
2728
if os.path.isdir(os.path.join(PARENT_FOLDER, '.venv')):
2829
sys.path.insert(0, PARENT_FOLDER)
2930

@@ -153,6 +154,32 @@ def run_in_process():
153154
Modifies the command line args in sys.argv and calls the AWS cli
154155
method directly in this process.
155156
"""
157+
profile_name = (
158+
sys.argv[sys.argv.index('--profile') + 1] if '--profile' in sys.argv else 'default')
159+
160+
endpoint_url = (
161+
sys.argv[sys.argv.index('--endpoint-url') + 1] if '--endpoint-url' in sys.argv else '')
162+
163+
if not endpoint_url:
164+
endpoint_url = (
165+
sys.argv[sys.argv.index('--endpoint') + 1] if '--endpoint' in sys.argv else '')
166+
167+
import botocore.session
168+
169+
session = botocore.session.get_session()
170+
171+
if S3_VIRTUAL_ENDPOINT_HOSTNAME not in endpoint_url:
172+
try:
173+
profiles = session.full_config.get('profiles')
174+
if profiles:
175+
current_profile = profiles.get(profile_name)
176+
if (current_profile['s3'].get('addressing_style') in ['virtual', 'auto']):
177+
msg = 'Addressing style is being set to \'virtual\' or \'auto\' in the aws config.' + \
178+
' Please change it to the \'path\'.'
179+
print('WARNING: %s' % msg)
180+
except KeyError:
181+
pass
182+
156183
import awscli.clidriver
157184
if os.environ.get('LC_CTYPE', '') == 'UTF-8':
158185
os.environ['LC_CTYPE'] = 'en_US.UTF-8'

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.