Skip to content

Commit

Permalink
Prevent S3 information on non-S3 mirrors
Browse files Browse the repository at this point in the history
Switch from looking at the presence of the S3 information keys to
determine if the dictionary URL is used to instead look at the value
in the keys.

Add s3_endpoint_url as an additional key value for the S3 information.
  • Loading branch information
josephsnyder committed Nov 29, 2021
1 parent 54d88f1 commit e88bd22
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/spack/spack/mirror.py
Expand Up @@ -528,9 +528,10 @@ def add(name, url, scope, args={}):

items = [(n, u) for n, u in mirrors.items()]
mirror_data = url
key_values = ["s3_access_key_id", "s3_access_token", "s3_profile"]
key_values = ["s3_access_key_id", "s3_access_token", "s3_profile", "s3_endpoint_url"]
# On creation, assume connection data is set for both
if any(value for value in key_values if value in args):
# Check for value in each key, instead of presence of each key
if any(vars(args)[value] for value in key_values if value in args):
url_dict = {"url": url,
"access_pair": (args.s3_access_key_id, args.s3_access_key_secret),
"access_token": args.s3_access_token,
Expand Down

0 comments on commit e88bd22

Please sign in to comment.