Skip to content

Commit

Permalink
fix: ignore org check fail if using cache
Browse files Browse the repository at this point in the history
  • Loading branch information
18alantom committed Feb 21, 2024
1 parent ab9b617 commit aa12aab
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
3 changes: 2 additions & 1 deletion bench/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ def _setup_details_from_mounted_disk(self):
self.tag = self.branch = None

def _setup_details_from_name_tag(self):
self.org, self.repo, self.tag = fetch_details_from_tag(self.name)
using_cached = bool(self.cache_key)
self.org, self.repo, self.tag = fetch_details_from_tag(self.name, using_cached)
self.tag = self.tag or self.branch

def _setup_details_from_git_url(self, url=None):
Expand Down
11 changes: 7 additions & 4 deletions bench/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ def get_env_frappe_commands(bench_path=".") -> List:
return []


def find_org(org_repo):
def find_org(org_repo, using_cached: bool=False):
import requests

org_repo = org_repo[0]
Expand All @@ -429,10 +429,13 @@ def find_org(org_repo):
if res.ok:
return org, org_repo

raise InvalidRemoteException(f"{org_repo} not found in frappe or erpnext")
if using_cached:
return "", org_repo

raise InvalidRemoteException(f"{org_repo} not found under frappe or erpnext GitHub accounts")

def fetch_details_from_tag(_tag: str) -> Tuple[str, str, str]:

def fetch_details_from_tag(_tag: str, using_cached: bool=False) -> Tuple[str, str, str]:
if not _tag:
raise Exception("Tag is not provided")

Expand All @@ -447,7 +450,7 @@ def fetch_details_from_tag(_tag: str) -> Tuple[str, str, str]:
try:
org, repo = org_repo
except Exception:
org, repo = find_org(org_repo)
org, repo = find_org(org_repo, using_cached)

return org, repo, tag

Expand Down

0 comments on commit aa12aab

Please sign in to comment.