Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pulp-glue-console/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "pulp-glue-console"
version = "0.1.4.dev"
version = "0.1.5.dev"
description = "Version agnostic glue library to talk to pulpcore's REST API. (Console plugin)"
readme = "README.md"
requires-python = ">=3.8"
Expand Down
2 changes: 2 additions & 0 deletions pulpcore/cli/console/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def custom_parse_response(
# Continue with normal mounting
from pulpcore.cli.console.task import attach_tasks_commands
from pulpcore.cli.console.vulnerability import attach_vulnerability_commands
from pulpcore.cli.console.populated_domain import attach_domain_commands

@main.group()
def console() -> None:
Expand All @@ -40,3 +41,4 @@ def console() -> None:

attach_vulnerability_commands(console) # type: ignore
attach_tasks_commands(console) # type: ignore
attach_domain_commands(console) # type: ignore
42 changes: 42 additions & 0 deletions pulpcore/cli/console/populated_domain.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import typing as t

import click
from pulp_glue.common.context import PulpContext
from pulpcore.cli.common.generic import pass_pulp_context


@click.group()
def populated_domain() -> None:
"""Populated domain management commands."""
pass


@populated_domain.command()
@click.option("--name", required=True, help="Name of the domain to create")
@pass_pulp_context
def create(
pulp_ctx: PulpContext,
name: str,
) -> None:
"""Create a new domain using the self-service endpoint."""

data = {
"name": name,
"storage_settings": {},
"storage_class": "storages.backends.s3boto3.S3Boto3Storage",
}

try:
response = pulp_ctx.call(operation_id="api_pulp_create_domain_post", body=data)

click.echo(f"Domain '{name}' created successfully!")
click.echo(f"Domain ID: {response.get('pulp_id', 'N/A')}")

except Exception as e:
click.echo(f"Error creating domain: {str(e)}", err=True)
raise click.ClickException(f"Failed to create domain '{name}': {str(e)}")


def attach_domain_commands(main_group: click.Group) -> None:
"""Attach populated domain commands to the main console group."""
main_group.add_command(populated_domain)
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "pulp-cli-console"
version = "0.1.4.dev"
version = "0.1.5.dev"
description = "Command line interface to talk to pulpcore's REST API. (Console plugin commands)"
readme = "README.md"
requires-python = ">=3.8"
Expand All @@ -25,7 +25,7 @@ classifiers=[
]
dependencies = [
"pulp-cli>=0.23.1,<0.36",
"pulp-glue-console==0.1.4.dev"
"pulp-glue-console==0.1.5.dev"
]

[project.urls]
Expand Down
Loading