mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Fix updating __AssumeCache
while iterating over it
This commit is contained in:
parent
560ab52ccf
commit
219e6fdb1a
1 changed files with 3 additions and 2 deletions
|
@ -8,6 +8,7 @@ This is a base library used by a number of AWS services.
|
|||
:depends: requests
|
||||
"""
|
||||
|
||||
import copy
|
||||
import hashlib
|
||||
import hmac
|
||||
import logging
|
||||
|
@ -230,9 +231,9 @@ def assumed_creds(prov_dict, role_arn, location=None):
|
|||
# current time in epoch seconds
|
||||
now = time.mktime(datetime.utcnow().timetuple())
|
||||
|
||||
for key, creds in __AssumeCache__.items():
|
||||
for key, creds in copy.deepcopy(__AssumeCache__).items():
|
||||
if (creds["Expiration"] - now) <= 120:
|
||||
__AssumeCache__[key].delete()
|
||||
del __AssumeCache__[key]
|
||||
|
||||
if role_arn in __AssumeCache__:
|
||||
c = __AssumeCache__[role_arn]
|
||||
|
|
Loading…
Add table
Reference in a new issue