Fix remove volume time format 72/10072/1
authorThanh Ha <thanh.ha@linuxfoundation.org>
Tue, 17 Apr 2018 18:56:11 +0000 (14:56 -0400)
committerThanh Ha <thanh.ha@linuxfoundation.org>
Tue, 17 Apr 2018 18:56:14 +0000 (14:56 -0400)
Created_at also uses a different time format that needs to be
addressed.

Change-Id: I5618a5f1ce3fdf0d49ce01cbad47683cf8e02762
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
lftools/openstack/volume.py

index 0b94d56..a3da966 100644 (file)
@@ -86,7 +86,7 @@ def remove(os_cloud, volume_name, minutes=0):
         print("ERROR: volume not found.")
         sys.exit(1)
 
-    if (datetime.strptime(volume.created_at, '%Y-%m-%dT%H:%M:%SZ')
+    if (datetime.strptime(volume.created_at, '%Y-%m-%dT%H:%M:%S.%f')
             >= datetime.utcnow() - timedelta(minutes=minutes)):
         print('WARN: volume "{}" is not older than {} minutes.'.format(
             volume.name, minutes))