def main():
    usage = 'usage: %prog [options] arg1 arg2'
    parser = OptionParser(usage=usage)
    parser.add_option(
            '--register', action='store_true', dest='register',
            help='Register server as a new Aerostat Client.')
    parser.add_option(
            '--change-master', action='store_true', dest='change_master',
            help='Make current host the master for its service.')
    parser.add_option(
            '--update', action='store_true', dest='update',
            help='Update /etc/hosts.')
    parser.add_option(
            '--server', action='store', dest='server',
            help='hostname of aerostat/mongo server to connect to.')
    parser.add_option(
            '--daemon', action='store_true', dest='daemon',
            help='Whether or not to run service (update) as a daemon.')
    parser.add_option(
            '--loglevel', action='store', dest='loglevel',
            help='Which severity of log to display.')
    parser.add_option(
            '--legacy-updater', action='store', dest='legacy',
            help='Specify path. Run legacy naming service prior to aerostat.')
    parser.add_option(
            '--dryrun', action='store_true', dest='dry_run', default=False,
            help='Whether or not to actually carry our registration and updates.')
    parser.add_option(
            '--offline', action='store_true', dest='offline', default=False,
            help='Whether or not we should connect to AWS for information.')
    parser.add_option(
            '--update-configs', action='store_true', dest='update_configs',
            default=False, help='Update configuration files?')
    parser.add_option(
            '--configs', action='store', dest='configs', default=None,
            help='specific configs to update (space sep in quotes)')


    (options, args) = parser.parse_args()

    if 1 > len(args):
        parser.error('Please supply some arguments')

    level = LEVELS.get(options.loglevel, logging.NOTSET)
    logging.basicConfig(level=level)

    mserver, mport = get_mongo_info()

    if options.server:
        mserver = options.server

    conn = db_connect(mserver, mport)
    db = conn.aerostat

    if options.register or options.change_master:
        reg= registrar.Registrar()
        reg.do_registrar(db, options.dry_run,
                options.change_master, options.offline)
    elif options.update_configs:
        conf_db = conn.configs
        config = configurer.Configurer()
        config.do_update(conf_db, config_names=options.configs.split())
    else:
        update = updater.Updater()

        if not options.daemon:
            update.do_update(db, options.dry_run, options.legacy)
        else:
            while 1:
                try:
                    update.do_update(db, options.dry_run, options.legacy)
                except pymongo.errors.AutoReconnect:
                    logging.error('Unable to connect to database %s:%s. '
                        'Sleeping.' % (mserver, str(mport)))

                time.sleep(60)

    db_disconnect(conn)
dataset/ETHPy150Open urbanairship/aerostat/aerostat/aerostat.py/main/swapped operands of `>`