示例#1
0
    default="rpm",
)
@pass_pulp_context
@click.pass_context
def remote(ctx: click.Context, pulp_ctx: PulpContext,
           remote_type: str) -> None:
    if remote_type == "rpm":
        ctx.obj = PulpRpmRemoteContext(pulp_ctx)
    else:
        raise NotImplementedError()


lookup_options = [href_option, name_option]
rpm_remote_options = [
    click.option("--policy",
                 type=click.Choice(["immediate", "on_demand", "streamed"],
                                   case_sensitive=False)),
    click.option("--sles-auth-token"),
]

remote.add_command(list_command(decorators=[label_select_option]))
remote.add_command(show_command(decorators=lookup_options))
remote.add_command(
    create_command(decorators=common_remote_create_options +
                   rpm_remote_options))
remote.add_command(
    update_command(decorators=lookup_options + common_remote_update_options +
                   rpm_remote_options))
remote.add_command(destroy_command(decorators=lookup_options))
remote.add_command(label_command())
示例#2
0
]


@click.group()
@pass_pulp_context
@click.pass_context
def user(ctx: click.Context, pulp_ctx: PulpContext) -> None:
    ctx.obj = PulpUserContext(pulp_ctx)


user.add_command(list_command())
user.add_command(show_command(decorators=lookup_options))
user.add_command(
    create_command(decorators=create_options, needs_plugins=[req_core_3_17]))
user.add_command(
    update_command(decorators=lookup_options + update_options,
                   needs_plugins=[req_core_3_17]))
user.add_command(
    destroy_command(decorators=lookup_options, needs_plugins=[req_core_3_17]))


@user.group(name="role-assignment")
@pass_entity_context
@pass_pulp_context
@click.pass_context
def role(ctx: click.Context, pulp_ctx: PulpContext,
         user_ctx: PulpUserContext) -> None:
    pulp_ctx.needs_plugin(req_core_3_17)
    ctx.obj = PulpUserRoleContext(pulp_ctx, user_ctx)


role.add_command(
示例#3
0
    ),
    click.option(
        "--remove-content",
        callback=content_json_callback,
        help=_(
            """JSON string with a list of objects to remove from the repository.
    Each object should have the key: "filename"
    The argument prefixed with the '@' can be the path to a JSON file with a list of objects."""
        ),
    ),
]

repository.add_command(list_command(decorators=[label_select_option]))
repository.add_command(show_command(decorators=lookup_options))
repository.add_command(create_command(decorators=create_options))
repository.add_command(update_command(decorators=lookup_options + update_options))
repository.add_command(destroy_command(decorators=lookup_options))
repository.add_command(task_command(decorators=nested_lookup_options))
repository.add_command(version_command(decorators=nested_lookup_options))
repository.add_command(label_command(decorators=nested_lookup_options))
repository.add_command(
    repository_content_command(
        contexts={"package": PulpPythonContentContext},
        add_decorators=[package_option],
        remove_decorators=[package_option],
        modify_decorators=modify_options,
    )
)


@repository.command()
示例#4
0
文件: remote.py 项目: latran/pulp-cli
    # Container specific
    click.option("--upstream-name", required=True),
]
update_options = [
    click.option("--url"),
    click.option("--ca-cert"),
    click.option("--client-cert"),
    click.option("--client-key"),
    click.option("--connect-timeout", type=float),
    click.option("--download-concurrency", type=int),
    click.option("--password"),
    click.option("--policy",
                 type=click.Choice(["immediate", "on_demand", "streamed"],
                                   case_sensitive=False)),
    click.option("--proxy-url"),
    click.option("--sock-connect-timeout", type=float),
    click.option("--sock-read-timeout", type=float),
    click.option("--tls-validation", type=bool),
    click.option("--total-timeout", type=float),
    click.option("--username"),
    # Container specific
    click.option("--upstream-name"),
]

remote.add_command(list_command(decorators=[label_select_option]))
remote.add_command(show_command(decorators=lookup_options))
remote.add_command(create_command(decorators=create_options))
remote.add_command(update_command(decorators=lookup_options + update_options))
remote.add_command(destroy_command(decorators=lookup_options))
remote.add_command(label_command())
示例#5
0
    default="rpm",
)
@pass_pulp_context
@click.pass_context
def distribution(ctx: click.Context, pulp_ctx: PulpContext,
                 distribution_type: str) -> None:
    if distribution_type == "rpm":
        ctx.obj = PulpRpmDistributionContext(pulp_ctx)
    else:
        raise NotImplementedError()


lookup_options = [href_option, name_option]
create_options = [
    click.option("--name", required=True),
    click.option("--base-path", required=True),
    click.option("--publication"),
]
update_options = [
    click.option("--base-path"),
    click.option("--publication"),
]

distribution.add_command(list_command(decorators=[label_select_option]))
distribution.add_command(show_command(decorators=lookup_options))
distribution.add_command(create_command(decorators=create_options))
distribution.add_command(
    update_command(decorators=lookup_options + update_options))
distribution.add_command(destroy_command(decorators=lookup_options))
distribution.add_command(label_command())
示例#6
0
)
@pass_pulp_context
@click.pass_context
def remote(ctx: click.Context, pulp_ctx: PulpContext,
           remote_type: str) -> None:
    if remote_type == "container":
        ctx.obj = PulpContainerRemoteContext(pulp_ctx)
    else:
        raise NotImplementedError()


lookup_options = [href_option, name_option]
remote_options = [
    click.option("--policy",
                 type=click.Choice(["immediate", "on_demand", "streamed"],
                                   case_sensitive=False)),
    click.option("--include-tags", callback=load_json_callback),
    click.option("--exclude-tags", callback=load_json_callback),
]
remote_create_options = (common_remote_create_options + remote_options +
                         [click.option("--upstream-name", required=True)])
remote_update_options = (lookup_options + common_remote_update_options +
                         remote_options + [click.option("--upstream-name")])

remote.add_command(list_command(decorators=[label_select_option]))
remote.add_command(show_command(decorators=lookup_options))
remote.add_command(create_command(decorators=remote_create_options))
remote.add_command(update_command(decorators=remote_update_options))
remote.add_command(destroy_command(decorators=lookup_options))
remote.add_command(label_command())
示例#7
0
    type=click.Choice(["python"], case_sensitive=False),
    default="python",
)
@pass_pulp_context
@click.pass_context
def distribution(ctx: click.Context, pulp_ctx: PulpContext, distribution_type: str) -> None:
    if distribution_type == "python":
        ctx.obj = PulpPythonDistributionContext(pulp_ctx)
    else:
        raise NotImplementedError()


filter_options = [label_select_option, base_path_option, base_path_contains_option]
lookup_options = [href_option, name_option]
create_options = [
    click.option("--name", required=True),
    click.option("--base-path", required=True),
    click.option("--publication"),
]
update_options = [
    click.option("--base-path"),
    click.option("--publication"),
]

distribution.add_command(list_command(decorators=filter_options))
distribution.add_command(show_command(decorators=lookup_options))
distribution.add_command(destroy_command(decorators=lookup_options))
distribution.add_command(create_command(decorators=create_options))
distribution.add_command(update_command(decorators=lookup_options + update_options))
distribution.add_command(label_command())
示例#8
0
nested_lookup_options = [repository_href_option, repository_option]
update_options = [
    click.option("--description"),
    remote_option,
    retained_versions_option,
]
create_options = update_options + [click.option("--name", required=True)]
container_context = (PulpContainerRepositoryContext, )

repository.add_command(list_command(decorators=[label_select_option]))
repository.add_command(show_command(decorators=lookup_options))
repository.add_command(
    create_command(decorators=create_options,
                   allowed_with_contexts=container_context))
repository.add_command(
    update_command(decorators=lookup_options + update_options,
                   allowed_with_contexts=container_context))
repository.add_command(
    destroy_command(decorators=lookup_options,
                    allowed_with_contexts=container_context))
repository.add_command(task_command(decorators=nested_lookup_options))
repository.add_command(version_command(decorators=nested_lookup_options))
repository.add_command(label_command(decorators=nested_lookup_options))


@repository.command(allowed_with_contexts=container_context)
@name_option
@href_option
@remote_option
@pass_repository_context
def sync(
    repository_ctx: PulpRepositoryContext,
示例#9
0
content_guard.add_command(list_command(decorators=filter_options))


@content_guard.group()
@pass_pulp_context
@click.pass_context
def rbac(ctx: click.Context, pulp_ctx: PulpContext) -> None:
    pulp_ctx.needs_plugin(PluginRequirement("core", "3.15.0.dev"))
    ctx.obj = PulpRbacContentGuardContext(pulp_ctx)


rbac.add_command(list_command(decorators=filter_options))
rbac.add_command(create_command(decorators=create_options))
rbac.add_command(show_command(decorators=lookup_options))
rbac.add_command(update_command(decorators=lookup_options))
rbac.add_command(destroy_command(decorators=lookup_options))
rbac.add_command(
    role_command(decorators=lookup_options,
                 needs_plugins=[PluginRequirement("core", min="3.17")]))


@rbac.command()
@name_option
@href_option
@click.option(
    "--group",
    "groups",
    help=_("Group to add download role to. Can be specified multiple times."),
    multiple=True,
)
示例#10
0
@pass_pulp_context
@click.pass_context
def access_policy(ctx: click.Context, pulp_ctx: PulpContext) -> None:
    ctx.obj = PulpAccessPolicyContext(pulp_ctx)


lookup_options = [
    href_option,
    click.option("--viewset-name", callback=_vs_name_callback, expose_value=False),
]

update_options = [
    click.option("--statements", callback=load_json_callback),
    click.option("--creation-hooks", callback=load_json_callback),
]

access_policy.add_command(list_command())
access_policy.add_command(show_command(decorators=lookup_options))
access_policy.add_command(update_command(decorators=lookup_options + update_options))


@access_policy.command()
@href_option
@click.option("--viewset-name", callback=_vs_name_callback, expose_value=False)
@pass_entity_context
@pass_pulp_context
def reset(pulp_ctx: PulpContext, access_policy_ctx: PulpAccessPolicyContext) -> None:
    pulp_ctx.needs_plugin(PluginRequirement("core", min="3.17.dev"))
    result = access_policy_ctx.reset()
    pulp_ctx.output_result(result)