Пример #1
0
def handle_plugupgrade(bot, ievent):
    alreadygot = []
    upgraded = []
    plugs = []
    if ievent.rest:
        plugs.extend(ievent.rest.split())
    else:
        for name, plug in plugins.plugs.iteritems():
            if hasattr(plug, 'upgrade'):
                plugs.append(name)    
    ievent.reply('starting plugin upgrade for plugins: ', plugs, dot=True)
    errors = []
    for plug in plugs:
        try:
            s = plugins.plugs[plug].size()
        except AttributeError:
            s = 0
        if s and not '-f' in ievent.optionset:
            alreadygot.append(plug)
            continue
        try:
            plugins.plugs[plug].upgrade()
            plugins.reload('gozerplugs', plug)
            ievent.reply('upgraded %s' % plug)
            upgraded.append(plug)
        except AttributeError:
            continue
        except Exception, ex:
            handle_exception()
            errors.append(exceptionmsg())
Пример #2
0
def handle_plugenable(bot, ievent):
    doall = False
    if '-a' in ievent.optionset:
        doall = True
    if not ievent.rest and not doall:
        ievent.missing('<plugname>')
        return
    try:
        plugs = gozer_import('gozerplugs').__plugs__
    except ImportError:
        ievent.reply("no gozerplugs package detected")
        return
    if not doall:
        plugs = ievent.rest.split()
    ievent.reply("trying to reload: ", plugs, dot=True)
    errors = []
    reloaded = []
    failed = []
    for plug in plugs:
        try:
            reloaded.extend(plugins.reload('gozerplugs', plug))
        except ImportError, ex:
            errors.append(str(ex))
            failed.append(plug)
        except Exception, ex:
            handle_exception()
            errors.append(exceptionmsg())
            failed.append(plug)
Пример #3
0
def handle_plugupgrade(bot, ievent):
    alreadygot = []
    upgraded = []
    plugs = []
    if ievent.rest:
        plugs.extend(ievent.rest.split())
    else:
        for name, plug in plugins.plugs.iteritems():
            if hasattr(plug, 'upgrade'):
                plugs.append(name)
    ievent.reply('starting plugin upgrade for plugins: ', plugs, dot=True)
    errors = []
    for plug in plugs:
        try:
            s = plugins.plugs[plug].size()
        except AttributeError:
            s = 0
        if s and not '-f' in ievent.optionset:
            alreadygot.append(plug)
            continue
        try:
            plugins.plugs[plug].upgrade()
            plugins.reload('gozerplugs', plug)
            ievent.reply('upgraded %s' % plug)
            upgraded.append(plug)
        except AttributeError:
            continue
        except Exception, ex:
            handle_exception()
            errors.append(exceptionmsg())
Пример #4
0
def handle_plugenable(bot, ievent):
    doall = False
    if '-a' in ievent.optionset:
        doall = True
    if not ievent.rest and not doall:
        ievent.missing('<plugname>')
        return
    try:
        plugs = gozer_import('gozerplugs').__plugs__
    except ImportError:
        ievent.reply("no gozerplugs package detected")
        return
    if not doall:
        plugs = ievent.rest.split()
    ievent.reply("trying to reload: ", plugs, dot=True)
    errors = []
    reloaded = []
    failed = []
    for plug in plugs:
        try:
            reloaded.extend(plugins.reload('gozerplugs', plug))
        except ImportError, ex:
            errors.append(str(ex))
            failed.append(plug)
        except Exception, ex:
            handle_exception()
            errors.append(exceptionmsg())
            failed.append(plug)
Пример #5
0
    upgraded = []

    # populate the User table
    for user in users:
        name = user.name
        if name in upgraded:
            continue
        try:
            if not byname(name):
                newuser = User(name=name)
                session.add(newuser)
            upgraded.append(name)
        except sqlalchemy.exc.IntegrityError, ex:
            pass
        except:
            handle_exception()

    session.commit()
    print "upgraded: %s" % ' .. '.join(upgraded) 
    print 'upgrading email table'
    from gozerbot.database.db import Db

    # upgrade email table
    try:
        db = Db(config=mainconfig)
        if db.dbtype == 'mysql':
            db.execute("ALTER TABLE email ADD COLUMN email.order INT")
        else:
            db.execute("ALTER TABLE email ADD COLUMN 'order' INT")
    except Exception, ex:
        if 'already exists' in str(ex) or 'duplicate column name' in \
Пример #6
0
    upgraded = []

    # populate the User table
    for user in users:
        name = user.name
        if name in upgraded:
            continue
        try:
            if not byname(name):
                newuser = User(name=name)
                session.add(newuser)
            upgraded.append(name)
        except sqlalchemy.exc.IntegrityError, ex:
            pass
        except:
            handle_exception()

    session.commit()
    print "upgraded: %s" % ' .. '.join(upgraded)
    print 'upgrading email table'
    from gozerbot.database.db import Db

    # upgrade email table
    try:
        db = Db(config=mainconfig)
        if db.dbtype == 'mysql':
            db.execute("ALTER TABLE email ADD COLUMN email.order INT")
        else:
            db.execute("ALTER TABLE email ADD COLUMN 'order' INT")
    except Exception, ex:
        if 'already exists' in str(ex) or 'duplicate column name' in \