def main():
    """main entry."""
    flags.init()
    logsetting.init()
    rolelist = []
    roles_dir = flags.OPTIONS.roles_dir

    for item in os.listdir(roles_dir):
        if item.endswith('.rb') or item.endswith('.json'):
            rolelist.append(os.path.join(roles_dir, item))
        else:
            logging.info('ignore %s in %s', item, roles_dir)

    for role in rolelist:
        logging.info('add role %s', role)
        cmd = role % "knife role from file %s"
        status = os.system(cmd)
        logging.info('run cmd %s returns %s', cmd, status)
        if status:
            sys.exit(1)
dataset/ETHPy150Open openstack/compass-core/bin/chef/addroles.py/main/swapped operands of `%`