Last change
on this file since 2151 was
2054,
checked in by broder, 16 years ago
|
Conditionalize populating the types table in invirt-database-tables
based on whether the types are in the database already
|
-
Property svn:executable set to
*
|
File size:
843 bytes
|
Line | |
---|
1 | #!/usr/bin/env python |
---|
2 | |
---|
3 | from invirt import database |
---|
4 | import sys |
---|
5 | |
---|
6 | def usage(): |
---|
7 | print >>sys.stderr, "Usage: %s [create|drop]" %(sys.argv[0],) |
---|
8 | sys.exit(-1) |
---|
9 | |
---|
10 | if len(sys.argv) == 1: |
---|
11 | usage() |
---|
12 | |
---|
13 | def create(): |
---|
14 | database.meta.create_all() |
---|
15 | session = database.session() |
---|
16 | session.begin() |
---|
17 | if not database.Type.query.get('linux-hvm'): |
---|
18 | session.save(database.Type(type_id='linux-hvm', description='HVM', |
---|
19 | hvm='t', apic='t', acpi='t', pae='t')) |
---|
20 | if not database.Type.query.get('linux'): |
---|
21 | session.save(database.Type(type_id='linux', description='ParaVM', |
---|
22 | hvm='f', apic='f', acpi='f', pae='f')) |
---|
23 | session.commit() |
---|
24 | |
---|
25 | database.connect() |
---|
26 | |
---|
27 | if sys.argv[1] == "create": |
---|
28 | create() |
---|
29 | elif sys.argv[1] == "drop": |
---|
30 | database.meta.drop_all() |
---|
31 | else: |
---|
32 | usage() |
---|
Note: See
TracBrowser
for help on using the repository browser.