Conditionalize populating the types table in invirt-database-tables invirt-database-server/0.0.10
authorEvan Broder <broder@mit.edu>
Sat, 31 Jan 2009 08:59:00 +0000 (03:59 -0500)
committerEvan Broder <broder@mit.edu>
Sat, 31 Jan 2009 08:59:00 +0000 (03:59 -0500)
based on whether the types are in the database already

svn path=/trunk/packages/invirt-database-server/; revision=2054

debian/changelog
invirt-database-tables

index 79634c1..a7fb58f 100644 (file)
@@ -1,8 +1,13 @@
 invirt-database-server (0.0.10) unstable; urgency=low
 
 invirt-database-server (0.0.10) unstable; urgency=low
 
+  [ Greg Price ]
   * invirt-database-tables: populate types table
 
   * invirt-database-tables: populate types table
 
- -- Greg Price <price@mit.edu>  Sat, 31 Jan 2009 03:49:33 -0500
+  [ Evan Broder ]
+  * Conditionalize populating the types table on the types not being there
+    already.
+
+ -- Evan Broder <broder@mit.edu>  Sat, 31 Jan 2009 03:58:16 -0500
 
 invirt-database-server (0.0.9) unstable; urgency=low
 
 
 invirt-database-server (0.0.9) unstable; urgency=low
 
index 695b04f..78c7ab4 100755 (executable)
@@ -14,10 +14,12 @@ def create():
     database.meta.create_all()
     session = database.session()
     session.begin()
     database.meta.create_all()
     session = database.session()
     session.begin()
-    session.save(database.Type(type_id='linux-hvm', description='HVM',
-                               hvm='t', apic='t', acpi='t', pae='t'))
-    session.save(database.Type(type_id='linux', description='ParaVM',
-                               hvm='f', apic='f', acpi='f', pae='f'))
+    if not database.Type.query.get('linux-hvm'):
+        session.save(database.Type(type_id='linux-hvm', description='HVM',
+                                   hvm='t', apic='t', acpi='t', pae='t'))
+    if not database.Type.query.get('linux'):
+        session.save(database.Type(type_id='linux', description='ParaVM',
+                                   hvm='f', apic='f', acpi='f', pae='f'))
     session.commit()
 
 database.connect()
     session.commit()
 
 database.connect()