projects
/
invirt/packages/invirt-database.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Don't forget to export the new admin-related variables.
[invirt/packages/invirt-database.git]
/
python
/
database
/
models.py
diff --git
a/python/database/models.py
b/python/database/models.py
index
420c1ae
..
25d5f77
100644
(file)
--- a/
python/database/models.py
+++ b/
python/database/models.py
@@
-19,6
+19,7
@@
__all__ = ['meta',
'mirrors_table',
'autoinstalls_table',
'owners_table',
'mirrors_table',
'autoinstalls_table',
'owners_table',
+ 'admins_table',
'Machine',
'MachineAccess',
'NIC',
'Machine',
'MachineAccess',
'NIC',
@@
-28,6
+29,7
@@
__all__ = ['meta',
'Mirror',
'Autoinstall',
'Owner',
'Mirror',
'Autoinstall',
'Owner',
+ 'Admin',
'or_',
]
'or_',
]
@@
-101,6
+103,9
@@
machine_access_table = Table('machine_access', meta,
Column('user', String, nullable=False, index=True),
PrimaryKeyConstraint('machine_id', 'user'))
Column('user', String, nullable=False, index=True),
PrimaryKeyConstraint('machine_id', 'user'))
+admins_table = Table('admins', meta,
+ Column('user', String, nullable=False, index=True, primary_key=True))
+
class Machine(record.Record):
_identity_field = 'name'
class Machine(record.Record):
_identity_field = 'name'
@@
-125,6
+130,9
@@
class CDROM(record.Record):
class Autoinstall(record.Record):
_identity_field = 'autoinstall_id'
class Autoinstall(record.Record):
_identity_field = 'autoinstall_id'
+class Admin(record.Record):
+ _identity_field = 'user'
+
from invirt.database.owner import Owner
session.mapper(Machine, machine_table,
from invirt.database.owner import Owner
session.mapper(Machine, machine_table,
@@
-141,6
+149,7
@@
session.mapper(CDROM, cdroms_table,
properties={'mirror': relation(Mirror, backref="cdroms")})
session.mapper(Autoinstall, autoinstalls_table)
session.mapper(Owner, owners_table)
properties={'mirror': relation(Mirror, backref="cdroms")})
session.mapper(Autoinstall, autoinstalls_table)
session.mapper(Owner, owners_table)
+session.mapper(Admin, admins_table)
def clear_cache():
"""Clear sqlalchemy's cache
def clear_cache():
"""Clear sqlalchemy's cache