Esempio n. 1
0
def update(
    pulp_ctx: PulpContext,
    exporter_ctx: PulpExporterContext,
    path: str,
    repository: Iterable[EntityFieldDefinition],
    repository_href: Iterable[str],
) -> None:
    the_exporter = exporter_ctx.entity
    exporter_href = exporter_ctx.pulp_href

    if path:
        the_exporter["path"] = path

    if repository or repository_href:
        the_exporter["repositories"] = [
            repository_ctx.pulp_href
            for repository_ctx in repository
            if isinstance(repository_ctx, PulpEntityContext)
        ] + list(repository_href)

    exporter_ctx.update(exporter_href, the_exporter)
Esempio n. 2
0
def update(
    pulp_ctx: PulpContext,
    exporter_ctx: PulpExporterContext,
    name: str,
    path: str,
    repository: List[RepositoryDefinition],
) -> None:
    the_exporter = exporter_ctx.find(name=name)
    exporter_href = the_exporter["pulp_href"]

    if path:
        the_exporter["path"] = path

    if repository:
        repo_hrefs = []
        for repo_tuple in repository:
            repo_hrefs.append(
                exporter_ctx.find_repository(repo_tuple)["pulp_href"])
        the_exporter["repositories"] = repo_hrefs

    result = exporter_ctx.update(exporter_href, the_exporter)
    pulp_ctx.output_result(result)