Exemple #1
0
def update(
    pulp_ctx: PulpContext,
    remote_ctx: PulpEntityContext,
    name: str,
    url: Optional[str],
    requirements_file: Any,
    requirements: Optional[str],
    auth_url: Optional[str],
    token: Optional[str],
    **remote_options: Dict[str, Any],
) -> None:
    """
    Use -t to specify the type of the remote you are updating

    e.g. pulp ansible remote -t role update ...
    """
    body: EntityDefinition = dict()

    body.update(
        check_collection_options(
            remote_ctx=remote_ctx,
            requirements_file=requirements_file,
            requirements=requirements,
            auth_url=auth_url,
            token=token,
        ))
    if url:
        body["url"] = url
    if remote_options:
        removed_nulls = {
            k: v
            for k, v in remote_options.items() if v is not None
        }
        body.update(removed_nulls)

    remote = remote_ctx.find(name=name)
    remote_href = remote["pulp_href"]
    remote_ctx.update(remote_href, body=body)
    result = remote_ctx.show(remote_href)
    pulp_ctx.output_result(result)
Exemple #2
0
def show_by_href(pulp_ctx: PulpContext, entity_ctx: PulpEntityContext, href: str) -> None:
    """Shows details of an entry"""
    entity = entity_ctx.show(href)
    pulp_ctx.output_result(entity)
Exemple #3
0
def show_by_name(pulp_ctx: PulpContext, entity_ctx: PulpEntityContext, name: str) -> None:
    """Shows details of an entry"""
    href = entity_ctx.find(name=name)["pulp_href"]
    entity = entity_ctx.show(href)
    pulp_ctx.output_result(entity)