Skip to content

Commit

Permalink
Remove open command rather than fixing issue #7774
Browse files Browse the repository at this point in the history
  • Loading branch information
VersusFacit committed Jun 3, 2023
1 parent f7cc0ed commit 24e2d47
Show file tree
Hide file tree
Showing 7 changed files with 1 addition and 53 deletions.
1 change: 0 additions & 1 deletion core/dbt/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,6 @@ def show(ctx, **kwargs):
# dbt debug
@cli.command("debug")
@click.pass_context
@p.config_dir
@p.profile
@p.profiles_dir_exists_false
@p.project_dir
Expand Down
7 changes: 0 additions & 7 deletions core/dbt/cli/params.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,6 @@
default=True,
)

config_dir = click.option(
"--config-dir",
envvar=None,
help="Show the configured location for the profiles.yml file and exit",
is_flag=True,
)

debug = click.option(
"--debug/--no-debug",
"-d/ ",
Expand Down
12 changes: 0 additions & 12 deletions core/dbt/clients/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,18 +323,6 @@ def path_is_symlink(path: str) -> bool:
return os.path.islink(path)


def open_dir_cmd() -> str:
# https://docs.python.org/2/library/sys.html#sys.platform
if sys.platform == "win32":
return "start"

elif sys.platform == "darwin":
return "open"

else:
return "xdg-open"


def _handle_posix_cwd_error(exc: OSError, cwd: str, cmd: List[str]) -> NoReturn:
if exc.errno == errno.ENOENT:
message = "Directory does not exist"
Expand Down
11 changes: 0 additions & 11 deletions core/dbt/events/types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2045,17 +2045,6 @@ message FinishedCleanPathsMsg {
FinishedCleanPaths data = 2;
}

// Z016
message OpenCommand {
string open_cmd = 1;
string profiles_dir = 2;
}

message OpenCommandMsg {
EventInfo info = 1;
OpenCommand data = 2;
}

// Z017
message Formatting {
string msg = 1;
Expand Down
12 changes: 0 additions & 12 deletions core/dbt/events/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -1995,18 +1995,6 @@ def message(self) -> str:
return "Finished cleaning all paths."


class OpenCommand(InfoLevel):
def code(self):
return "Z016"

def message(self) -> str:
msg = f"""To view your profiles.yml file, run:
{self.open_cmd} {self.profiles_dir}"""

return msg


# We use events to create console output, but also think of them as a sequence of important and
# meaningful occurrences to be used for debugging and monitoring. The Formatting event helps eases
# the tension between these two goals by allowing empty lines, heading separators, and other
Expand Down
10 changes: 1 addition & 9 deletions core/dbt/task/debug.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

from dbt.events.functions import fire_event
from dbt.events.types import (
OpenCommand,
DebugCmdOut,
DebugCmdResult,
)
Expand Down Expand Up @@ -93,15 +92,7 @@ def project_profile(self):
return None
return self.project.profile_name

def path_info(self):
open_cmd = dbt.clients.system.open_dir_cmd()
fire_event(OpenCommand(open_cmd=open_cmd, profiles_dir=self.profiles_dir))

def run(self):
if self.args.config_dir:
self.path_info()
return not self.any_failure

version = get_installed_version().to_version_string(skip_matcher=True)

# Collect metadata needed to log debug information
Expand All @@ -115,6 +106,7 @@ def run(self):
fire_event(DebugCmdOut(msg="python version: {}".format(sys.version.split()[0])))
fire_event(DebugCmdOut(msg="python path: {}".format(sys.executable)))
fire_event(DebugCmdOut(msg="os info: {}".format(platform.platform())))
fire_event(DebugCmdOut(msg="Using profiles dir at {}".format(self.profiles_dir)))
fire_event(DebugCmdOut(msg="Using profiles.yml file at {}".format(self.profile_path)))
fire_event(DebugCmdOut(msg="Using dbt_project.yml file at {}".format(self.project_path)))

Expand Down
1 change: 0 additions & 1 deletion tests/unit/test_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,6 @@ def test_event_codes(self):
types.ConfirmCleanPath(path=""),
types.ProtectedCleanPath(path=""),
types.FinishedCleanPaths(),
types.OpenCommand(open_cmd="", profiles_dir=""),
types.RunResultWarning(resource_type="", node_name="", path=""),
types.RunResultFailure(resource_type="", node_name="", path=""),
types.StatsLine(stats={"error": 0, "skip": 0, "pass": 0, "warn": 0, "total": 0}),
Expand Down

0 comments on commit 24e2d47

Please sign in to comment.