mirror of
https://github.com/datahub-project/datahub.git
synced 2025-12-17 21:14:34 +00:00
feat(cli): allow to nuke without deleting data in quickstart (#3655)
This commit is contained in:
parent
5b68a4dff9
commit
a20821dc4d
@ -52,6 +52,8 @@ To cleanse DataHub of all of it's state (e.g. before ingesting your own), you ca
|
|||||||
datahub docker nuke
|
datahub docker nuke
|
||||||
```
|
```
|
||||||
|
|
||||||
|
If you want to delete the containers but keep the data you can add `--keep-data` flag to the command. This allows you to run the `quickstart` command to get DataHub running with your data that was ingested earlier.
|
||||||
|
|
||||||
## Troubleshooting
|
## Troubleshooting
|
||||||
|
|
||||||
### Command not found: datahub
|
### Command not found: datahub
|
||||||
|
|||||||
@ -365,7 +365,14 @@ def ingest_sample_data(path: Optional[str]) -> None:
|
|||||||
|
|
||||||
@docker.command()
|
@docker.command()
|
||||||
@telemetry.with_telemetry
|
@telemetry.with_telemetry
|
||||||
def nuke() -> None:
|
@click.option(
|
||||||
|
"--keep-data",
|
||||||
|
type=bool,
|
||||||
|
is_flag=True,
|
||||||
|
default=False,
|
||||||
|
help="Delete data volumes",
|
||||||
|
)
|
||||||
|
def nuke(keep_data: bool) -> None:
|
||||||
"""Remove all Docker containers, networks, and volumes associated with DataHub."""
|
"""Remove all Docker containers, networks, and volumes associated with DataHub."""
|
||||||
|
|
||||||
with get_client_with_error() as (client, error):
|
with get_client_with_error() as (client, error):
|
||||||
@ -381,6 +388,9 @@ def nuke() -> None:
|
|||||||
):
|
):
|
||||||
container.remove(v=True, force=True)
|
container.remove(v=True, force=True)
|
||||||
|
|
||||||
|
if keep_data:
|
||||||
|
click.echo("Skipping deleting data volumes in the datahub project")
|
||||||
|
else:
|
||||||
click.echo("Removing volumes in the datahub project")
|
click.echo("Removing volumes in the datahub project")
|
||||||
for volume in client.volumes.list(
|
for volume in client.volumes.list(
|
||||||
filters={"label": "com.docker.compose.project=datahub"}
|
filters={"label": "com.docker.compose.project=datahub"}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user