Skip to content

Commit

Permalink
fix(ingest): handle docker-compose version v prefix (datahub-projec…
Browse files Browse the repository at this point in the history
  • Loading branch information
hsheth2 authored and cccs-Dustin committed Feb 1, 2023
1 parent 7def9b2 commit d038c17
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
6 changes: 4 additions & 2 deletions metadata-ingestion/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,13 +252,15 @@ def get_long_description():
| bigquery_common
| {"sqlalchemy-bigquery>=1.4.1", "sqllineage==1.3.6", "sqlparse"},
"bigquery-usage-legacy": bigquery_common | usage_common | {"cachetools"},
"bigquery": sql_common | bigquery_common | {"sqllineage==1.3.6", "sql_metadata", "sqlalchemy-bigquery>=1.4.1"},
"bigquery": sql_common
| bigquery_common
| {"sqllineage==1.3.6", "sql_metadata", "sqlalchemy-bigquery>=1.4.1"},
"bigquery-beta": sql_common
| bigquery_common
| {
"sqllineage==1.3.6",
"sql_metadata",
"sqlalchemy-bigquery>=1.4.1"
"sqlalchemy-bigquery>=1.4.1",
}, # deprecated, but keeping the extra for backwards compatibility
"clickhouse": sql_common | clickhouse_common,
"clickhouse-usage": sql_common | usage_common | clickhouse_common,
Expand Down
19 changes: 8 additions & 11 deletions metadata-ingestion/src/datahub/cli/docker_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,27 +226,24 @@ def _get_default_quickstart_compose_file() -> Optional[str]:
def _docker_compose_v2() -> Union[List[str], Literal[False]]:
try:
# Check for the docker compose v2 plugin.
assert (
subprocess.check_output(
["docker", "compose", "version", "--short"], stderr=subprocess.STDOUT
)
.decode()
.startswith("2.")
)
compose_version = subprocess.check_output(
["docker", "compose", "version", "--short"], stderr=subprocess.STDOUT
).decode()
assert compose_version.startswith("2.") or compose_version.startswith("v2.")
return ["docker", "compose"]
except (OSError, subprocess.CalledProcessError, AssertionError):
# We'll check for docker-compose as well.
try:
compose_version = subprocess.check_output(
["docker-compose", "version", "--short"], stderr=subprocess.STDOUT
).decode()
if compose_version.startswith("2."):
if compose_version.startswith("2.") or compose_version.startswith("v2."):
# This will happen if docker compose v2 is installed in standalone mode
# instead of as a plugin.
return ["docker-compose"]

click.secho(
"You have docker-compose v1 installed, but we require Docker Compose v2. "
f"You have docker-compose v1 ({compose_version}) installed, but we require Docker Compose v2. "
"Please upgrade to Docker Compose v2. "
"See https://docs.docker.com/compose/compose-v2/ for more information.",
fg="red",
Expand Down Expand Up @@ -274,7 +271,7 @@ def _attempt_stop(quickstart_compose_file: List[pathlib.Path]) -> None:
# docker-compose stop
compose = _docker_compose_v2()
if not compose:
return
sys.exit(1)
base_command: List[str] = [
*compose,
*itertools.chain.from_iterable(
Expand Down Expand Up @@ -739,7 +736,7 @@ def quickstart(

compose = _docker_compose_v2()
if not compose:
return
sys.exit(1)
base_command: List[str] = [
*compose,
*itertools.chain.from_iterable(
Expand Down

0 comments on commit d038c17

Please sign in to comment.