예제 #1
0
def remove_service(project_dir, variable_name):
    """Remove an item from the services section."""
    project = load_project(project_dir)
    result = prepare_without_interaction(project, mode=PROVIDE_MODE_CHECK)
    status = project_ops.remove_service(project,
                                        result,
                                        variable_name=variable_name)
    if status:
        print(status.status_description)
        return 0
    else:
        console_utils.print_status_errors(status)
        return 1
예제 #2
0
    def remove_service(self, project, prepare_result, variable_name):
        """Remove a service to anaconda-project.yml.

        Returns a ``Status`` instance which evaluates to True on
        success and has an ``errors`` property (with a list of error
        strings) on failure.

        Args:
            project (Project): the project
            prepare_result (PrepareResult): result of a previous prepare
            variable_name (str): environment variable name for the service requirement

        Returns:
            ``Status`` instance
        """
        return project_ops.remove_service(project=project, prepare_result=prepare_result, variable_name=variable_name)
def remove_service(project_dir, env_spec_name, variable_name):
    """Remove an item from the services section."""
    project = load_project(project_dir)
    # we don't want to print errors during this prepare, remove
    # service can proceed even though the prepare fails.
    with project.null_frontend():
        result = prepare_without_interaction(project, env_spec_name=env_spec_name, mode=PROVIDE_MODE_CHECK)
    status = project_ops.remove_service(project,
                                        env_spec_name=env_spec_name,
                                        variable_name=variable_name,
                                        prepare_result=result)
    if status:
        print(status.status_description)
        return 0
    else:
        console_utils.print_status_errors(status)
        return 1