Skip to content

Commit 443792f

Browse files
blarghmateypt2302
andauthored
fix: Add necessary context for Pydantic subclasses with custom init (#2472)
* fix: Add necessary context for Pydantic subclasses with custom init * Handle other classes * Moving model rebuilding to __init__ methods --------- Co-authored-by: pt2302 <1553279+pt2302@users.noreply.github.com>
1 parent 5ce3329 commit 443792f

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

content_sync/pipelines/definitions/concourse/common/steps.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import json
2+
from typing import Optional # noqa: F401
23
from urllib.parse import urljoin
34

45
from django.conf import settings
56
from ol_concourse.lib.constants import REGISTRY_IMAGE
67
from ol_concourse.lib.models.pipeline import (
8+
AcrossVar, # noqa: F401
79
AnonymousResource,
810
Command,
911
DoStep,
@@ -117,6 +119,7 @@ def __init__( # noqa: PLR0913
117119
),
118120
**kwargs,
119121
)
122+
self.model_rebuild()
120123

121124

122125
class SlackAlertStep(TryStep):
@@ -143,6 +146,7 @@ def __init__(self, alert_type: str, text: str, **kwargs):
143146
),
144147
**kwargs,
145148
)
149+
self.model_rebuild()
146150

147151

148152
class ClearCdnCacheStep(TaskStep):
@@ -180,6 +184,7 @@ def __init__(self, name: Identifier, fastly_var: str, site_name: str, **kwargs):
180184
),
181185
**kwargs,
182186
)
187+
self.model_rebuild()
183188

184189

185190
class OcwStudioWebhookStep(TryStep):
@@ -205,6 +210,7 @@ def __init__(self, pipeline_name: str, status: str, **kwargs):
205210
),
206211
**kwargs,
207212
)
213+
self.model_rebuild()
208214

209215

210216
class OcwStudioWebhookCurlStep(TryStep):
@@ -244,6 +250,7 @@ def __init__(self, site_name: str, data: dict, **kwargs):
244250
),
245251
**kwargs,
246252
)
253+
self.model_rebuild()
247254

248255

249256
class OpenCatalogWebhookStep(TryStep):
@@ -277,6 +284,7 @@ def __init__(
277284
),
278285
**kwargs,
279286
)
287+
self.model_rebuild()
280288

281289

282290
class SiteContentGitTaskStep(TaskStep):
@@ -326,3 +334,4 @@ def __init__(self, branch: str, short_id: str, **kwargs):
326334
),
327335
**kwargs,
328336
)
337+
self.model_rebuild()

content_sync/pipelines/definitions/concourse/site_pipeline.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
from django.conf import settings
55
from ol_concourse.lib.models.pipeline import (
6+
AcrossVar, # noqa: F401
67
Command,
78
DoStep,
89
DummyConfig,
@@ -416,6 +417,7 @@ def __init__(self, web_bucket: str):
416417
if is_dev():
417418
self.params["AWS_ACCESS_KEY_ID"] = settings.AWS_ACCESS_KEY_ID
418419
self.params["AWS_SECRET_ACCESS_KEY"] = settings.AWS_SECRET_ACCESS_KEY
420+
self.model_rebuild()
419421

420422

421423
class StaticResourcesTaskStep(TaskStep):
@@ -456,6 +458,7 @@ def __init__(self, pipeline_vars: dict, *, filter_videos: bool = False):
456458
if is_dev():
457459
self.params["AWS_ACCESS_KEY_ID"] = settings.AWS_ACCESS_KEY_ID or ""
458460
self.params["AWS_SECRET_ACCESS_KEY"] = settings.AWS_SECRET_ACCESS_KEY or ""
461+
self.model_rebuild()
459462

460463

461464
class SitePipelineOnlineTasks(list[StepModifierMixin]):

0 commit comments

Comments
 (0)