Skip to content

Commit

Permalink
Merge branch 'stable' into bkr-fix-semver-release-tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
BeArchiTek authored Dec 11, 2024
2 parents 2e8f750 + 358575d commit 9a74455
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion backend/infrahub/cli/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
from infrahub.core.validators.models.validate_migration import SchemaValidateMigrationData
from infrahub.database import DatabaseType
from infrahub.log import get_logger
from infrahub.services import InfrahubServices
from infrahub.services import InfrahubServices, services
from infrahub.services.adapters.message_bus.local import BusSimulator
from infrahub.services.adapters.workflow.local import WorkflowLocalExecution
from infrahub.workflows.catalogue import SCHEMA_APPLY_MIGRATION, SCHEMA_VALIDATE_MIGRATION
Expand Down Expand Up @@ -214,6 +214,7 @@ async def update_core_schema( # pylint: disable=too-many-statements
service = InfrahubServices(
database=db, message_bus=BusSimulator(database=db), workflow=WorkflowLocalExecution()
)
services.prepare(service)
await initialize_registry(db=db)

default_branch = registry.get_branch_from_registry(branch=registry.default_branch)
Expand Down
2 changes: 1 addition & 1 deletion backend/infrahub/core/attribute.py
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ async def from_graphql(self, data: dict, db: InfrahubDatabase) -> bool:
changed = True
elif "from_pool" in data:
self.from_pool = data["from_pool"]
await self.node.process_pool(db=db, attribute=self, errors=[])
await self.node.handle_pool(db=db, attribute=self, errors=[])
changed = True

if changed and self.is_from_profile:
Expand Down
4 changes: 2 additions & 2 deletions backend/infrahub/core/node/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ async def init(

return cls(**attrs)

async def process_pool(self, db: InfrahubDatabase, attribute: BaseAttribute, errors: list) -> None:
async def handle_pool(self, db: InfrahubDatabase, attribute: BaseAttribute, errors: list) -> None:
"""Evaluate if a resource has been requested from a pool and apply the resource
This method only works on number pools, currently Integer is the only type that has the from_pool
Expand Down Expand Up @@ -336,7 +336,7 @@ async def _process_fields(self, fields: dict, db: InfrahubDatabase) -> None:
)
if not self._existing:
attribute: BaseAttribute = getattr(self, attr_schema.name)
await self.process_pool(db=db, attribute=attribute, errors=errors)
await self.handle_pool(db=db, attribute=attribute, errors=errors)

attribute.validate(value=attribute.value, name=attribute.name, schema=attribute.schema)
except ValidationError as exc:
Expand Down
1 change: 1 addition & 0 deletions changelog/4807.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix error when `pool` was used a relationship name

0 comments on commit 9a74455

Please sign in to comment.