infrahub-server 1.1.9__py3-none-any.whl → 1.1.10__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- infrahub/core/graph/__init__.py +1 -1
- infrahub/core/migrations/__init__.py +1 -0
- infrahub/core/migrations/graph/__init__.py +2 -0
- infrahub/core/migrations/graph/m022_missing_hierarchy_backfill.py +69 -0
- infrahub/core/migrations/query/node_duplicate.py +18 -21
- infrahub/core/models.py +15 -0
- infrahub/core/validators/interface.py +6 -2
- infrahub/core/validators/model.py +2 -0
- infrahub/core/validators/node/hierarchy.py +1 -3
- infrahub/core/validators/node/inherit_from.py +25 -3
- infrahub/core/validators/tasks.py +8 -0
- infrahub/core/validators/uniqueness/checker.py +10 -9
- {infrahub_server-1.1.9.dist-info → infrahub_server-1.1.10.dist-info}/METADATA +1 -1
- {infrahub_server-1.1.9.dist-info → infrahub_server-1.1.10.dist-info}/RECORD +17 -16
- {infrahub_server-1.1.9.dist-info → infrahub_server-1.1.10.dist-info}/LICENSE.txt +0 -0
- {infrahub_server-1.1.9.dist-info → infrahub_server-1.1.10.dist-info}/WHEEL +0 -0
- {infrahub_server-1.1.9.dist-info → infrahub_server-1.1.10.dist-info}/entry_points.txt +0 -0
infrahub/core/graph/__init__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
GRAPH_VERSION =
|
|
1
|
+
GRAPH_VERSION = 22
|
|
@@ -13,6 +13,7 @@ MIGRATION_MAP: dict[str, Optional[type[SchemaMigration]]] = {
|
|
|
13
13
|
"node.branch.update": None,
|
|
14
14
|
"node.attribute.add": NodeAttributeAddMigration,
|
|
15
15
|
"node.attribute.remove": NodeAttributeRemoveMigration,
|
|
16
|
+
"node.inherit_from.update": NodeKindUpdateMigration,
|
|
16
17
|
"node.name.update": NodeKindUpdateMigration,
|
|
17
18
|
"node.namespace.update": NodeKindUpdateMigration,
|
|
18
19
|
"node.relationship.remove": PlaceholderDummyMigration,
|
|
@@ -23,6 +23,7 @@ from .m018_uniqueness_nulls import Migration018
|
|
|
23
23
|
from .m019_restore_rels_to_time import Migration019
|
|
24
24
|
from .m020_duplicate_edges import Migration020
|
|
25
25
|
from .m021_missing_hierarchy_merge import Migration021
|
|
26
|
+
from .m022_missing_hierarchy_backfill import Migration022
|
|
26
27
|
|
|
27
28
|
if TYPE_CHECKING:
|
|
28
29
|
from infrahub.core.root import Root
|
|
@@ -51,6 +52,7 @@ MIGRATIONS: list[type[Union[GraphMigration, InternalSchemaMigration, ArbitraryMi
|
|
|
51
52
|
Migration019,
|
|
52
53
|
Migration020,
|
|
53
54
|
Migration021,
|
|
55
|
+
Migration022,
|
|
54
56
|
]
|
|
55
57
|
|
|
56
58
|
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import TYPE_CHECKING, Any, Sequence
|
|
4
|
+
|
|
5
|
+
from infrahub.core import registry
|
|
6
|
+
from infrahub.core.initialization import initialization
|
|
7
|
+
from infrahub.core.migrations.shared import GraphMigration, MigrationResult
|
|
8
|
+
from infrahub.lock import initialize_lock
|
|
9
|
+
from infrahub.log import get_logger
|
|
10
|
+
|
|
11
|
+
from ...query import Query, QueryType
|
|
12
|
+
|
|
13
|
+
if TYPE_CHECKING:
|
|
14
|
+
from infrahub.database import InfrahubDatabase
|
|
15
|
+
|
|
16
|
+
log = get_logger()
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class BackfillMissingHierarchyQuery(Query):
|
|
20
|
+
name = "backfill_missing_hierarchy"
|
|
21
|
+
type = QueryType.WRITE
|
|
22
|
+
insert_return = False
|
|
23
|
+
|
|
24
|
+
async def query_init(self, db: InfrahubDatabase, **kwargs: dict[str, Any]) -> None: # noqa: ARG002
|
|
25
|
+
# load schemas from database into registry
|
|
26
|
+
initialize_lock()
|
|
27
|
+
await initialization(db=db)
|
|
28
|
+
kind_hierarchy_map: dict[str, str] = {}
|
|
29
|
+
schema_branch = await registry.schema.load_schema_from_db(db=db)
|
|
30
|
+
for node_schema_kind in schema_branch.node_names:
|
|
31
|
+
node_schema = schema_branch.get_node(name=node_schema_kind, duplicate=False)
|
|
32
|
+
if node_schema.hierarchy:
|
|
33
|
+
kind_hierarchy_map[node_schema.kind] = node_schema.hierarchy
|
|
34
|
+
|
|
35
|
+
self.params = {"hierarchy_map": kind_hierarchy_map}
|
|
36
|
+
query = """
|
|
37
|
+
MATCH (r:Root)
|
|
38
|
+
WITH r.default_branch AS default_branch
|
|
39
|
+
MATCH (rel:Relationship {name: "parent__child"})-[e:IS_RELATED]-(n:Node)
|
|
40
|
+
WHERE e.hierarchy IS NULL
|
|
41
|
+
WITH DISTINCT rel, n, default_branch
|
|
42
|
+
CALL {
|
|
43
|
+
WITH rel, n, default_branch
|
|
44
|
+
MATCH (rel)-[e:IS_RELATED {branch: default_branch}]-(n)
|
|
45
|
+
RETURN e
|
|
46
|
+
ORDER BY e.from DESC
|
|
47
|
+
LIMIT 1
|
|
48
|
+
}
|
|
49
|
+
WITH rel, n, e
|
|
50
|
+
WHERE e.status = "active" AND e.hierarchy IS NULL
|
|
51
|
+
SET e.hierarchy = $hierarchy_map[n.kind]
|
|
52
|
+
"""
|
|
53
|
+
self.add_to_query(query)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
class Migration022(GraphMigration):
|
|
57
|
+
"""
|
|
58
|
+
A bug in diff merge logic caused the hierarchy information on IS_RELATED edges to be lost when merged into
|
|
59
|
+
main. This migration backfills the missing hierarchy data and accounts for the case when the branch that
|
|
60
|
+
created the data has been deleted.
|
|
61
|
+
"""
|
|
62
|
+
|
|
63
|
+
name: str = "022_backfill_hierarchy"
|
|
64
|
+
minimum_version: int = 21
|
|
65
|
+
queries: Sequence[type[Query]] = [BackfillMissingHierarchyQuery]
|
|
66
|
+
|
|
67
|
+
async def validate_migration(self, db: InfrahubDatabase) -> MigrationResult: # noqa: ARG002
|
|
68
|
+
result = MigrationResult()
|
|
69
|
+
return result
|
|
@@ -9,8 +9,6 @@ from infrahub.core.graph.schema import GraphNodeRelationships, GraphRelDirection
|
|
|
9
9
|
from infrahub.core.query import Query, QueryType
|
|
10
10
|
|
|
11
11
|
if TYPE_CHECKING:
|
|
12
|
-
from pydantic.fields import FieldInfo
|
|
13
|
-
|
|
14
12
|
from infrahub.database import InfrahubDatabase
|
|
15
13
|
|
|
16
14
|
|
|
@@ -47,37 +45,37 @@ class NodeDuplicateQuery(Query):
|
|
|
47
45
|
return query
|
|
48
46
|
|
|
49
47
|
@staticmethod
|
|
50
|
-
def _render_sub_query_per_rel_type(
|
|
51
|
-
rel_name: str,
|
|
52
|
-
rel_type: str,
|
|
53
|
-
rel_def: FieldInfo,
|
|
54
|
-
) -> str:
|
|
48
|
+
def _render_sub_query_per_rel_type(rel_name: str, rel_type: str, rel_dir: GraphRelDirection) -> str:
|
|
55
49
|
subquery = [
|
|
56
50
|
f"WITH peer_node, {rel_name}, active_node, new_node",
|
|
57
51
|
f"WITH peer_node, {rel_name}, active_node, new_node",
|
|
58
52
|
f'WHERE type({rel_name}) = "{rel_type}"',
|
|
59
53
|
]
|
|
60
|
-
if
|
|
54
|
+
if rel_dir in [GraphRelDirection.OUTBOUND, GraphRelDirection.EITHER]:
|
|
61
55
|
subquery.append(f"""
|
|
62
56
|
CREATE (new_node)-[new_active_edge:{rel_type} $rel_props_new ]->(peer_node)
|
|
63
57
|
SET new_active_edge.branch = CASE WHEN {rel_name}.branch = "-global-" THEN "-global-" ELSE $branch END
|
|
64
58
|
SET new_active_edge.branch_level = CASE WHEN {rel_name}.branch = "-global-" THEN {rel_name}.branch_level ELSE $branch_level END
|
|
59
|
+
SET new_active_edge.hierarchy = COALESCE({rel_name}.hierarchy, NULL)
|
|
65
60
|
""")
|
|
66
61
|
subquery.append(f"""
|
|
67
62
|
CREATE (active_node)-[deleted_edge:{rel_type} $rel_props_prev ]->(peer_node)
|
|
68
63
|
SET deleted_edge.branch = CASE WHEN {rel_name}.branch = "-global-" THEN "-global-" ELSE $branch END
|
|
69
64
|
SET deleted_edge.branch_level = CASE WHEN {rel_name}.branch = "-global-" THEN {rel_name}.branch_level ELSE $branch_level END
|
|
65
|
+
SET deleted_edge.hierarchy = COALESCE({rel_name}.hierarchy, NULL)
|
|
70
66
|
""")
|
|
71
|
-
elif
|
|
67
|
+
elif rel_dir in [GraphRelDirection.INBOUND, GraphRelDirection.EITHER]:
|
|
72
68
|
subquery.append(f"""
|
|
73
69
|
CREATE (new_node)<-[new_active_edge:{rel_type} $rel_props_new ]-(peer_node)
|
|
74
70
|
SET new_active_edge.branch = CASE WHEN {rel_name}.branch = "-global-" THEN "-global-" ELSE $branch END
|
|
75
71
|
SET new_active_edge.branch_level = CASE WHEN {rel_name}.branch = "-global-" THEN {rel_name}.branch_level ELSE $branch_level END
|
|
72
|
+
SET new_active_edge.hierarchy = COALESCE({rel_name}.hierarchy, NULL)
|
|
76
73
|
""")
|
|
77
74
|
subquery.append(f"""
|
|
78
75
|
CREATE (active_node)<-[deleted_edge:{rel_type} $rel_props_prev ]-(peer_node)
|
|
79
|
-
SET
|
|
80
|
-
SET
|
|
76
|
+
SET deleted_edge.branch = CASE WHEN {rel_name}.branch = "-global-" THEN "-global-" ELSE $branch END
|
|
77
|
+
SET deleted_edge.branch_level = CASE WHEN {rel_name}.branch = "-global-" THEN {rel_name}.branch_level ELSE $branch_level END
|
|
78
|
+
SET deleted_edge.hierarchy = COALESCE({rel_name}.hierarchy, NULL)
|
|
81
79
|
""")
|
|
82
80
|
subquery.append("RETURN peer_node as p2")
|
|
83
81
|
return "\n".join(subquery)
|
|
@@ -86,11 +84,10 @@ class NodeDuplicateQuery(Query):
|
|
|
86
84
|
def _render_sub_query_out(cls) -> str:
|
|
87
85
|
sub_queries_out = [
|
|
88
86
|
cls._render_sub_query_per_rel_type(
|
|
89
|
-
rel_name="rel_outband",
|
|
90
|
-
rel_type=rel_type,
|
|
91
|
-
rel_def=rel_def,
|
|
87
|
+
rel_name="rel_outband", rel_type=rel_type, rel_dir=GraphRelDirection.OUTBOUND
|
|
92
88
|
)
|
|
93
|
-
for rel_type,
|
|
89
|
+
for rel_type, field_info in GraphNodeRelationships.model_fields.items()
|
|
90
|
+
if field_info.default.direction in (GraphRelDirection.OUTBOUND, GraphRelDirection.EITHER)
|
|
94
91
|
]
|
|
95
92
|
sub_query_out = "\nUNION\n".join(sub_queries_out)
|
|
96
93
|
return sub_query_out
|
|
@@ -99,11 +96,10 @@ class NodeDuplicateQuery(Query):
|
|
|
99
96
|
def _render_sub_query_in(cls) -> str:
|
|
100
97
|
sub_queries_in = [
|
|
101
98
|
cls._render_sub_query_per_rel_type(
|
|
102
|
-
rel_name="rel_inband",
|
|
103
|
-
rel_type=rel_type,
|
|
104
|
-
rel_def=rel_def,
|
|
99
|
+
rel_name="rel_inband", rel_type=rel_type, rel_dir=GraphRelDirection.INBOUND
|
|
105
100
|
)
|
|
106
|
-
for rel_type,
|
|
101
|
+
for rel_type, field_info in GraphNodeRelationships.model_fields.items()
|
|
102
|
+
if field_info.default.direction in (GraphRelDirection.INBOUND, GraphRelDirection.EITHER)
|
|
107
103
|
]
|
|
108
104
|
sub_query_in = "\nUNION\n".join(sub_queries_in)
|
|
109
105
|
return sub_query_in
|
|
@@ -168,11 +164,12 @@ class NodeDuplicateQuery(Query):
|
|
|
168
164
|
FOREACH (i in CASE WHEN rel_outband.branch IN ["-global-", $branch] THEN [1] ELSE [] END |
|
|
169
165
|
SET rel_outband.to = $current_time
|
|
170
166
|
)
|
|
171
|
-
WITH active_node, new_node
|
|
167
|
+
WITH DISTINCT active_node, new_node
|
|
168
|
+
// Process Inbound Relationship
|
|
172
169
|
MATCH (active_node)<-[]-(peer)
|
|
173
170
|
CALL {
|
|
174
171
|
WITH active_node, peer
|
|
175
|
-
MATCH (active_node)
|
|
172
|
+
MATCH (active_node)<-[r]-(peer)
|
|
176
173
|
WHERE %(branch_filter)s
|
|
177
174
|
RETURN active_node as n1, r as rel_inband1, peer as p1
|
|
178
175
|
ORDER BY r.branch_level DESC, r.from DESC
|
infrahub/core/models.py
CHANGED
|
@@ -19,6 +19,8 @@ if TYPE_CHECKING:
|
|
|
19
19
|
from infrahub.core.schema import MainSchemaTypes
|
|
20
20
|
from infrahub.core.schema.schema_branch import SchemaBranch
|
|
21
21
|
|
|
22
|
+
GENERIC_ATTRIBUTES_TO_IGNORE = ["namespace", "name", "branch"]
|
|
23
|
+
|
|
22
24
|
|
|
23
25
|
class NodeKind(BaseModel):
|
|
24
26
|
namespace: str
|
|
@@ -182,6 +184,15 @@ class SchemaUpdateValidationResult(BaseModel):
|
|
|
182
184
|
|
|
183
185
|
for schema_name, schema_diff in self.diff.changed.items():
|
|
184
186
|
schema_node = schema.get(name=schema_name, duplicate=False)
|
|
187
|
+
if "inherit_from" in schema_diff.changed:
|
|
188
|
+
self.migrations.append(
|
|
189
|
+
SchemaUpdateMigrationInfo(
|
|
190
|
+
path=SchemaPath( # type: ignore[call-arg]
|
|
191
|
+
schema_kind=schema_name, path_type=SchemaPathType.NODE
|
|
192
|
+
),
|
|
193
|
+
migration_name="node.inherit_from.update",
|
|
194
|
+
)
|
|
195
|
+
)
|
|
185
196
|
|
|
186
197
|
# Nothing to do today if we add a new attribute to a node in the schema
|
|
187
198
|
# for node_field_name, _ in schema_diff.added.items():
|
|
@@ -262,6 +273,10 @@ class SchemaUpdateValidationResult(BaseModel):
|
|
|
262
273
|
field_info = schema.model_fields[node_field_name]
|
|
263
274
|
field_update = str(field_info.json_schema_extra.get("update")) # type: ignore[union-attr]
|
|
264
275
|
|
|
276
|
+
# No need to execute a migration for generic nodes attributes because they are not stored in the database
|
|
277
|
+
if schema.is_generic_schema and node_field_name in GENERIC_ATTRIBUTES_TO_IGNORE:
|
|
278
|
+
return
|
|
279
|
+
|
|
265
280
|
schema_path = SchemaPath( # type: ignore[call-arg]
|
|
266
281
|
schema_kind=schema.kind,
|
|
267
282
|
path_type=SchemaPathType.NODE,
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
1
3
|
from abc import ABC, abstractmethod
|
|
4
|
+
from typing import TYPE_CHECKING
|
|
2
5
|
|
|
3
|
-
|
|
6
|
+
if TYPE_CHECKING:
|
|
7
|
+
from infrahub.core.path import GroupedDataPaths
|
|
4
8
|
|
|
5
|
-
from .model import SchemaConstraintValidatorRequest
|
|
9
|
+
from .model import SchemaConstraintValidatorRequest
|
|
6
10
|
|
|
7
11
|
|
|
8
12
|
class ConstraintCheckerInterface(ABC):
|
|
@@ -5,6 +5,7 @@ from pydantic import BaseModel, Field
|
|
|
5
5
|
from infrahub.core.branch import Branch
|
|
6
6
|
from infrahub.core.path import SchemaPath
|
|
7
7
|
from infrahub.core.schema import GenericSchema, NodeSchema
|
|
8
|
+
from infrahub.core.schema.schema_branch import SchemaBranch
|
|
8
9
|
|
|
9
10
|
|
|
10
11
|
class SchemaConstraintValidatorRequest(BaseModel):
|
|
@@ -12,6 +13,7 @@ class SchemaConstraintValidatorRequest(BaseModel):
|
|
|
12
13
|
constraint_name: str = Field(..., description="The name of the constraint to validate")
|
|
13
14
|
node_schema: Union[NodeSchema, GenericSchema] = Field(..., description="Schema of Node or Generic to validate")
|
|
14
15
|
schema_path: SchemaPath = Field(..., description="SchemaPath to the element of the schema to validate")
|
|
16
|
+
schema_branch: SchemaBranch = Field(..., description="SchemaBranch of the element to validate")
|
|
15
17
|
|
|
16
18
|
|
|
17
19
|
class SchemaViolation(BaseModel):
|
|
@@ -7,9 +7,7 @@ from infrahub.core.path import DataPath, GroupedDataPaths
|
|
|
7
7
|
from infrahub.core.schema import NodeSchema
|
|
8
8
|
|
|
9
9
|
from ..interface import ConstraintCheckerInterface
|
|
10
|
-
from ..shared import
|
|
11
|
-
SchemaValidatorQuery,
|
|
12
|
-
)
|
|
10
|
+
from ..shared import SchemaValidatorQuery
|
|
13
11
|
|
|
14
12
|
if TYPE_CHECKING:
|
|
15
13
|
from infrahub.core.branch import Branch
|
|
@@ -6,7 +6,8 @@ from infrahub_sdk.utils import compare_lists
|
|
|
6
6
|
|
|
7
7
|
from infrahub.core.constants import PathType
|
|
8
8
|
from infrahub.core.path import DataPath, GroupedDataPaths
|
|
9
|
-
from infrahub.core.schema import NodeSchema
|
|
9
|
+
from infrahub.core.schema import MainSchemaTypes, NodeSchema
|
|
10
|
+
from infrahub.exceptions import SchemaNotFoundError
|
|
10
11
|
|
|
11
12
|
from ..interface import ConstraintCheckerInterface
|
|
12
13
|
|
|
@@ -41,8 +42,29 @@ class NodeInheritFromChecker(ConstraintCheckerInterface):
|
|
|
41
42
|
return grouped_data_paths_list
|
|
42
43
|
|
|
43
44
|
_, removed, _ = compare_lists(list1=current_schema.inherit_from, list2=request.node_schema.inherit_from)
|
|
44
|
-
|
|
45
|
-
|
|
45
|
+
current_inherit_from_ids = {
|
|
46
|
+
g.id: g.kind
|
|
47
|
+
for g in [
|
|
48
|
+
self.db.schema.get(name=n, branch=request.branch, duplicate=False) for n in current_schema.inherit_from
|
|
49
|
+
]
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
# Gather IDs for each inherited node in use for candidate schema
|
|
53
|
+
request_inherited: list[MainSchemaTypes] = []
|
|
54
|
+
for n in request.node_schema.inherit_from:
|
|
55
|
+
try:
|
|
56
|
+
schema = request.schema_branch.get(name=n, duplicate=False)
|
|
57
|
+
except SchemaNotFoundError:
|
|
58
|
+
schema = self.db.schema.get(name=n, branch=request.branch, duplicate=False)
|
|
59
|
+
request_inherited.append(schema)
|
|
60
|
+
request_inherit_from_ids = {g.id: g.kind for g in request_inherited}
|
|
61
|
+
|
|
62
|
+
# Compare IDs to find out if some inherited nodes were removed
|
|
63
|
+
# Comparing IDs helps us in understanding if a node was renamed or really removed
|
|
64
|
+
_, removed_ids, _ = compare_lists(
|
|
65
|
+
list1=list(current_inherit_from_ids.keys()), list2=list(request_inherit_from_ids.keys())
|
|
66
|
+
)
|
|
67
|
+
if removed := [current_inherit_from_ids[k] for k in removed_ids]:
|
|
46
68
|
group_data_path.add_data_path(
|
|
47
69
|
DataPath(
|
|
48
70
|
branch=str(request.branch.name),
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
+
from typing import TYPE_CHECKING
|
|
4
|
+
|
|
3
5
|
from infrahub_sdk.batch import InfrahubBatch
|
|
4
6
|
from prefect import flow, task
|
|
5
7
|
from prefect.cache_policies import NONE
|
|
@@ -18,6 +20,9 @@ from infrahub.workflows.utils import add_tags
|
|
|
18
20
|
|
|
19
21
|
from .models.validate_migration import SchemaValidateMigrationData, SchemaValidatorPathResponseData
|
|
20
22
|
|
|
23
|
+
if TYPE_CHECKING:
|
|
24
|
+
from infrahub.core.schema.schema_branch import SchemaBranch
|
|
25
|
+
|
|
21
26
|
|
|
22
27
|
@flow(name="schema_validate_migrations", flow_run_name="Validate schema migrations", persist_result=True)
|
|
23
28
|
async def schema_validate_migrations(message: SchemaValidateMigrationData) -> list[SchemaValidatorPathResponseData]:
|
|
@@ -41,6 +46,7 @@ async def schema_validate_migrations(message: SchemaValidateMigrationData) -> li
|
|
|
41
46
|
constraint_name=constraint.constraint_name,
|
|
42
47
|
node_schema=schema,
|
|
43
48
|
schema_path=constraint.path,
|
|
49
|
+
schema_branch=message.schema_branch,
|
|
44
50
|
)
|
|
45
51
|
|
|
46
52
|
results = [result async for _, result in batch.execute()]
|
|
@@ -59,6 +65,7 @@ async def schema_path_validate(
|
|
|
59
65
|
constraint_name: str,
|
|
60
66
|
node_schema: NodeSchema | GenericSchema,
|
|
61
67
|
schema_path: SchemaPath,
|
|
68
|
+
schema_branch: SchemaBranch,
|
|
62
69
|
) -> SchemaValidatorPathResponseData:
|
|
63
70
|
service = services.service
|
|
64
71
|
|
|
@@ -68,6 +75,7 @@ async def schema_path_validate(
|
|
|
68
75
|
constraint_name=constraint_name,
|
|
69
76
|
node_schema=node_schema,
|
|
70
77
|
schema_path=schema_path,
|
|
78
|
+
schema_branch=schema_branch,
|
|
71
79
|
)
|
|
72
80
|
|
|
73
81
|
component_registry = get_component_registry()
|
|
@@ -1,21 +1,16 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
1
3
|
import asyncio
|
|
2
4
|
from itertools import chain
|
|
3
|
-
from typing import Optional, Union
|
|
5
|
+
from typing import TYPE_CHECKING, Optional, Union
|
|
4
6
|
|
|
5
7
|
from infrahub.core import registry
|
|
6
8
|
from infrahub.core.branch import Branch
|
|
7
9
|
from infrahub.core.path import DataPath, GroupedDataPaths
|
|
8
|
-
from infrahub.core.
|
|
9
|
-
from infrahub.core.schema import (
|
|
10
|
-
AttributeSchema,
|
|
11
|
-
MainSchemaTypes,
|
|
12
|
-
RelationshipSchema,
|
|
13
|
-
)
|
|
10
|
+
from infrahub.core.schema import AttributeSchema, MainSchemaTypes, RelationshipSchema
|
|
14
11
|
from infrahub.core.validators.uniqueness.index import UniquenessQueryResultsIndex
|
|
15
|
-
from infrahub.database import InfrahubDatabase
|
|
16
12
|
|
|
17
13
|
from ..interface import ConstraintCheckerInterface
|
|
18
|
-
from ..model import SchemaConstraintValidatorRequest
|
|
19
14
|
from .model import (
|
|
20
15
|
NodeUniquenessQueryRequest,
|
|
21
16
|
NonUniqueAttribute,
|
|
@@ -26,6 +21,12 @@ from .model import (
|
|
|
26
21
|
)
|
|
27
22
|
from .query import NodeUniqueAttributeConstraintQuery
|
|
28
23
|
|
|
24
|
+
if TYPE_CHECKING:
|
|
25
|
+
from infrahub.core.query import QueryResult
|
|
26
|
+
from infrahub.database import InfrahubDatabase
|
|
27
|
+
|
|
28
|
+
from ..model import SchemaConstraintValidatorRequest
|
|
29
|
+
|
|
29
30
|
|
|
30
31
|
def get_attribute_path_from_string(
|
|
31
32
|
path: str, schema: MainSchemaTypes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: infrahub-server
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.10
|
|
4
4
|
Summary: Infrahub is taking a new approach to Infrastructure Management by providing a new generation of datastore to organize and control all the data that defines how an infrastructure should run.
|
|
5
5
|
Home-page: https://opsmill.com
|
|
6
6
|
License: AGPL-3.0-only
|
|
@@ -104,7 +104,7 @@ infrahub/core/diff/repository/deserializer.py,sha256=gkFPByBY1nnmA6sjTJer76RWvwH
|
|
|
104
104
|
infrahub/core/diff/repository/repository.py,sha256=xgTzmd_fdc-n7iX8E83sd3fOz25O4P3CEDQFpRMZjpI,24946
|
|
105
105
|
infrahub/core/diff/tasks.py,sha256=0EuasZKVk76ECpv5yKuqJ7_kGoplqx-_x7w-Di9IAsY,3018
|
|
106
106
|
infrahub/core/enums.py,sha256=5wMcX9x6acU9CTa4B4b6rFwgRZ31N9c9TR3n2EO0BuI,490
|
|
107
|
-
infrahub/core/graph/__init__.py,sha256=
|
|
107
|
+
infrahub/core/graph/__init__.py,sha256=s3CcHziiA0gVyeMS0leTIxE269i1KRuWnX8ymCqLGxE,19
|
|
108
108
|
infrahub/core/graph/constraints.py,sha256=lmuzrKDFoeSKRiLtycB9PXi6zhMYghczKrPYvfWyy90,10396
|
|
109
109
|
infrahub/core/graph/index.py,sha256=oR6wyYpJbq2IVVzUdiuGyWA511hw2AvgklFoBmQk-bM,1619
|
|
110
110
|
infrahub/core/graph/schema.py,sha256=FmEPPb1XOFv3nnS_XJCuUqlp8HsStX5A2frHjlhoqvE,10105
|
|
@@ -122,8 +122,8 @@ infrahub/core/ipam/tasks.py,sha256=5u5WCURGZ-jROScl2Ov0ulW-gMGm1f-5vXnbZbj4a1M,1
|
|
|
122
122
|
infrahub/core/ipam/utilization.py,sha256=Urv0thyR6xYgwyQaZDnx170Wcw8nKKZkBymwNTMblX4,6827
|
|
123
123
|
infrahub/core/manager.py,sha256=e2rawz77UG3tLOz3J-JL6-UpJDyJui3uSDg_APnFnAE,46544
|
|
124
124
|
infrahub/core/merge.py,sha256=ibXM0Rb8qVoBuGiW8q6JYdFsLQ9DS-PPTBoK4R2mPhg,10354
|
|
125
|
-
infrahub/core/migrations/__init__.py,sha256=
|
|
126
|
-
infrahub/core/migrations/graph/__init__.py,sha256=
|
|
125
|
+
infrahub/core/migrations/__init__.py,sha256=OZAL0mbMIBy9hFm_XLh7hHvq5CuPAI_WC3oFM6b6Ucc,1207
|
|
126
|
+
infrahub/core/migrations/graph/__init__.py,sha256=1PnvuZ5D_Y4XPN88_4Hb7oJYSueFSCh5BbEwGlKAP_I,2327
|
|
127
127
|
infrahub/core/migrations/graph/m001_add_version_to_graph.py,sha256=x_dYBnrZtNQiB6TSl4xwXR-Phn7-4EgrJce76ZfPe_c,1499
|
|
128
128
|
infrahub/core/migrations/graph/m002_attribute_is_default.py,sha256=m0uW3rkDjcYEmuHcTH8ngWxenJ5K0_TkVV00L-Ec6Mw,1004
|
|
129
129
|
infrahub/core/migrations/graph/m003_relationship_parent_optional.py,sha256=69RIuLB6YoNOOJ9og1DuUxuWSdTbxbSv6uk25-KsHUI,2313
|
|
@@ -145,11 +145,12 @@ infrahub/core/migrations/graph/m018_uniqueness_nulls.py,sha256=QPQT9ID6idIXizDG0
|
|
|
145
145
|
infrahub/core/migrations/graph/m019_restore_rels_to_time.py,sha256=H0pQLkn-iup_-dl7S-jA6BHAeAmz5oBx9IqVLIfcMkw,11718
|
|
146
146
|
infrahub/core/migrations/graph/m020_duplicate_edges.py,sha256=ec5Z_HF_5MKEQ6gAEvzRM8sxdAsD3lg3eR96fMQ-2lI,6722
|
|
147
147
|
infrahub/core/migrations/graph/m021_missing_hierarchy_merge.py,sha256=JSfkkuqvmSwlXDgyAN__Ypn4J5qhCUPdzAKiaZgqWYU,1606
|
|
148
|
+
infrahub/core/migrations/graph/m022_missing_hierarchy_backfill.py,sha256=SFf6hQk-DDJEZFTsLjus0B2UZ6ekTLvT9bqVCsOpnb4,2502
|
|
148
149
|
infrahub/core/migrations/query/__init__.py,sha256=JoWOUWlV6IzwxWxObsfCnAAKUOHJkE7dZlOsfB64ZEo,876
|
|
149
150
|
infrahub/core/migrations/query/attribute_add.py,sha256=gLibqL1TKtt8ia1UQBxL8vyVDibUPlP3w_vp5bp4XsQ,3507
|
|
150
151
|
infrahub/core/migrations/query/attribute_rename.py,sha256=lotPE_XRqyJQisnrgXtH_cg-0qHMqhtUlT_xcRP84TU,6955
|
|
151
152
|
infrahub/core/migrations/query/delete_element_in_schema.py,sha256=6hSRaqGv-CzVZdjDn8HfkJaPqn_jiPPuZIfKPFG1wjg,7035
|
|
152
|
-
infrahub/core/migrations/query/node_duplicate.py,sha256=
|
|
153
|
+
infrahub/core/migrations/query/node_duplicate.py,sha256=YkKbiNfUPIAWdeDTQQAgLjNa8T5PUmx2nRQfChkWNPw,8216
|
|
153
154
|
infrahub/core/migrations/query/relationship_duplicate.py,sha256=UymElii3btX_xq7wq8B9nnuY4qT-gLMYzfPEnaKGqyQ,6977
|
|
154
155
|
infrahub/core/migrations/query/schema_attribute_update.py,sha256=Pnd9276T6NaZuaJlEvh-URGEQw5eBn3NJqwaUjFyMxM,3379
|
|
155
156
|
infrahub/core/migrations/schema/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -162,7 +163,7 @@ infrahub/core/migrations/schema/node_remove.py,sha256=hr-3V403DU4pz8aRgddVgFMxXZ
|
|
|
162
163
|
infrahub/core/migrations/schema/placeholder_dummy.py,sha256=3T3dBwC_ZyehOJr2KRKFD6CXaq8QIjVk0N-nWAMvFYw,308
|
|
163
164
|
infrahub/core/migrations/schema/tasks.py,sha256=qrHz2dW-lwp1K3EWNnAAqh5HZn15-SgZQceOF-hC7Mc,4111
|
|
164
165
|
infrahub/core/migrations/shared.py,sha256=kMx_Cu8EW1Q7mPzjY4Uxrzk5DhTd7KRzWQnCdJ_hEmI,7222
|
|
165
|
-
infrahub/core/models.py,sha256=
|
|
166
|
+
infrahub/core/models.py,sha256=mHR2PkrUTY-Ojudwf_sXOFEBaz_Ovev4x0b5Vm1BL24,24981
|
|
166
167
|
infrahub/core/node/__init__.py,sha256=IfH8cb_5OZRsLbkNjGPHXuvkjDHFiNw7-aAEEtOp_Nw,30693
|
|
167
168
|
infrahub/core/node/base.py,sha256=naK0ZmWTnwNTESvRRfSTybleBoGELZKm4bdUa9QmZvw,2655
|
|
168
169
|
infrahub/core/node/constraints/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -244,16 +245,16 @@ infrahub/core/validators/attribute/optional.py,sha256=hNmyyat45pIq52YVdtPNlVNol1
|
|
|
244
245
|
infrahub/core/validators/attribute/regex.py,sha256=cxLp1P2Mmz8kyXonzMSNFP_MlPoc0EIywrMEAyhm1u4,4140
|
|
245
246
|
infrahub/core/validators/attribute/unique.py,sha256=3qJKnqysL6UwGskM3G3I7SaGnYDaOAPyEI7UG1v89EQ,5186
|
|
246
247
|
infrahub/core/validators/determiner.py,sha256=Zp6qilKFXGhMjChkitHQm5rcO6cMoAnoEJ7C-hspYrw,7604
|
|
247
|
-
infrahub/core/validators/interface.py,sha256=
|
|
248
|
-
infrahub/core/validators/model.py,sha256=
|
|
248
|
+
infrahub/core/validators/interface.py,sha256=OqSq8myM73Hik6pzZFVC42-_PHg4qwn2xJLd_AhYU1w,560
|
|
249
|
+
infrahub/core/validators/model.py,sha256=biPFiNN3elfbiVTqKjU1BWADCQOqyA7PXoCF7rP4UBI,960
|
|
249
250
|
infrahub/core/validators/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
250
251
|
infrahub/core/validators/models/validate_migration.py,sha256=mYtIE-L7Y-oufW_tQ5Ly9bHXPKV8iHRmvyIr7XzSyvw,949
|
|
251
252
|
infrahub/core/validators/models/violation.py,sha256=HroSoltjf_F3XKTpgSC2b8Sb4dQRZOo4IeY5nqNVjF4,176
|
|
252
253
|
infrahub/core/validators/node/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
253
254
|
infrahub/core/validators/node/attribute.py,sha256=g466gsIZX0rzrmxf0SZRdNz0oQFkfI_gWferKoqReNY,1760
|
|
254
255
|
infrahub/core/validators/node/generate_profile.py,sha256=p5coSFzxpjsiBFJ1ZaY-_N7177s9fipSpLQq09SCv9g,3148
|
|
255
|
-
infrahub/core/validators/node/hierarchy.py,sha256=
|
|
256
|
-
infrahub/core/validators/node/inherit_from.py,sha256=
|
|
256
|
+
infrahub/core/validators/node/hierarchy.py,sha256=hY3oHDVZWeSWtxMwOioy28FtTUFzxT9cfrQl4XqTkSU,7446
|
|
257
|
+
infrahub/core/validators/node/inherit_from.py,sha256=KEcw9-oEtRceG_vnwsa2flkQC2SjX47Mu9UJqoC07xo,3169
|
|
257
258
|
infrahub/core/validators/node/relationship.py,sha256=ktUrSeyLUMKUcC8kCiTUh3VgQx2MK986UY80XHGUx0U,1711
|
|
258
259
|
infrahub/core/validators/query.py,sha256=L_eTQMMrX83W6fYpW0BUJG4clfgfR6jkETivbs9qPyE,1903
|
|
259
260
|
infrahub/core/validators/relationship/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -261,9 +262,9 @@ infrahub/core/validators/relationship/count.py,sha256=ctKe2kk-brM0nekRMia5FSomiT
|
|
|
261
262
|
infrahub/core/validators/relationship/optional.py,sha256=nPte9gzmuMBcVXyqISYlmudcxYkvjYImeveVc2jVLpw,4366
|
|
262
263
|
infrahub/core/validators/relationship/peer.py,sha256=5sYZFCxf4wW2fzm5re7C_KYARDm_PsEa8injVHB06dY,5606
|
|
263
264
|
infrahub/core/validators/shared.py,sha256=11GBt56Q4RQxCSz4jK-VwvKMXqG4UNxFVNR4nRi2mh4,1358
|
|
264
|
-
infrahub/core/validators/tasks.py,sha256=
|
|
265
|
+
infrahub/core/validators/tasks.py,sha256=8Iwoz_P_IGYJeq2v2BVXd3Kw10eX-AlX3BYyqJCEIk8,3337
|
|
265
266
|
infrahub/core/validators/uniqueness/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
266
|
-
infrahub/core/validators/uniqueness/checker.py,sha256=
|
|
267
|
+
infrahub/core/validators/uniqueness/checker.py,sha256=Es_uT-_wNfFsBbzaIpijwDnScTtyzGIMSLJO00GbU2s,10332
|
|
267
268
|
infrahub/core/validators/uniqueness/index.py,sha256=yu-clITQF4MrgK36hsyuXllvR4QkVTqy4ugi_Y_C_Sg,5081
|
|
268
269
|
infrahub/core/validators/uniqueness/model.py,sha256=EPl8X91BSGXGU7GWbUSue6laNGhAtIiXj7rFaz56Kvk,5197
|
|
269
270
|
infrahub/core/validators/uniqueness/query.py,sha256=DigQCR5278wBiXNXhy1FFTTVQewlf2Q8rCcuSmyilkQ,10171
|
|
@@ -681,8 +682,8 @@ infrahub_testcontainers/container.py,sha256=AuHmQv4fqB5Til40-GUsZhop9hzHWLWkqsRV
|
|
|
681
682
|
infrahub_testcontainers/docker-compose.test.yml,sha256=gDmMNoIh5ROQxVAw02_twaAn_wi3Fw63D1Ek2k8YlWc,5966
|
|
682
683
|
infrahub_testcontainers/haproxy.cfg,sha256=QF_DJSll10uGWICLnwFpj0-0VWIeB3CteCDthVoWpCU,1316
|
|
683
684
|
infrahub_testcontainers/helpers.py,sha256=NlzyZN1QpByUQ6t7NwIDQxSSM7xFvY2jCM6-P8RYE6g,5253
|
|
684
|
-
infrahub_server-1.1.
|
|
685
|
-
infrahub_server-1.1.
|
|
686
|
-
infrahub_server-1.1.
|
|
687
|
-
infrahub_server-1.1.
|
|
688
|
-
infrahub_server-1.1.
|
|
685
|
+
infrahub_server-1.1.10.dist-info/LICENSE.txt,sha256=TfPDBt3ar0uv_f9cqCDMZ5rIzW3CY8anRRd4PkL6ejs,34522
|
|
686
|
+
infrahub_server-1.1.10.dist-info/METADATA,sha256=XzU-0tcnaBx3X_ox7_ekJ-cBZoes0lifp2uV-fDveDM,8082
|
|
687
|
+
infrahub_server-1.1.10.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
|
688
|
+
infrahub_server-1.1.10.dist-info/entry_points.txt,sha256=JNQoBcLpUyfeOMhls_-uX1CdJ8Vl-AFSh9UhzTcKdjA,329
|
|
689
|
+
infrahub_server-1.1.10.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|