feat(cli): allow to nuke without deleting data in quickstart (#3655)

This commit is contained in:
Aseem Bansal 2021-12-14 01:34:32 +05:30 committed by GitHub
parent 5b68a4dff9
commit a20821dc4d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 6 deletions

View File

@ -52,6 +52,8 @@ To cleanse DataHub of all of it's state (e.g. before ingesting your own), you ca
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
### Command not found: datahub

View File

@ -365,7 +365,14 @@ def ingest_sample_data(path: Optional[str]) -> None:
@docker.command()
@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."""
with get_client_with_error() as (client, error):
@ -381,6 +388,9 @@ def nuke() -> None:
):
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")
for volume in client.volumes.list(
filters={"label": "com.docker.compose.project=datahub"}