Exemple #1
0
def project_delete(doit, logger, project, uri):
    """
    Delete the project for configuration and all its data.
    Works in multiple steps:

      1. delete the project from configuration and its indexed data
      2. refresh on disk configuration
      3. delete the source code for the project
    """

    # Be extra careful as we will be recursively removing directory structure.
    if not project or len(project) == 0:
        raise Exception("invalid call to project_delete(): missing project")

    logger.info("Deleting project {} and its index data".format(project))

    if doit:
        delete_project(logger, project, uri)

    src_root = get_config_value(logger, 'sourceRoot', uri)
    if not src_root:
        raise Exception("Could not get source root")

    src_root = src_root[0].rstrip()
    logger.debug("Source root = {}".format(src_root))
    if not src_root or len(src_root) == 0:
        raise Exception("source root empty")
    sourcedir = path.join(src_root, project)
    logger.debug("Removing directory tree {}".format(sourcedir))
    if doit:
        logger.info("Removing source code under {}".format(sourcedir))
        shutil.rmtree(sourcedir)
Exemple #2
0
            "unknown global configuration option(s): '{}'".format(diff))
        sys.exit(1)

    # Make sure the log directory exists.
    logdir = config.get(LOGDIR_PROPERTY)
    if logdir:
        check_create_dir(logger, logdir)

    uri = args.uri
    if not uri:
        logger.error("uri of the webapp not specified")
        sys.exit(1)

    logger.debug("Uri = {}".format(uri))

    source_root = get_config_value(logger, 'sourceRoot', uri)
    if not source_root:
        logger.error("Cannot get the sourceRoot config value")
        sys.exit(1)

    logger.debug("Source root = {}".format(source_root))

    project_config = None
    projects = config.get(PROJECTS_PROPERTY)
    if projects:
        if projects.get(args.project):
            project_config = projects.get(args.project)
        else:
            for proj in projects.keys():
                try:
                    pattern = re.compile(proj)
Exemple #3
0
    if logdir:
        check_create_dir(logdir)

    if args.messages:
        messages_file = which(args.messages)
        if not messages_file:
            logger.error("file {} does not exist".format(args.messages))
            sys.exit(1)
    else:
        messages_file = which("Messages")
        if not messages_file:
            logger.error("cannot determine path to Messages")
            sys.exit(1)
    logger.debug("Messages = {}".format(messages_file))

    source_root = get_config_value(logger, 'sourceRoot', messages_file)
    if not source_root:
        logger.error("Cannot get the sourceRoot config value")
        sys.exit(1)

    logger.debug("Source root = {}".format(source_root))

    project_config = None
    projects = config.get('projects')
    if projects:
        if projects.get(args.project):
            project_config = projects.get(args.project)
        else:
            for proj in projects.keys():
                try:
                    pattern = re.compile(proj)
Exemple #4
0
    else:
        check_create_dir(logdir)

    if args.messages:
        messages_file = which(args.messages)
        if not messages_file:
            logger.error("file {} does not exist".format(args.messages))
            sys.exit(1)
    else:
        messages_file = which("Messages")
        if not messages_file:
            logger.error("cannot determine path to Messages")
            sys.exit(1)
    logger.debug("Messages = {}".format(messages_file))

    source_root = get_config_value(logger, 'sourceRoot', messages_file)
    if not source_root:
        logger.error("Cannot get the sourceRoot config value")
        sys.exit(1)

    logger.debug("Source root = {}".format(source_root))

    project_config = None
    try:
        projects = config['projects']
        if projects:
            if projects.get(args.project):
                project_config = projects.get(args.project)
            else:
                for proj in projects.keys():
                    try: