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())
), ), 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, ) )
help=_("a repository version number, leave blank for latest")), click.option( "-t", "--repository-type", "repository_type", type=click.Choice(["container", "push"], case_sensitive=False), default="container", is_eager=True, expose_value=False, callback=_repository_type_callback, ), ] distribution.add_command(list_command()) distribution.add_command(show_command(decorators=lookup_options)) distribution.add_command(create_command(decorators=create_options)) distribution.add_command(destroy_command(decorators=lookup_options)) @distribution.command() @href_option @name_option @click.option("--base-path") @click.option("--repository", callback=_repository_callback) @click.option("--version", type=int, help=_("a repository version number, leave blank for latest")) @click.option( "-t", "--repository-type", "repository_type",
create_options = update_options + [ click.option("--username", required=True), ] @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)
"publication_type", type=click.Choice(["rpm"], case_sensitive=False), default="rpm", ) @pass_pulp_context @click.pass_context def publication(ctx: click.Context, pulp_ctx: PulpContext, publication_type: str) -> None: if publication_type == "rpm": ctx.obj = PulpRpmPublicationContext(pulp_ctx) else: raise NotImplementedError() lookup_options = [href_option] create_options = [ resource_option( "--repository", default_plugin="rpm", default_type="rpm", context_table={"rpm:rpm": PulpRpmRepositoryContext}, ), click.option( "--version", type=int, help=_("a repository version number, leave blank for latest") ), ] publication.add_command(list_command(decorators=publication_filter_options)) publication.add_command(show_command(decorators=lookup_options)) publication.add_command(create_command(decorators=create_options)) publication.add_command(destroy_command(decorators=lookup_options))
"--sha256", "artifact", required=True, help=_("Digest of the artifact to use"), callback=_sha256_artifact_callback, ), ] content.add_command( list_command( decorators=[ click.option("--filename", type=str), ] ) ) content.add_command(show_command(decorators=[href_option])) content.add_command(create_command(decorators=create_options)) @content.command() @click.option("--relative-path", required=True, help=_("Exact name of file")) @click.option("--file", type=click.File("rb"), required=True, help=_("Path to file")) @click.option( "--chunk-size", default=1000000, type=int, help=_("Chunk size in bytes (default is 1 MB)") ) @pass_entity_context @pass_pulp_context def upload( pulp_ctx: PulpContext, entity_ctx: PulpPythonContentContext, relative_path: str, file: IO[bytes],
from pulpcore.cli.migration.context import PulpMigrationPlanContext @click.group() @pass_pulp_context @click.pass_context def plan(ctx: click.Context, pulp_ctx: PulpContext) -> None: ctx.obj = PulpMigrationPlanContext(pulp_ctx) plan.add_command(list_command()) plan.add_command(show_command(decorators=[href_option])) plan.add_command(destroy_command(decorators=[href_option])) create_options = [click.option("--plan", required=True, help="Migration plan in JSON format")] plan.add_command(create_command(decorators=create_options)) @plan.command(help="Run migration plan") @click.option("--href", required=True, help="HREF of the plan") @pass_entity_context def run(plan_ctx: PulpMigrationPlanContext, href: str) -> None: plan_ctx.run(href) @plan.command(help="Reset Pulp 3 data for plugins specified in the migration plan") @click.option("--href", required=True, help="HREF of the plan") @pass_entity_context def reset(plan_ctx: PulpMigrationPlanContext, href: str) -> None: plan_ctx.reset(href)
) @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())
_ = gettext.gettext @click.group() @click.option( "-t", "--type", "namespace_type", type=click.Choice(["container"], case_sensitive=False), default="container", ) @pass_pulp_context @click.pass_context def namespace(ctx: click.Context, pulp_ctx: PulpContext, namespace_type: str) -> None: if namespace_type == "container": ctx.obj = PulpContainerNamespaceContext(pulp_ctx) else: raise NotImplementedError() lookup_options = [href_option, name_option] create_options = [ click.option("--name", required=True), ] namespace.add_command(list_command()) namespace.add_command(show_command(decorators=lookup_options)) namespace.add_command(create_command(decorators=create_options)) namespace.add_command(destroy_command(decorators=lookup_options))
lookup_options = [href_option, name_option] 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
@click.group(help=_("Manage user groups and their granted permissions.")) @pass_pulp_context @click.pass_context def group(ctx: click.Context, pulp_ctx: PulpContext) -> None: ctx.obj = PulpGroupContext(pulp_ctx) lookup_options = [name_option, href_option] create_options = [click.option("--name", required=True)] group.add_command(list_command()) group.add_command(show_command(decorators=lookup_options)) group.add_command(destroy_command(decorators=lookup_options)) group.add_command(create_command(decorators=create_options)) group.add_command( role_command(decorators=lookup_options, needs_plugins=[PluginRequirement("core", min="3.17")])) @group.group() @click.option( "-t", "--type", "perm_type", type=click.Choice(["model", "object"], case_sensitive=False), default="model", ) @pass_entity_context @pass_pulp_context
type=click.Choice(["python"], case_sensitive=False), default="python", ) @pass_pulp_context @click.pass_context def remote(ctx: click.Context, pulp_ctx: PulpContext, remote_type: str) -> None: if remote_type == "python": ctx.obj = PulpPythonRemoteContext(pulp_ctx) else: raise NotImplementedError() lookup_options = [href_option, name_option] create_options = [ click.option("--name", required=True), ] python_remote_options = [ click.option("--url"), click.option("--includes", callback=load_json_callback, help=_("Package allowlist")), click.option("--excludes", callback=load_json_callback, help=_("Package blocklist")), click.option("--prereleases", type=click.BOOL, default=True), ] remote.add_command(list_command(decorators=[label_select_option])) remote.add_command(show_command(decorators=lookup_options)) remote.add_command(destroy_command(decorators=lookup_options)) remote.add_command(create_command(decorators=create_options + python_remote_options)) remote.add_command(update_command(decorators=lookup_options + python_remote_options)) remote.add_command(label_command()) # TODO Add support for 'from_bandersnatch' remote create endpoint