lib/core/controlplane.rb in cpl-2.2.0 vs lib/core/controlplane.rb in cpl-2.2.1

- old
+ new

@@ -37,13 +37,12 @@ perform!(cmd) end # image - def latest_image(a_gvc = gvc, a_org = org, refresh: false) + def latest_image(a_gvc = gvc, a_org = org) @latest_image ||= {} - @latest_image[a_gvc] = nil if refresh @latest_image[a_gvc] ||= begin items = query_images(a_gvc, a_org)["items"] latest_image_from(items, app_name: a_gvc) end @@ -67,10 +66,10 @@ # Or special string to indicate no image available if matching_items.empty? name_only ? "#{app_name}:#{NO_IMAGE_AVAILABLE}" : nil else - latest_item = matching_items.max_by { |item| extract_image_number(item["name"]) } + latest_item = matching_items.max_by { |item| DateTime.parse(item["created"]) } name_only ? latest_item["name"] : latest_item end end def extract_image_number(image_name)