Detect Kubuntu images
authorNikos Skalkotos <skalkoto@grnet.gr>
Tue, 28 Feb 2012 16:32:52 +0000 (18:32 +0200)
committerNikos Skalkotos <skalkoto@grnet.gr>
Tue, 28 Feb 2012 16:32:52 +0000 (18:32 +0200)
This is done checking an Ubuntu image for the presence of
kubuntu-desktop package.

image_creator/os_type/__init__.py
image_creator/os_type/ubuntu.py [new file with mode: 0644]

index 05d6ffc..358a43f 100644 (file)
@@ -59,7 +59,7 @@ class OSBase(object):
         meta["description"] = self.g.inspect_get_product_name(self.root)
 
         return meta
         meta["description"] = self.g.inspect_get_product_name(self.root)
 
         return meta
-        
+
     def data_cleanup(self):
         raise NotImplementedError
 
     def data_cleanup(self):
         raise NotImplementedError
 
diff --git a/image_creator/os_type/ubuntu.py b/image_creator/os_type/ubuntu.py
new file mode 100644 (file)
index 0000000..3546648
--- /dev/null
@@ -0,0 +1,16 @@
+from image_creator.os_type.linux import Linux
+
+
+class Ubuntu(Linux):
+    def get_metadata(self):
+        meta = super(Ubuntu, self).get_metadata()
+        apps = self.g.inspect_list_applications(self.root)
+        for app in apps:
+            if app['app_name'] == 'kubuntu-desktop':
+                meta['OS'] = 'kubuntu'
+                meta['description'] = \
+                            meta['description'].replace('Ubuntu', 'Kubuntu')
+                break
+        return meta
+
+# vim: set sta sts=4 shiftwidth=4 sw=4 et ai :