From cb7bc8073bd4102457e513950be1e0328e09328c Mon Sep 17 00:00:00 2001 From: Michel El Nacouzi Date: Thu, 19 Sep 2024 15:09:20 -0400 Subject: [PATCH] Fix app role None with ws commands (#1601) --- .../cli/_plugins/nativeapp/application_entity.py | 6 +++--- tests_integration/nativeapp/test_post_deploy.py | 15 +++++++++++++-- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/snowflake/cli/_plugins/nativeapp/application_entity.py b/src/snowflake/cli/_plugins/nativeapp/application_entity.py index bfe4e91f56..5864dfb585 100644 --- a/src/snowflake/cli/_plugins/nativeapp/application_entity.py +++ b/src/snowflake/cli/_plugins/nativeapp/application_entity.py @@ -107,9 +107,9 @@ def action_deploy( app_name = model.fqn.identifier debug_mode = model.debug if model.meta: - app_role = getattr(model.meta, "role", ctx.default_role) - app_warehouse = getattr(model.meta, "warehouse", ctx.default_warehouse) - post_deploy_hooks = getattr(model.meta, "post_deploy", None) + app_role = model.meta.role or ctx.default_role + app_warehouse = model.meta.warehouse or ctx.default_warehouse + post_deploy_hooks = model.meta.post_deploy else: app_role = ctx.default_role app_warehouse = ctx.default_warehouse diff --git a/tests_integration/nativeapp/test_post_deploy.py b/tests_integration/nativeapp/test_post_deploy.py index ee9fe6f817..bf86b080b3 100644 --- a/tests_integration/nativeapp/test_post_deploy.py +++ b/tests_integration/nativeapp/test_post_deploy.py @@ -14,8 +14,13 @@ def run(runner, base_command, args): - # TODO Run "ws deploy --entity-id=app" once ApplicationEntity deploy is implemented - result = runner.invoke_with_connection_json(["app", "run"] + args) + if base_command == "ws": + result = runner.invoke_with_connection_json( + ["ws", "deploy", "--entity-id", "app"] + args + ) + else: + result = runner.invoke_with_connection_json(["app", "run"] + args) + assert result.exit_code == 0 @@ -92,6 +97,12 @@ def test_nativeapp_post_deploy( is_versioned, with_project_flag, ): + + if base_command == "ws" and is_versioned: + pytest.skip( + "TODO: ws commands do not support deploying applications from versions yet" + ) + version = "v1" project_name = "myapp" app_name = f"{project_name}_{default_username}{resource_suffix}"