Skip to content

Commit e085b8f

Browse files
authored
Merge stable into develop #6480
Merge stable into develop
2 parents dd3a4f1 + e1a5330 commit e085b8f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+2213
-2383
lines changed

.vale/styles/spelling-exceptions.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@ REST
118118
resources
119119
schema's
120120
schema_mapping
121+
scrollbar
122+
scrollable
121123
sdk
122124
subcommand
123125
subnet

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,22 @@ This project uses [*towncrier*](https://towncrier.readthedocs.io/) and the chang
1111

1212
<!-- towncrier release notes start -->
1313

14+
## [Infrahub - v1.2.10](https://github.com/opsmill/infrahub/tree/infrahub-v1.2.10) - 2025-05-13
15+
16+
### Added
17+
<!-- vale off -->
18+
- Added the ability to use alternative value types for all attribute types with computed attributes. For attributes of type IPHost or Dropdown you can now access the `ip` or `label` fields and not only the `value` field. ([#5769](https://github.com/opsmill/infrahub/issues/5769))
19+
- Computed Attribute of kind Jinja will only be recalculated during a schema update if the template itself has been updated.
20+
<!-- vale on -->
21+
22+
### Fixed
23+
24+
- Fixes an issue where the signature of a webhook event was calculated wrongly. ([#6323](https://github.com/opsmill/infrahub/issues/6323))
25+
- Display "dissociate" action only if possible on relationships table's row actions
26+
- Fixed an issue where it wasn't possible to have a high number of choices in the Dropdown schema kinds. Previously the payload was limited to 4096 characters.
27+
- Prevent creating duplicate edges on the database when adding a relationship to or deleting a relationship from a node that had its kind or inheritance updated
28+
- Update diff and merge logic to correctly support nodes that have had their kind migrated on a branch
29+
1430
## [Infrahub - v1.2.9](https://github.com/opsmill/infrahub/tree/infrahub-v1.2.9) - 2025-05-07
1531

1632
### Added

backend/infrahub/config.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ class DatabaseSettings(BaseSettings):
269269
address: str = "localhost"
270270
port: int = 7687
271271
database: str | None = Field(default=None, pattern=VALID_DATABASE_NAME_REGEX, description="Name of the database")
272+
policy: str | None = Field(default=None, description="Routing policy for database connections")
272273
tls_enabled: bool = Field(default=False, description="Indicates if TLS is enabled for the connection")
273274
tls_insecure: bool = Field(default=False, description="Indicates if TLS certificates are verified")
274275
tls_ca_file: str | None = Field(default=None, description="File path to CA cert or bundle in PEM format")
@@ -293,6 +294,14 @@ class DatabaseSettings(BaseSettings):
293294
default=0.01, ge=0, description="Delay to add when max_concurrent_queries is reached."
294295
)
295296

297+
@property
298+
def database_uri(self) -> str:
299+
"""Constructs the database URI based on the configuration settings."""
300+
base_uri = f"{self.protocol}://{self.address}:{self.port}"
301+
if self.policy is not None:
302+
return f"{base_uri}?policy={self.policy}"
303+
return base_uri
304+
296305
@property
297306
def database_name(self) -> str:
298307
return self.database or self.db_type.value

backend/infrahub/core/constraint/node/runner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def __init__(
2626
async def check(
2727
self, node: Node, field_filters: list[str] | None = None, skip_uniqueness_check: bool = False
2828
) -> None:
29-
async with self.db.start_session() as db:
29+
async with self.db.start_session(read_only=False) as db:
3030
await node.resolve_relationships(db=db)
3131

3232
if not skip_uniqueness_check:

backend/infrahub/core/diff/tasks.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
async def update_diff(model: RequestDiffUpdate, service: InfrahubServices) -> None:
2121
await add_tags(branches=[model.branch_name])
2222

23-
async with service.database.start_session() as db:
23+
async with service.database.start_session(read_only=False) as db:
2424
component_registry = get_component_registry()
2525
base_branch = await registry.get_branch(db=db, branch=registry.default_branch)
2626
diff_branch = await registry.get_branch(db=db, branch=model.branch_name)
@@ -40,7 +40,7 @@ async def update_diff(model: RequestDiffUpdate, service: InfrahubServices) -> No
4040
async def refresh_diff(branch_name: str, diff_id: str, service: InfrahubServices) -> None:
4141
await add_tags(branches=[branch_name])
4242

43-
async with service.database.start_session() as db:
43+
async with service.database.start_session(read_only=False) as db:
4444
component_registry = get_component_registry()
4545
base_branch = await registry.get_branch(db=db, branch=registry.default_branch)
4646
diff_branch = await registry.get_branch(db=db, branch=branch_name)
@@ -53,7 +53,7 @@ async def refresh_diff(branch_name: str, diff_id: str, service: InfrahubServices
5353
async def refresh_diff_all(branch_name: str, context: InfrahubContext, service: InfrahubServices) -> None:
5454
await add_tags(branches=[branch_name])
5555

56-
async with service.database.start_session() as db:
56+
async with service.database.start_session(read_only=True) as db:
5757
component_registry = get_component_registry()
5858
default_branch = registry.get_branch_from_registry()
5959
diff_repository = await component_registry.get_component(DiffRepository, db=db, branch=default_branch)

backend/infrahub/core/validators/tasks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ async def schema_path_validate(
7171
schema_branch: SchemaBranch,
7272
service: InfrahubServices,
7373
) -> SchemaValidatorPathResponseData:
74-
async with service.database.start_session() as db:
74+
async with service.database.start_session(read_only=True) as db:
7575
constraint_request = SchemaConstraintValidatorRequest(
7676
branch=branch,
7777
constraint_name=constraint_name,

backend/infrahub/database/__init__.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -476,16 +476,14 @@ async def validate_database(
476476

477477

478478
async def get_db(retry: int = 0) -> AsyncDriver:
479-
URI = f"{config.SETTINGS.database.protocol}://{config.SETTINGS.database.address}:{config.SETTINGS.database.port}"
480-
481479
trusted_certificates = TrustSystemCAs()
482480
if config.SETTINGS.database.tls_insecure:
483481
trusted_certificates = TrustAll()
484482
elif config.SETTINGS.database.tls_ca_file:
485483
trusted_certificates = TrustCustomCAs(config.SETTINGS.database.tls_ca_file)
486484

487485
driver = AsyncGraphDatabase.driver(
488-
URI,
486+
config.SETTINGS.database.database_uri,
489487
auth=(config.SETTINGS.database.username, config.SETTINGS.database.password),
490488
encrypted=config.SETTINGS.database.tls_enabled,
491489
trusted_certificates=trusted_certificates,

backend/infrahub/graphql/app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None:
155155

156156
db = websocket.app.state.db
157157

158-
async with db.start_session() as db:
158+
async with db.start_session(read_only=True) as db:
159159
branch_name = websocket.path_params.get("branch_name", registry.default_branch)
160160
branch = await registry.get_branch(db=db, branch=branch_name)
161161

backend/infrahub/graphql/loaders/node.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def __init__(self, db: InfrahubDatabase, query_params: GetManyParams, *args: Any
5353
self.db = db
5454

5555
async def batch_load_fn(self, keys: list[Any]) -> list[Node | None]:
56-
async with self.db.start_session() as db:
56+
async with self.db.start_session(read_only=True) as db:
5757
nodes_by_id = await NodeManager.get_many(
5858
db=db,
5959
ids=keys,

backend/infrahub/graphql/loaders/peers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def __init__(self, db: InfrahubDatabase, query_params: QueryPeerParams, *args: A
5151
self.db = db
5252

5353
async def batch_load_fn(self, keys: list[Any]) -> list[list[Relationship]]: # pylint: disable=method-hidden
54-
async with self.db.start_session() as db:
54+
async with self.db.start_session(read_only=True) as db:
5555
peer_rels = await NodeManager.query_peers(
5656
db=db,
5757
ids=keys,

0 commit comments

Comments
 (0)