Skip to content

Commit

Permalink
Merge pull request #30849 from jfindlay/aws_seconds
Browse files Browse the repository at this point in the history
utils.aws: use time lib to conver to epoch seconds
  • Loading branch information
Mike Place committed Feb 3, 2016
2 parents 4cbc8a8 + 17ae74d commit 276cf62
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion salt/utils/aws.py
Expand Up @@ -153,7 +153,9 @@ def sig2(method, endpoint, params, provider, aws_api_version):
def assumed_creds(prov_dict, role_arn, location=None):
valid_session_name_re = re.compile("[^a-z0-9A-Z+=,.@-]")

now = (datetime.utcnow() - datetime(1970, 1, 1)).total_seconds()
# current time in epoch seconds
now = time.mktime(datetime.utcnow().timetuple())

for key, creds in __AssumeCache__.items():
if (creds["Expiration"] - now) <= 120:
__AssumeCache__.delete(key)
Expand Down

0 comments on commit 276cf62

Please sign in to comment.