diff --git a/CHANGELOG.md b/CHANGELOG.md index 92431bb811d..7914ff11704 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,13 +4,16 @@ - New Dockerfile to support specific db adapters and platforms. See docker/README.md for details ([#4495](https://github.com/dbt-labs/dbt-core/issues/4495), [#4487](https://github.com/dbt-labs/dbt-core/pull/4487)) ### Fixes - -* Add project name validation to `dbt init` ([#4490](https://github.com/dbt-labs/dbt-core/issues/4490),[#4536](https://github.com/dbt-labs/dbt-core/pull/4536)) +- User wasn't asked for permission to overwite a profile entry when running init inside an existing project ([#4375](https://github.com/dbt-labs/dbt-core/issues/4375), [#4447](https://github.com/dbt-labs/dbt-core/pull/4447)) +- Add project name validation to `dbt init` ([#4490](https://github.com/dbt-labs/dbt-core/issues/4490),[#4536](https://github.com/dbt-labs/dbt-core/pull/4536)) ### Under the hood - Testing cleanup ([#4496](https://github.com/dbt-labs/dbt-core/pull/4496), [#4509](https://github.com/dbt-labs/dbt-core/pull/4509)) - Clean up test deprecation warnings ([#3988](https://github.com/dbt-labs/dbt-core/issue/3988), [#4556](https://github.com/dbt-labs/dbt-core/pull/4556)) +Contributors: +- [@NiallRees](https://github.com/NiallRees) ([#4447](https://github.com/dbt-labs/dbt-core/pull/4447)) + ## dbt-core 1.0.2 (TBD) ### Fixes diff --git a/core/dbt/task/init.py b/core/dbt/task/init.py index daba2d3af62..1f1d0daa182 100644 --- a/core/dbt/task/init.py +++ b/core/dbt/task/init.py @@ -297,6 +297,8 @@ def run(self): # just setup the user's profile. fire_event(SettingUpProfile()) profile_name = self.get_profile_name_from_current_project() + if not self.check_if_can_write_profile(profile_name=profile_name): + return # If a profile_template.yml exists in the project root, that effectively # overrides the profile_template.yml for the given target. profile_template_path = Path("profile_template.yml") @@ -308,8 +310,6 @@ def run(self): return except Exception: fire_event(InvalidProfileTemplateYAML()) - if not self.check_if_can_write_profile(profile_name=profile_name): - return adapter = self.ask_for_adapter_choice() self.create_profile_from_target( adapter, profile_name=profile_name