Пример #1
0
def run(
    pulp_ctx: PulpContext,
    export_ctx: PulpExportContext,
    exporter: str,
    full: bool,
    chunk_size: str,
    versions: List[RepositoryVersionDefinition],
    start_versions: List[RepositoryVersionDefinition],
) -> None:
    exporter_ctx = PulpExporterContext(pulp_ctx)
    export_ctx.exporter = exporter_ctx.find(name=exporter)

    body: Dict[str, Any] = dict(full=full)

    if chunk_size:
        body["chunk_size"] = chunk_size

    vers_list = []
    for v in versions:
        vers_list.append(export_ctx.find_repository_version(v)["pulp_href"])
    if vers_list:
        body["versions"] = vers_list

    start_vers_list = []
    for v in start_versions:
        start_vers_list.append(
            export_ctx.find_repository_version(v)["pulp_href"])
    if start_vers_list:
        body["start_versions"] = start_vers_list

    result = export_ctx.create(body=body)
    pulp_ctx.output_result(result)
Пример #2
0
def list(pulp_ctx: PulpContext, export_ctx: PulpExportContext, exporter: str,
         limit: int, offset: int, **kwargs: Any) -> None:
    params = {k: v for k, v in kwargs.items() if v is not None}
    exporter_ctx = PulpExporterContext(pulp_ctx)
    export_ctx.exporter = exporter_ctx.find(name=exporter)
    result = export_ctx.list(limit=limit, offset=offset, parameters=params)
    pulp_ctx.output_result(result)
Пример #3
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)
Пример #4
0
def read(pulp_ctx: PulpContext, exporter_ctx: PulpExporterContext,
         name: str) -> None:
    """Shows details of an artifact."""
    exporter_href = exporter_ctx.find(name=name)["pulp_href"]
    entity = exporter_ctx.show(exporter_href)
    pulp_ctx.output_result(entity)
Пример #5
0
def delete(pulp_ctx: PulpContext, exporter_ctx: PulpExporterContext,
           name: str) -> None:
    exporter_href = exporter_ctx.find(name=name)["pulp_href"]
    result = exporter_ctx.delete(exporter_href)
    pulp_ctx.output_result(result)