From eba0f7a54f5d08dc91e331af3edad9f0fbf196a3 Mon Sep 17 00:00:00 2001 From: Revant Nandgaonkar Date: Mon, 27 Feb 2023 10:58:33 +0530 Subject: [PATCH 01/16] fix: easy-install for letsencrypt tls (#1424) * fix: easy-install for letsencrypt tls * ci: change site for easy-install test * ci: set host header for easy-install ping test --- .github/workflows/easy-install.yml | 4 +- easy-install.py | 90 +++++++++++++++++------------- 2 files changed, 53 insertions(+), 41 deletions(-) diff --git a/.github/workflows/easy-install.yml b/.github/workflows/easy-install.yml index 85c095c8..9f3f3602 100644 --- a/.github/workflows/easy-install.yml +++ b/.github/workflows/easy-install.yml @@ -25,8 +25,8 @@ jobs: run: | python3 ${GITHUB_WORKSPACE}/easy-install.py -p -n actions_test --email test@frappe.io docker compose -p actions_test exec backend bench version --format json - docker compose -p actions_test exec backend bench --site site1.local list-apps --format json - result=$(curl -sk https://127.0.0.1/api/method/ping | jq -r ."message") + docker compose -p actions_test exec backend bench --site site1.localhost list-apps --format json + result=$(curl -H "Host: site1.localhost" -sk https://127.0.0.1/api/method/ping | jq -r ."message") if [[ "$result" == "pong" ]]; then echo "New instance works fine"; else exit 1; fi docker compose -p actions_test down docker volume prune -f diff --git a/easy-install.py b/easy-install.py index e81fb318..27e56514 100755 --- a/easy-install.py +++ b/easy-install.py @@ -73,13 +73,13 @@ def get_from_env(dir, file) -> Dict: def write_to_env( wd: str, - site: str, + sites: list[str], db_pass: str, admin_pass: str, email: str, erpnext_version: str = None, ) -> None: - site_name = site or "" + quoted_sites = ",".join([f"`{site}`" for site in sites]).strip(",") example_env = get_from_env(wd, "example.env") erpnext_version = erpnext_version or example_env["ERPNEXT_VERSION"] with open(os.path.join(wd, ".env"), "w") as f: @@ -93,8 +93,8 @@ def write_to_env( "REDIS_QUEUE=redis-queue:6379\n", "REDIS_SOCKETIO=redis-socketio:6379\n", f"LETSENCRYPT_EMAIL={email}\n", - f"FRAPPE_SITE_NAME_HEADER={site_name}\n", - f"SITE_ADMIN_PASS={admin_pass}", + f"SITE_ADMIN_PASS={admin_pass}\n", + f"SITES={quoted_sites}\n", ] ) @@ -114,7 +114,7 @@ def check_repo_exists() -> bool: return os.path.exists(os.path.join(os.getcwd(), "frappe_docker")) -def setup_prod(project: str, sitename: str, email: str, version: str = None) -> None: +def setup_prod(project: str, sites: list[str], email: str, version: str = None) -> None: if check_repo_exists(): compose_file_name = os.path.join(os.path.expanduser("~"), f"{project}-compose.yml") docker_repo_path = os.path.join(os.getcwd(), "frappe_docker") @@ -129,7 +129,7 @@ def setup_prod(project: str, sitename: str, email: str, version: str = None) -> if not os.path.exists(os.path.join(docker_repo_path, ".env")): admin_pass = generate_pass() db_pass = generate_pass(9) - write_to_env(docker_repo_path, sitename, db_pass, admin_pass, email, version) + write_to_env(docker_repo_path, sites, db_pass, admin_pass, email, version) cprint( "\nA .env file is generated with basic configs. Please edit it to fit to your needs \n", level=3, @@ -193,40 +193,13 @@ def setup_prod(project: str, sitename: str, email: str, version: str = None) -> cprint(" Docker Compose failed, please check the container logs\n", e) sys.exit(1) - cprint(f"\nCreating site: {sitename} \n", level=3) + for sitename in sites: + create_site(sitename, project, db_pass, admin_pass) - try: - subprocess.run( - [ - which("docker"), - "compose", - "-p", - project, - "exec", - "backend", - "bench", - "new-site", - sitename, - "--no-mariadb-socket", - "--db-root-password", - db_pass, - "--admin-password", - admin_pass, - "--install-app", - "erpnext", - "--set-default", - ], - check=True, - ) - logging.info("New site creation completed") - except Exception as e: - logging.error("Bench site creation failed", exc_info=True) - cprint("Bench Site creation failed\n", e) - sys.exit(1) else: install_docker() clone_frappe_docker_repo() - setup_prod(project, sitename, email, version) # Recursive + setup_prod(project, sites, email, version) # Recursive def setup_dev_instance(project: str): @@ -294,6 +267,43 @@ def install_docker(): sys.exit(1) +def create_site( + sitename: str, + project: str, + db_pass: str, + admin_pass: str, +): + cprint(f"\nCreating site: {sitename} \n", level=3) + + try: + subprocess.run( + [ + which("docker"), + "compose", + "-p", + project, + "exec", + "backend", + "bench", + "new-site", + sitename, + "--no-mariadb-socket", + "--db-root-password", + db_pass, + "--admin-password", + admin_pass, + "--install-app", + "erpnext", + "--set-default", + ], + check=True, + ) + logging.info("New site creation completed") + except Exception as e: + logging.error(f"Bench site creation failed for {sitename}", exc_info=True) + cprint(f"Bench Site creation failed for {sitename}\n", e) + + if __name__ == "__main__": parser = argparse.ArgumentParser(description="Install Frappe with Docker") parser.add_argument( @@ -305,8 +315,10 @@ if __name__ == "__main__": parser.add_argument( "-s", "--sitename", - help="The Site Name for your production site", - default="site1.local", + help="Site Name(s) for your production bench", + default=["site1.localhost"], + action='append', + dest='sites' ) parser.add_argument("-n", "--project", help="Project Name", default="frappe") parser.add_argument( @@ -326,6 +338,6 @@ if __name__ == "__main__": if "example.com" in args.email: cprint("Emails with example.com not acceptable", level=1) sys.exit(1) - setup_prod(args.project, args.sitename, args.email, args.version) + setup_prod(args.project, args.sites, args.email, args.version) else: parser.print_help() From 4ec73c3b92065c6c31976e201feb9188dd23836e Mon Sep 17 00:00:00 2001 From: Saif Ur Rehman Date: Mon, 27 Feb 2023 13:46:51 +0500 Subject: [PATCH 02/16] fix: add customer background workers in group (#1439) --- bench/config/templates/supervisor.conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bench/config/templates/supervisor.conf b/bench/config/templates/supervisor.conf index f29c1673..edf00cf4 100644 --- a/bench/config/templates/supervisor.conf +++ b/bench/config/templates/supervisor.conf @@ -182,12 +182,12 @@ programs={{ bench_name }}-frappe-web {%- if node -%} ,{{ bench_name }}-node-sock {% if use_rq %} [group:{{ bench_name }}-workers] -programs={{ bench_name }}-frappe-schedule,{{ bench_name }}-frappe-default-worker,{{ bench_name }}-frappe-short-worker,{{ bench_name }}-frappe-long-worker +programs={{ bench_name }}-frappe-schedule,{{ bench_name }}-frappe-default-worker,{{ bench_name }}-frappe-short-worker,{{ bench_name }}-frappe-long-worker{%- for worker_name in workers -%},{{ bench_name }}-frappe-{{ worker_name }}-worker{%- endfor %} {% else %} [group:{{ bench_name }}-workers] -programs={{ bench_name }}-frappe-workerbeat,{{ bench_name }}-frappe-worker,{{ bench_name }}-frappe-longjob-worker,{{ bench_name }}-frappe-async-worker +programs={{ bench_name }}-frappe-workerbeat,{{ bench_name }}-frappe-worker,{{ bench_name }}-frappe-longjob-worker,{{ bench_name }}-frappe-async-worker{%- for worker_name in workers -%},{{ bench_name }}-frappe-{{ worker_name }}-worker{%- endfor %} {% endif %} From 9fb55e6dcac40183306e134b265ded0037f4f2cf Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Tue, 28 Feb 2023 10:24:41 +0530 Subject: [PATCH 03/16] chore: remove unsupported annotations these annotations dont work on python <3.9 closes https://github.com/frappe/bench/issues/1440 --- easy-install.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/easy-install.py b/easy-install.py index 27e56514..dfb3040d 100755 --- a/easy-install.py +++ b/easy-install.py @@ -73,7 +73,7 @@ def get_from_env(dir, file) -> Dict: def write_to_env( wd: str, - sites: list[str], + sites, db_pass: str, admin_pass: str, email: str, @@ -317,8 +317,8 @@ if __name__ == "__main__": "--sitename", help="Site Name(s) for your production bench", default=["site1.localhost"], - action='append', - dest='sites' + action="append", + dest="sites", ) parser.add_argument("-n", "--project", help="Project Name", default="frappe") parser.add_argument( From f7a0d281748019a3e26d40d073135df1e82cc107 Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Wed, 1 Mar 2023 10:26:54 +0530 Subject: [PATCH 04/16] chore: remove unsupported annotations closes https://github.com/frappe/bench/issues/1441 --- easy-install.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/easy-install.py b/easy-install.py index dfb3040d..f703419f 100755 --- a/easy-install.py +++ b/easy-install.py @@ -114,7 +114,7 @@ def check_repo_exists() -> bool: return os.path.exists(os.path.join(os.getcwd(), "frappe_docker")) -def setup_prod(project: str, sites: list[str], email: str, version: str = None) -> None: +def setup_prod(project: str, sites, email: str, version: str = None) -> None: if check_repo_exists(): compose_file_name = os.path.join(os.path.expanduser("~"), f"{project}-compose.yml") docker_repo_path = os.path.join(os.getcwd(), "frappe_docker") From fd6dfc3ae77b9df84373b7e7df19e7ca29333506 Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Wed, 1 Mar 2023 10:36:50 +0530 Subject: [PATCH 05/16] ci: run easy install test with lower python version (#1442) --- .github/workflows/easy-install.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/easy-install.yml b/.github/workflows/easy-install.yml index 9f3f3602..e9ccc03f 100644 --- a/.github/workflows/easy-install.yml +++ b/.github/workflows/easy-install.yml @@ -21,6 +21,11 @@ jobs: name: Easy Install Test steps: - uses: actions/checkout@v3 + + - uses: actions/setup-python@v4 + with: + python-version: '3.8' + - name: Perform production easy install run: | python3 ${GITHUB_WORKSPACE}/easy-install.py -p -n actions_test --email test@frappe.io From 934b2677c8e2fdfb05ff764e5ff85b18ea28e491 Mon Sep 17 00:00:00 2001 From: Sagar Vora Date: Wed, 3 May 2023 13:52:01 +0530 Subject: [PATCH 06/16] chore: fix typo (#1448) --- bench/app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bench/app.py b/bench/app.py index 72f4825a..797ec400 100755 --- a/bench/app.py +++ b/bench/app.py @@ -315,7 +315,7 @@ def get_excluded_apps(bench_path="."): def add_to_excluded_apps_txt(app, bench_path="."): if app == "frappe": - raise ValueError("Frappe app cannot be excludeed from update") + raise ValueError("Frappe app cannot be excluded from update") if app not in os.listdir("apps"): raise ValueError(f"The app {app} does not exist") apps = get_excluded_apps(bench_path=bench_path) From f3b55f7785710cf293aaa00a087b1bd7e760e7cf Mon Sep 17 00:00:00 2001 From: Alok Singh Date: Thu, 4 May 2023 17:28:34 +0530 Subject: [PATCH 07/16] fix: resolve filesystem app dependencies (#1450) * fix: resolve private app dependencies * fix: removed additional check and moved self.on_disk to previous check. --- bench/app.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/bench/app.py b/bench/app.py index 797ec400..25724b5d 100755 --- a/bench/app.py +++ b/bench/app.py @@ -81,17 +81,15 @@ class AppMeta: if not self.is_repo: self.repo = self.app_name = self.name return + # fetch meta from installed apps if self.bench and os.path.exists(os.path.join(self.bench.name, "apps", self.name)): self.mount_path = os.path.join(self.bench.name, "apps", self.name) self.from_apps = True - self._setup_details_from_mounted_disk() - - # fetch meta for repo on mounted disk - elif os.path.exists(self.mount_path): self.on_disk = True self._setup_details_from_mounted_disk() + # fetch meta for repo from remote git server - traditional get-app url elif is_git_url(self.name): self.is_url = True From 082692cae2ceb26564e54d744531ac90c771188b Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Tue, 9 May 2023 21:31:33 +0530 Subject: [PATCH 08/16] Revert "fix: resolve filesystem app dependencies (#1450)" (#1452) This reverts commit f3b55f7785710cf293aaa00a087b1bd7e760e7cf. --- bench/app.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bench/app.py b/bench/app.py index 25724b5d..797ec400 100755 --- a/bench/app.py +++ b/bench/app.py @@ -81,14 +81,16 @@ class AppMeta: if not self.is_repo: self.repo = self.app_name = self.name return - # fetch meta from installed apps if self.bench and os.path.exists(os.path.join(self.bench.name, "apps", self.name)): self.mount_path = os.path.join(self.bench.name, "apps", self.name) self.from_apps = True - self.on_disk = True self._setup_details_from_mounted_disk() + # fetch meta for repo on mounted disk + elif os.path.exists(self.mount_path): + self.on_disk = True + self._setup_details_from_mounted_disk() # fetch meta for repo from remote git server - traditional get-app url elif is_git_url(self.name): From a1d2c5226b598ed4cfbb0a67b943bb6ab1ae825c Mon Sep 17 00:00:00 2001 From: Gavin D'souza Date: Fri, 21 Apr 2023 15:19:04 +0530 Subject: [PATCH 09/16] fix: Print failing command with CommandFailedError I've seen way too many issues being faced / misunderstandings due to the lack of "cmd" --- bench/utils/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bench/utils/__init__.py b/bench/utils/__init__.py index b9e0cced..3fe17ad2 100644 --- a/bench/utils/__init__.py +++ b/bench/utils/__init__.py @@ -155,7 +155,7 @@ def exec_cmd(cmd, cwd=".", env=None, _raise=True): if return_code: logger.warning(f"{cmd_log} executed with exit code {return_code}") if _raise: - raise CommandFailedError from subprocess.CalledProcessError(return_code, cmd) + raise CommandFailedError(cmd) from subprocess.CalledProcessError(return_code, cmd) return return_code From 817523943414345bdd161b50c263f634b7a8f70d Mon Sep 17 00:00:00 2001 From: Gavin D'souza Date: Fri, 21 Apr 2023 15:48:33 +0530 Subject: [PATCH 10/16] fix: Hide irrelevant stacks during exc raise --- bench/cli.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/bench/cli.py b/bench/cli.py index 7f262407..8ced2ef1 100755 --- a/bench/cli.py +++ b/bench/cli.py @@ -118,6 +118,8 @@ def cli(): _opts = [x.opts + x.secondary_opts for x in bench_command.params] opts = {item for sublist in _opts for item in sublist} + setup_exception_handler() + # handle usages like `--use-feature='feat-x'` and `--use-feature 'feat-x'` if cmd_from_sys and cmd_from_sys.split("=", 1)[0].strip() in opts: bench_command() @@ -240,3 +242,17 @@ def setup_clear_cache(): return f(*args, **kwargs) os.chdir = _chdir + + +def setup_exception_handler(): + from traceback import format_exception + + def handle_exception(exc_type, exc_info, tb): + print("".join(generate_exc(exc_type, exc_info, tb))) + + def generate_exc(exc_type, exc_info, tb): + for t in format_exception(exc_type, exc_info, tb): + if "/click/" not in t: + yield t + + sys.excepthook = handle_exception From 94a1b8c3fb8bee513c02841f48a2d05ccaab6a53 Mon Sep 17 00:00:00 2001 From: Gavin D'souza Date: Wed, 10 May 2023 15:40:11 +0530 Subject: [PATCH 11/16] fix: Setup exception handler for CommandFailedError only * Match only certain module lib paths --- bench/cli.py | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/bench/cli.py b/bench/cli.py index 8ced2ef1..215d47cd 100755 --- a/bench/cli.py +++ b/bench/cli.py @@ -28,6 +28,8 @@ from bench.utils import ( get_cmd_from_sysargv, ) from bench.utils.bench import get_env_cmd +from importlib.util import find_spec + # these variables are used to show dynamic outputs on the terminal dynamic_feed = False @@ -38,6 +40,7 @@ bench.LOG_BUFFER = [] change_uid_msg = "You should not run this command as root" src = os.path.dirname(__file__) +SKIP_MODULE_TRACEBACK = ("click",) @contextmanager @@ -246,13 +249,22 @@ def setup_clear_cache(): def setup_exception_handler(): from traceback import format_exception + from bench.exceptions import CommandFailedError def handle_exception(exc_type, exc_info, tb): - print("".join(generate_exc(exc_type, exc_info, tb))) + if exc_type == CommandFailedError: + print("".join(generate_exc(exc_type, exc_info, tb))) + else: + sys.__excepthook__(exc_type, exc_info, tb) def generate_exc(exc_type, exc_info, tb): - for t in format_exception(exc_type, exc_info, tb): - if "/click/" not in t: - yield t + TB_SKIP = [ + os.path.dirname(find_spec(module).origin) for module in SKIP_MODULE_TRACEBACK + ] + + for tb_line in format_exception(exc_type, exc_info, tb): + for skip_module in TB_SKIP: + if skip_module not in tb_line: + yield tb_line sys.excepthook = handle_exception From 3af6058d1bb41025a65b423af028657fe88500f0 Mon Sep 17 00:00:00 2001 From: Gavin D'souza Date: Fri, 21 Apr 2023 15:05:16 +0530 Subject: [PATCH 12/16] fix: Archive app for different repo/app names --- bench/app.py | 4 ++-- bench/bench.py | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/bench/app.py b/bench/app.py index 797ec400..95135278 100755 --- a/bench/app.py +++ b/bench/app.py @@ -198,7 +198,7 @@ class App(AppMeta): @step(title="Archiving App {repo}", success="App {repo} Archived") def remove(self, no_backup: bool = False): - active_app_path = os.path.join("apps", self.repo) + active_app_path = os.path.join("apps", self.app_name) if no_backup: if not os.path.islink(active_app_path): @@ -209,7 +209,7 @@ class App(AppMeta): else: archived_path = os.path.join("archived", "apps") archived_name = get_available_folder_name( - f"{self.repo}-{date.today()}", archived_path + f"{self.app_name}-{date.today()}", archived_path ) archived_app_path = os.path.join(archived_path, archived_name) diff --git a/bench/bench.py b/bench/bench.py index cdba9018..c2c70c37 100644 --- a/bench/bench.py +++ b/bench/bench.py @@ -131,6 +131,9 @@ class Bench(Base, Validator): except InvalidRemoteException: if not force: raise + except ValueError: + pass + self.apps.sync() # self.build() - removed because it seems unnecessary self.reload(_raise=False) From 4f423923b4c0aa646e9c4f1d7a04bf10bc420f61 Mon Sep 17 00:00:00 2001 From: Gavin D'souza Date: Thu, 11 May 2023 12:55:19 +0530 Subject: [PATCH 13/16] fix: Use App.app_name over repo attr --- bench/app.py | 14 +++++++------- bench/bench.py | 4 ++-- bench/tests/test_init.py | 4 ++-- bench/tests/test_utils.py | 4 +++- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/bench/app.py b/bench/app.py index 95135278..b95718b5 100755 --- a/bench/app.py +++ b/bench/app.py @@ -233,7 +233,7 @@ class App(AppMeta): verbose = bench.cli.verbose or verbose app_name = get_app_name(self.bench.name, self.app_name) - if not resolved and self.repo != "frappe" and not ignore_resolution: + if not resolved and self.app_name != "frappe" and not ignore_resolution: click.secho( f"Ignoring dependencies of {self.name}. To install dependencies use --resolve-deps", fg="yellow", @@ -262,13 +262,13 @@ class App(AppMeta): from bench.utils.app import get_required_deps, required_apps_from_hooks if self.on_disk: - required_deps = os.path.join(self.mount_path, self.repo, "hooks.py") + required_deps = os.path.join(self.mount_path, self.app_name, "hooks.py") try: return required_apps_from_hooks(required_deps, local=True) except IndexError: return [] try: - required_deps = get_required_deps(self.org, self.repo, self.tag or self.branch) + required_deps = get_required_deps(self.org, self.app_name, self.tag or self.branch) return required_apps_from_hooks(required_deps) except Exception: return [] @@ -290,16 +290,16 @@ def make_resolution_plan(app: App, bench: "Bench"): decide what apps and versions to install and in what order """ resolution = OrderedDict() - resolution[app.repo] = app + resolution[app.app_name] = app for app_name in app._get_dependencies(): dep_app = App(app_name, bench=bench) is_valid_frappe_branch(dep_app.url, dep_app.branch) dep_app.required_by = app.name - if dep_app.repo in resolution: - click.secho(f"{dep_app.repo} is already resolved skipping", fg="yellow") + if dep_app.app_name in resolution: + click.secho(f"{dep_app.app_name} is already resolved skipping", fg="yellow") continue - resolution[dep_app.repo] = dep_app + resolution[dep_app.app_name] = dep_app resolution.update(make_resolution_plan(dep_app, bench)) app.local_resolution = [repo_name for repo_name, _ in reversed(resolution.items())] return resolution diff --git a/bench/bench.py b/bench/bench.py index c2c70c37..0f0e27d0 100644 --- a/bench/bench.py +++ b/bench/bench.py @@ -312,13 +312,13 @@ class BenchApps(MutableSequence): def add(self, app: "App"): app.get() app.install() - super().append(app.repo) + super().append(app.app_name) self.apps.sort() def remove(self, app: "App", no_backup: bool = False): app.uninstall() app.remove(no_backup=no_backup) - super().remove(app.repo) + super().remove(app.app_name) def append(self, app: "App"): return self.add(app) diff --git a/bench/tests/test_init.py b/bench/tests/test_init.py index b0a871a4..56634e67 100755 --- a/bench/tests/test_init.py +++ b/bench/tests/test_init.py @@ -28,8 +28,8 @@ class TestBenchInit(TestBenchBase): self.init_bench(bench_name, **kwargs) app = App("file:///tmp/frappe") self.assertTupleEqual( - (app.mount_path, app.url, app.repo, app.org), - ("/tmp/frappe", "file:///tmp/frappe", "frappe", "frappe"), + (app.mount_path, app.url, app.repo, app.app_name, app.org), + ("/tmp/frappe", "file:///tmp/frappe", "frappe", "frappe", "frappe"), ) self.assert_folders(bench_name) self.assert_virtual_env(bench_name) diff --git a/bench/tests/test_utils.py b/bench/tests/test_utils.py index e0137dca..2f645497 100644 --- a/bench/tests/test_utils.py +++ b/bench/tests/test_utils.py @@ -101,4 +101,6 @@ class TestUtils(unittest.TestCase): def test_ssh_ports(self): app = App("git@github.com:22:frappe/frappe") - self.assertEqual((app.use_ssh, app.org, app.repo), (True, "frappe", "frappe")) + self.assertEqual( + (app.use_ssh, app.org, app.repo, app.app_name), (True, "frappe", "frappe", "frappe") + ) From e80daf8c3e78ae5a675d5c9d1b75a92d1fe57eae Mon Sep 17 00:00:00 2001 From: Gavin D'souza Date: Wed, 31 May 2023 13:57:27 +0530 Subject: [PATCH 14/16] fix: Use == for dict comparison --- bench/utils/bench.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bench/utils/bench.py b/bench/utils/bench.py index 3fe7f85b..16fc206e 100644 --- a/bench/utils/bench.py +++ b/bench/utils/bench.py @@ -155,7 +155,7 @@ def update_npm_packages(bench_path=".", apps=None): else: package_json[key] = value - if package_json is {}: + if package_json == {}: with open(os.path.join(os.path.dirname(__file__), "package.json")) as f: package_json = json.loads(f.read()) From f7fbee99d61a9fdf727a3efe1419eceb4148fb35 Mon Sep 17 00:00:00 2001 From: Gavin D'souza Date: Wed, 31 May 2023 13:59:34 +0530 Subject: [PATCH 15/16] fix: Revert usage of app_name for repo name --- bench/app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bench/app.py b/bench/app.py index b95718b5..48fbb985 100755 --- a/bench/app.py +++ b/bench/app.py @@ -268,7 +268,7 @@ class App(AppMeta): except IndexError: return [] try: - required_deps = get_required_deps(self.org, self.app_name, self.tag or self.branch) + required_deps = get_required_deps(self.org, self.repo, self.tag or self.branch) return required_apps_from_hooks(required_deps) except Exception: return [] From d9c8335fbf3344c982b604ffd1507c4c0cd4ff11 Mon Sep 17 00:00:00 2001 From: Gavin D'souza Date: Fri, 2 Jun 2023 12:41:56 +0530 Subject: [PATCH 16/16] fix: Remove except-pass ValueError --- bench/bench.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/bench/bench.py b/bench/bench.py index 0f0e27d0..c21e3440 100644 --- a/bench/bench.py +++ b/bench/bench.py @@ -131,8 +131,6 @@ class Bench(Base, Validator): except InvalidRemoteException: if not force: raise - except ValueError: - pass self.apps.sync() # self.build() - removed because it seems unnecessary