def iam_client(self):
if not self.iam:
for attempt in count():
try:
self.iam = boto3.client('iam')
break
except DataNotFoundError as e:
logging.exception('DataNotFoundError when trying to get the iam client.')
t = self.retry_policy(attempt)
if t is None:
logging.info('Not retrying')
raise LambdaInvocationException('Exhausted retries getting iam client')
logging.info('Retrying in {} seconds'.format(t))
sleep(t)
logging.info('Retrying now')
return self.iam
评论列表
文章目录