def setup_environment(check_deps=False):
    # Configuration files generation
    server.config.copy_default_config_to_local()

    if check_deps:

        # Check dependencies
        installed_deps, missing_deps = dependencies.check_dependencies(
            requirements_file=server.config.REQUIREMENTS_FILE)

        logger.info("Checking dependencies...")

        if missing_deps:

            install_deps = query_yes_no("Do you want to install them?", default="no")

            if install_deps:
                dependencies.install_packages(missing_deps)
                logger.info("Dependencies installed. Please launch Faraday Server again.")
                sys.exit(0)
            else:
                logger.error("Dependencies not met. Please refer to the documentation in order to install them. [%s]",
                             ", ".join(missing_deps))

        logger.info("Dependencies met")

    # Web configuration file generation
    server.config.gen_web_config()

    # Reports DB creation
    server.couchdb.push_reports()
Exemple #2
0
def setup_environment(check_deps=False):
    # Configuration files generation
    server.config.copy_default_config_to_local()

    if check_deps:

        # Check dependencies
        installed_deps, missing_deps, conflict_deps = dependencies.check_dependencies(
            requirements_file=server.config.REQUIREMENTS_FILE)

        logger.info("Checking dependencies...")

        if conflict_deps:
            logger.info("Some dependencies are old. Update them with \"pip install -r requirements_server.txt -U\"")

        if missing_deps:

            install_deps = query_yes_no("Do you want to install them?", default="no")

            if install_deps:
                dependencies.install_packages(missing_deps)
                logger.info("Dependencies installed. Please launch Faraday Server again.")
                sys.exit(0)
            else:
                logger.error("Dependencies not met. Please refer to the documentation in order to install them. [%s]",
                             ", ".join(missing_deps))

        logger.info("Dependencies met")

    # Web configuration file generation
    server.config.gen_web_config()
Exemple #3
0
def check_dependencies_or_exit():
    """
    Dependency resolver based on a previously specified CONST_REQUIREMENTS_FILE.
    Currently checks a list of dependencies from a file and exits if they are not met.
    """

    installed_deps, missing_deps, conflict_deps = dependencies.check_dependencies(
        requirements_file=FARADAY_REQUIREMENTS_FILE)

    logger.info("Checking dependencies...")

    if conflict_deps:
        logger.info(
            "Some dependencies are old. Update them with \"pip install -r requirements_server.txt -U\""
        )

    if missing_deps:

        install_deps = query_yes_no("Do you want to install them?",
                                    default="no")

        if install_deps:
            dependencies.install_packages(missing_deps)
            logger.info(
                "Dependencies installed. Please launch Faraday Server again.")
            sys.exit(0)
        else:
            logger.error(
                "Dependencies not met. Please refer to the documentation in order to install them. [%s]",
                ", ".join(missing_deps))
            sys.exit(1)

    logger.info("Dependencies met")
Exemple #4
0
def check_dependencies_or_exit():
    """Dependency resolver based on a previously specified CONST_REQUIREMENTS_FILE.

    Currently checks a list of dependencies from a file and exits if they are not met.

    """

    installed_deps, missing_deps = dependencies.check_dependencies(requirements_file=FARADAY_REQUIREMENTS_FILE)

    logger.info("Checking dependencies...")

    if missing_deps:

        install_deps = query_yes_no("Do you want to install them?", default="no")

        if install_deps:
            dependencies.install_packages(missing_deps)
            logger.info("Dependencies installed. Please launch Faraday Server again.")
            sys.exit(0)
        else:
            logger.error("Dependencies not met. Please refer to the documentation in order to install them. [%s]",
                         ", ".join(missing_deps))
            sys.exit(1)

    logger.info("Dependencies met")