Skip to content

Commit 55215a6

Browse files
Fix config not being verified when invoking some commands (#178)
1 parent 8e511af commit 55215a6

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@
22

33
Please use [this](https://docs.gitlab.com/ee/development/changelog.html) document as guidelines to keep a changelog.
44

5-
## 4.0.0-rc1 - [unreleased]
5+
## 4.0.0-rc2 - [unreleased]
6+
7+
### Fixed
8+
9+
* cli: Fixed config not being verified when invoking some commands
10+
11+
## 4.0.0-rc1 - 2021-12-02
612

713
### ⚠ Migration
814

src/dipdup/cli.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,8 @@ async def cli(ctx, config: List[str], env_file: List[str], logging_config: str):
147147
load_dotenv(env_path, override=True)
148148

149149
_config = DipDupConfig.load(config)
150+
# NOTE: Imports will be loaded later if needed
151+
_config.initialize(skip_imports=True)
150152
init_sentry(_config)
151153

152154
try:
@@ -160,6 +162,7 @@ async def cli(ctx, config: List[str], env_file: List[str], logging_config: str):
160162
reindex = spec_reindex_mapping[__spec_version__]
161163
raise MigrationRequiredError(_config.spec_version, __spec_version__, reindex)
162164

165+
# NOTE: Ensure that no deprecated handlers left in project after migration to v3.0.0
163166
if ctx.invoked_subcommand != 'migrate':
164167
handlers_path = join(_config.package_path, 'handlers')
165168
if set(listdir(handlers_path)).intersection(set(deprecated_handlers)):
@@ -206,7 +209,6 @@ async def run(
206209
@cli_wrapper
207210
async def init(ctx, overwrite_types: bool):
208211
config: DipDupConfig = ctx.obj.config
209-
config.initialize(skip_imports=True)
210212
dipdup = DipDup(config)
211213
await dipdup.init(overwrite_types)
212214

@@ -216,7 +218,6 @@ async def init(ctx, overwrite_types: bool):
216218
@cli_wrapper
217219
async def migrate(ctx):
218220
config: DipDupConfig = ctx.obj.config
219-
config.initialize(skip_imports=True)
220221
migrations = DipDupMigrationManager(config, ctx.obj.config_paths)
221222
await migrations.migrate()
222223

0 commit comments

Comments
 (0)