From 4430f7f8044f0278d8d0f1cee5b82e739ee06c24 Mon Sep 17 00:00:00 2001
From: Ladislav Smola <lsmola@redhat.com>
Date: Wed, 16 Nov 2016 11:57:42 +0100
Subject: [PATCH] Fill guest_os correctly

Fill guest_os correctly, inferring it from Image location

Fixes BZ:
https://bugzilla.redhat.com/show_bug.cgi?id=1393547
---
 .../providers/amazon/cloud_manager/refresh_parser.rb        | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/app/models/manageiq/providers/amazon/cloud_manager/refresh_parser.rb b/app/models/manageiq/providers/amazon/cloud_manager/refresh_parser.rb
index 48d20e95c..18a0dea62 100644
--- a/app/models/manageiq/providers/amazon/cloud_manager/refresh_parser.rb
+++ b/app/models/manageiq/providers/amazon/cloud_manager/refresh_parser.rb
@@ -166,8 +166,12 @@ def parse_image(image, is_public)
     uid      = image.image_id
     location = image.image_location
     guest_os = (image.platform == "windows") ? "windows" : "linux"
+    if guest_os == "linux"
+      guest_os = OperatingSystem.normalize_os_name(location)
+      guest_os = "linux" if guest_os == "unknown"
+    end
 
-    name     = get_from_tags(image, :name)
+    name = get_from_tags(image, :name)
     name ||= image.name
     name ||= $1 if location =~ /^(.+?)(\.(image|img))?\.manifest\.xml$/
     name ||= uid