Пример #1
0
 def callback(pulp_ctx: PulpContext, entity_ctx: PulpEntityContext,
              **kwargs: Any) -> None:
     """
     Update a {entity}.
     """
     body: EntityDefinition = entity_ctx.preprocess_body(kwargs)
     entity_ctx.update(href=entity_ctx.pulp_href, body=body)
Пример #2
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)