"""
if cdrom.mirror_id is None:
return
- temp_file = fetch_image(cdrom)
+ try:
+ temp_file = fetch_image(cdrom)
+ except InvirtImageException, e:
+ print >>sys.stderr, 'ERROR: %s. Skipping.' % e
+ return
+
try:
st_size = os.stat(temp_file).st_size
if not st_size:
global verbosity
database.connect()
-
+ database.session.begin()
+
usage = """%prog [options] --add [--cdrom] cdrom_id description mirror_id uri_suffix
%prog [options] --add --mirror mirror_id uri_prefix
attrs = dict(zip(('cdrom_id', 'description', 'mirror_id', 'uri_suffix'),
args))
cdrom = database.CDROM(**attrs)
- database.session.save(cdrom)
- database.session.flush()
+ database.session.add(cdrom)
+ database.session.commit()
load_image(cdrom)
attrs = dict(zip(('mirror_id', 'uri_prefix'),
args))
mirror = database.Mirror(**attrs)
- database.session.save(mirror)
- database.session.flush()
+ database.session.add(mirror)
+ database.session.commit()
elif options.action == 'update':
if len(args) > 0:
images = [database.CDROM.query().get(arg) for arg in args]