inspector: Add product_name field to output.
[libguestfs.git] / inspector / virt-inspector
index d000510..e5c3990 100755 (executable)
@@ -354,6 +354,7 @@ sub output_text_os
     print $os->{arch}, " " if exists $os->{arch};
     print $os->{major_version} if exists $os->{major_version};
     print ".", $os->{minor_version} if exists $os->{minor_version};
+    print " (", $os->{product_name}, ")" if exists $os->{product_name};
     print " ";
     print "on ", $os->{root_device}, ":\n";
 
@@ -407,13 +408,15 @@ sub output_text_os
         print "    $_->{name} $_->{version}\n"
     }
 
-    print __"  Kernels:\n";
-    my @kernels = @{$os->{kernels}};
-    foreach (@kernels) {
-        print "    $_->{version} ($_->{arch})\n";
-        my @modules = @{$_->{modules}};
-        foreach (@modules) {
-            print "      $_\n";
+    if ($os->{kernels}) {
+        print __"  Kernels:\n";
+        my @kernels = @{$os->{kernels}};
+        foreach (@kernels) {
+            print "    $_->{version} ($_->{arch})\n";
+            my @modules = @{$_->{modules}};
+            foreach (@modules) {
+                print "      $_\n";
+            }
         }
     }
 
@@ -445,6 +448,7 @@ sub output_xml_os
 
     foreach ( [ "name" => "os" ],
               [ "distro" => "distro" ],
+              [ "product_name" => "product_name" ],
               [ "arch" => "arch" ],
               [ "major_version" => "major_version" ],
               [ "minor_version" => "minor_version" ],
@@ -519,7 +523,10 @@ sub output_xml_os
     foreach (@apps) {
         $xml->startTag("application");
         $xml->dataElement("name", $_->{name});
+        $xml->dataElement("epoch", $_->{epoch}) if defined $_->{epoch};
         $xml->dataElement("version", $_->{version});
+        $xml->dataElement("release", $_->{release});
+        $xml->dataElement("arch", $_->{arch});
         $xml->endTag("application");
     }
     $xml->endTag("applications");