From 72bc07f1129f87c89166fec37c953509ebac9948 Mon Sep 17 00:00:00 2001 From: zscholl Date: Wed, 11 Mar 2020 14:54:58 -0500 Subject: [PATCH] get access key create date for cred report --- .gitignore | 1 + moto/iam/models.py | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index fb9bd51de..deb9d9840 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,4 @@ tests/file.tmp .eggs/ .mypy_cache/ *.tmp +.venv/ \ No newline at end of file diff --git a/moto/iam/models.py b/moto/iam/models.py index 08a1eb36a..dd197c872 100755 --- a/moto/iam/models.py +++ b/moto/iam/models.py @@ -680,14 +680,14 @@ class User(BaseModel): access_key_2_last_rotated = "N/A" elif len(self.access_keys) == 1: access_key_1_active = "true" - access_key_1_last_rotated = date_created.strftime(date_format) + access_key_1_last_rotated = self.access_keys[0].create_date.strftime(date_format) access_key_2_active = "false" access_key_2_last_rotated = "N/A" else: access_key_1_active = "true" - access_key_1_last_rotated = date_created.strftime(date_format) + access_key_1_last_rotated = self.access_keys[0].create_date.strftime(date_format) access_key_2_active = "true" - access_key_2_last_rotated = date_created.strftime(date_format) + access_key_2_last_rotated = self.access_keys[1].create_date.strftime(date_format) return "{0},{1},{2},{3},{4},{5},not_supported,false,{6},{7},{8},{9},false,N/A,false,N/A".format( self.name,