Skip to content

Commit 835f5e9

Browse files
authored
fix lock initialization for upgrades (#7556)
1 parent acb4f40 commit 835f5e9

File tree

4 files changed

+7
-3
lines changed

4 files changed

+7
-3
lines changed

backend/infrahub/cli/upgrade.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
from infrahub.core.manager import NodeManager
2121
from infrahub.core.protocols import CoreAccount, CoreObjectPermission
2222
from infrahub.dependencies.registry import build_component_registry
23+
from infrahub.lock import initialize_lock
2324
from infrahub.menu.menu import default_menu
2425
from infrahub.menu.models import MenuDict
2526
from infrahub.menu.repository import MenuRepository
@@ -66,6 +67,7 @@ async def upgrade_cmd(
6667
dbdriver = await context.init_db(retry=1)
6768

6869
await initialize_registry(db=dbdriver)
70+
initialize_lock()
6971

7072
build_component_registry()
7173

backend/infrahub/core/migrations/graph/load_schema_branch.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,6 @@ async def get_or_load_schema_branch(db: InfrahubDatabase, branch: Branch) -> Sch
1616
registry.schema = schema_manager
1717
internal_schema_root = SchemaRoot(**internal_schema)
1818
registry.schema.register_schema(schema=internal_schema_root)
19-
return await registry.schema.load_schema_from_db(db=db, branch=branch)
19+
schema_branch = await registry.schema.load_schema_from_db(db=db, branch=branch)
20+
registry.schema.set_schema_branch(name=branch.name, schema=schema_branch)
21+
return schema_branch

backend/infrahub/core/migrations/graph/m041_profile_attrs_in_db.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ async def _do_execute_for_branch(self, db: InfrahubDatabase, branch: Branch) ->
112112
node_ids_to_update: set[str] = set()
113113
with Progress() as progress:
114114
gather_nodes_task = progress.add_task(
115-
"Gathering affected objects for each profile on branch {branch.name}...", total=len(profiles_map)
115+
f"Gathering affected objects for each profile on branch {branch.name}...", total=len(profiles_map)
116116
)
117117

118118
for profile in profiles_map.values():

backend/infrahub/core/migrations/graph/m043_backfill_hfid_display_label_in_db.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,7 @@ async def _do_one_schema_all(
694694
)
695695
await update_display_label_query.execute(db=db)
696696

697-
if progress and update_task:
697+
if progress is not None and update_task is not None:
698698
progress.update(update_task, advance=num_updates)
699699

700700
if num_updates == 0:

0 commit comments

Comments
 (0)