Skip to content

Commit

Permalink
Merge pull request #105 from looker-open-source/fix--handle-edge-cases
Browse files Browse the repository at this point in the history
Handle edge cases
  • Loading branch information
rbob86 authored Aug 22, 2024
2 parents 4660bdd + b90b19f commit 306e10a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
5 changes: 4 additions & 1 deletion henry/commands/analyze.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ def projects(self, *, id: Optional[str] = None) -> fetcher.TResult:
assert isinstance(p.validation_required, bool)
p_files = self.sdk.all_project_files(p.name)

if "/bare_models/" in cast(str, p.git_remote_url):
if p.git_remote_url is None:
git_connection_test_results = "No repo found"
elif "/bare_models/" in cast(str, p.git_remote_url):
git_connection_test_results = "Bare repo, no tests required"
else:
git_connection_test_results = self.run_git_connection_tests(
Expand Down Expand Up @@ -102,3 +104,4 @@ def explores(
}
)
return result

10 changes: 9 additions & 1 deletion henry/modules/fetcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,14 @@ def get_explore_join_stats(
def run_git_connection_tests(self, project_id: str):
"""Run all git connection tests for a given project."""
self.sdk.update_session(models.WriteApiSession(workspace_id="dev"))
supported_tests = self.sdk.all_git_connection_tests(project_id)

try:
supported_tests = self.sdk.all_git_connection_tests(project_id, transport_options={"headers": {"Accept": "application/json"}})
except error.SDKError as e:
if e.message == "The resource you're looking for could not be found":
return "Project not found in development mode"
else:
return "Error running git connection tests"
results = []
for test in supported_tests:
assert isinstance(test.id, str)
Expand Down Expand Up @@ -427,3 +434,4 @@ class Input(NamedTuple):
quiet: bool = False
save: Optional[bool] = False
timeout: Optional[int] = 120

0 comments on commit 306e10a

Please sign in to comment.