Exemplo n.º 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)
Exemplo n.º 2
0
def destroy_by_name(entity_ctx: PulpEntityContext, name: str) -> None:
    """
    Destroy an entry
    """
    href = entity_ctx.find(name=name)["pulp_href"]
    entity_ctx.delete(href)
Exemplo n.º 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)