예제 #1
0
 def check_or_create(self, cursor, expected_count, create_method):
     result = executeSQL(cursor, 'select count(*) from sqlite_master where type="table";').fetchall()
     object_count = result[0][0]
     if object_count == 0:
         print 'Create db ...'
         create_method(self)
     elif object_count != expected_count:
         raise MDError('DB exists, but has wrong table count. Was ' + object_count.__str__() + ', expected: ' + expected_count.__str__())
예제 #2
0
 def _remove_repodata_file(self, repodata):
     """ Remove a file specified in repodata location """
     try:
         os.remove(repodata.location[1])
     except OSError, ex:
         if ex.errno != 2:
             # continue on a missing file
             raise MDError("could not remove file %s" %
                           repodata.location[1])
예제 #3
0
 def _remove_repodata_file(self, repodata):
     """ Remove a file specified in repodata location """
     try:
         fname = os.path.basename(repodata.location[1])
         os.remove(os.path.join(self.repodir, fname))
     except OSError, ex:
         if ex.errno != 2:
             # continue on a missing file
             raise MDError("could not remove file %s" % repodata.location[1])