Commit 0a2f849f authored by brad kittenbrink's avatar brad kittenbrink
Browse files

Merge. new failing test now passes.

parents cf75b1b9 8c2464f3
......@@ -216,17 +216,19 @@ def _load_s3curl_credentials(account_name = 'lindenlab', credentials_file=None):
credentials_path = os.path.expandvars("$HOME/.s3curl")
# *HACK - half-assed regex for parsing the perl hash that s3curl.pl stores its credentials in
credentials_pattern = '%s\s*=>\s*{\s*id\s*=>\s*\'(\w*)\'\s*,\s*key\s*=>\s*\'(\w*)\',\s*}' % account_name
credentials_pattern = '%s\s*=>\s*{\s*id\s*=>\s*\'([^\']*)\'\s*,\s*key\s*=>\s*\'([^\']*)\',\s*}' % account_name
try:
if not credentials_file:
credentials_file = open(credentials_path)
s3curl_text = credentials_file.read()
m = re.search(credentials_pattern, s3curl_text)
m = re.search(credentials_pattern, s3curl_text, re.MULTILINE)
creds = dict(id=m.group(1), key=m.group(2))
return creds
except (IOError, AttributeError), err:
except IOError, err:
# IOError happens when ~/.s3curl is missing
raise S3ConnectionError("failed to find s3 credentials in '%s' -- see the README file in the s3curl distribution (http://developer.amazonwebservices.com/connect/entry.jspa?externalID=128)'" % credentials_path)
except AttributeError, err:
# AttributeError happens when regex doesn't find a match
raise S3ConnectionError("failed to load s3 credentials from '%s' -- see the README file in the s3curl distribution (http://developer.amazonwebservices.com/connect/entry.jspa?externalID=128)'" % credentials_path)
raise S3ConnectionError("failed to parse s3 credentials from '%s' -- see the README file in the s3curl distribution (http://developer.amazonwebservices.com/connect/entry.jspa?externalID=128)'" % credentials_path)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment