Changeset 2322 for trunk/packages/invirt-web/code/xen-ips
- Timestamp:
- May 2, 2009, 6:53:48 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/invirt-web/code/xen-ips
r1318 r2322 2 2 import random 3 3 from invirt import database 4 import sqlalchemy.exceptions 4 5 import sys 5 6 … … 38 39 39 40 def addip(ip): 40 n = database.NIC(machine=None, mac_addr=randomMAC(), ip=ip, hostname=None) 41 database.session.save(n) 42 database.session.flush() 41 try: 42 n = database.NIC(machine=None, mac_addr=randomMAC(), ip=ip, hostname=None) 43 database.session.save(n) 44 database.session.flush() 45 except sqlalchemy.exceptions.IntegrityError: 46 pass 43 47 44 48
Note: See TracChangeset
for help on using the changeset viewer.