infrahub-server 1.5.5__py3-none-any.whl → 1.6.0__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/api/artifact.py +5 -3
- infrahub/auth.py +5 -6
- infrahub/cli/db.py +3 -3
- infrahub/cli/db_commands/clean_duplicate_schema_fields.py +2 -2
- infrahub/cli/dev.py +30 -0
- infrahub/config.py +62 -14
- infrahub/constants/database.py +5 -5
- infrahub/core/branch/models.py +24 -6
- infrahub/core/constants/__init__.py +1 -0
- infrahub/core/diff/model/diff.py +2 -2
- infrahub/core/graph/constraints.py +2 -2
- infrahub/core/manager.py +191 -60
- infrahub/core/merge.py +29 -2
- infrahub/core/migrations/graph/m041_deleted_dup_edges.py +2 -3
- infrahub/core/migrations/shared.py +2 -2
- infrahub/core/models.py +5 -6
- infrahub/core/node/__init__.py +12 -6
- infrahub/core/node/create.py +36 -8
- infrahub/core/node/ipam.py +4 -4
- infrahub/core/node/node_property_attribute.py +2 -2
- infrahub/core/node/standard.py +1 -1
- infrahub/core/query/attribute.py +1 -1
- infrahub/core/query/branch.py +11 -0
- infrahub/core/query/node.py +9 -5
- infrahub/core/query/standard_node.py +3 -0
- infrahub/core/relationship/model.py +15 -10
- infrahub/core/schema/__init__.py +3 -3
- infrahub/core/schema/generic_schema.py +1 -1
- infrahub/core/schema/schema_branch.py +35 -16
- infrahub/core/task/user_task.py +2 -2
- infrahub/core/validators/determiner.py +3 -6
- infrahub/core/validators/enum.py +2 -2
- infrahub/database/__init__.py +1 -1
- infrahub/dependencies/interface.py +2 -2
- infrahub/events/constants.py +2 -2
- infrahub/git/base.py +42 -1
- infrahub/git/models.py +2 -1
- infrahub/git/repository.py +5 -1
- infrahub/git/tasks.py +28 -1
- infrahub/git/utils.py +9 -0
- infrahub/graphql/analyzer.py +4 -4
- infrahub/graphql/loaders/peers.py +6 -0
- infrahub/graphql/mutations/computed_attribute.py +1 -1
- infrahub/graphql/mutations/convert_object_type.py +1 -1
- infrahub/graphql/mutations/display_label.py +1 -1
- infrahub/graphql/mutations/hfid.py +1 -1
- infrahub/graphql/mutations/ipam.py +1 -1
- infrahub/graphql/mutations/profile.py +9 -1
- infrahub/graphql/mutations/relationship.py +2 -2
- infrahub/graphql/mutations/resource_manager.py +1 -1
- infrahub/graphql/queries/__init__.py +2 -1
- infrahub/graphql/queries/branch.py +58 -3
- infrahub/graphql/queries/ipam.py +9 -4
- infrahub/graphql/queries/resource_manager.py +7 -11
- infrahub/graphql/queries/search.py +5 -6
- infrahub/graphql/resolvers/ipam.py +20 -0
- infrahub/graphql/resolvers/many_relationship.py +12 -11
- infrahub/graphql/resolvers/resolver.py +6 -2
- infrahub/graphql/resolvers/single_relationship.py +1 -11
- infrahub/graphql/schema.py +2 -0
- infrahub/graphql/types/__init__.py +3 -1
- infrahub/graphql/types/branch.py +98 -2
- infrahub/lock.py +6 -6
- infrahub/log.py +1 -1
- infrahub/message_bus/messages/__init__.py +0 -12
- infrahub/patch/constants.py +2 -2
- infrahub/profiles/node_applier.py +9 -0
- infrahub/proposed_change/tasks.py +1 -1
- infrahub/task_manager/task.py +4 -4
- infrahub/telemetry/constants.py +2 -2
- infrahub/trigger/models.py +2 -2
- infrahub/trigger/setup.py +6 -9
- infrahub/utils.py +19 -1
- infrahub/validators/tasks.py +1 -1
- infrahub/workers/infrahub_async.py +39 -1
- infrahub_sdk/async_typer.py +2 -1
- infrahub_sdk/batch.py +2 -2
- infrahub_sdk/client.py +121 -10
- infrahub_sdk/config.py +2 -2
- infrahub_sdk/ctl/branch.py +176 -2
- infrahub_sdk/ctl/check.py +3 -3
- infrahub_sdk/ctl/cli.py +2 -2
- infrahub_sdk/ctl/cli_commands.py +10 -9
- infrahub_sdk/ctl/generator.py +2 -2
- infrahub_sdk/ctl/graphql.py +3 -4
- infrahub_sdk/ctl/importer.py +2 -3
- infrahub_sdk/ctl/repository.py +5 -6
- infrahub_sdk/ctl/task.py +2 -4
- infrahub_sdk/ctl/utils.py +4 -4
- infrahub_sdk/ctl/validate.py +1 -2
- infrahub_sdk/diff.py +80 -3
- infrahub_sdk/graphql/constants.py +14 -1
- infrahub_sdk/graphql/renderers.py +5 -1
- infrahub_sdk/node/attribute.py +10 -10
- infrahub_sdk/node/constants.py +2 -3
- infrahub_sdk/node/node.py +54 -11
- infrahub_sdk/node/related_node.py +1 -2
- infrahub_sdk/node/relationship.py +1 -2
- infrahub_sdk/object_store.py +4 -4
- infrahub_sdk/operation.py +2 -2
- infrahub_sdk/protocols_base.py +0 -1
- infrahub_sdk/protocols_generator/generator.py +1 -1
- infrahub_sdk/pytest_plugin/items/jinja2_transform.py +1 -1
- infrahub_sdk/pytest_plugin/models.py +1 -1
- infrahub_sdk/pytest_plugin/plugin.py +1 -1
- infrahub_sdk/query_groups.py +2 -2
- infrahub_sdk/schema/__init__.py +10 -14
- infrahub_sdk/schema/main.py +2 -2
- infrahub_sdk/schema/repository.py +2 -2
- infrahub_sdk/spec/object.py +2 -2
- infrahub_sdk/spec/range_expansion.py +1 -1
- infrahub_sdk/template/__init__.py +2 -1
- infrahub_sdk/transfer/importer/json.py +3 -3
- infrahub_sdk/types.py +2 -2
- infrahub_sdk/utils.py +2 -2
- {infrahub_server-1.5.5.dist-info → infrahub_server-1.6.0.dist-info}/METADATA +58 -59
- {infrahub_server-1.5.5.dist-info → infrahub_server-1.6.0.dist-info}/RECORD +240 -246
- {infrahub_server-1.5.5.dist-info → infrahub_server-1.6.0.dist-info}/WHEEL +1 -1
- infrahub_server-1.6.0.dist-info/entry_points.txt +12 -0
- infrahub_testcontainers/container.py +2 -2
- infrahub_testcontainers/docker-compose-cluster.test.yml +1 -1
- infrahub_testcontainers/docker-compose.test.yml +1 -1
- infrahub/core/schema/generated/__init__.py +0 -0
- infrahub/core/schema/generated/attribute_schema.py +0 -133
- infrahub/core/schema/generated/base_node_schema.py +0 -111
- infrahub/core/schema/generated/genericnode_schema.py +0 -30
- infrahub/core/schema/generated/node_schema.py +0 -40
- infrahub/core/schema/generated/relationship_schema.py +0 -141
- infrahub_server-1.5.5.dist-info/entry_points.txt +0 -13
- {infrahub_server-1.5.5.dist-info → infrahub_server-1.6.0.dist-info/licenses}/LICENSE.txt +0 -0
infrahub_sdk/schema/main.py
CHANGED
|
@@ -3,7 +3,7 @@ from __future__ import annotations
|
|
|
3
3
|
import warnings
|
|
4
4
|
from collections.abc import MutableMapping
|
|
5
5
|
from enum import Enum
|
|
6
|
-
from typing import TYPE_CHECKING, Any
|
|
6
|
+
from typing import TYPE_CHECKING, Any
|
|
7
7
|
|
|
8
8
|
from pydantic import BaseModel, ConfigDict, Field
|
|
9
9
|
from typing_extensions import Self
|
|
@@ -11,7 +11,7 @@ from typing_extensions import Self
|
|
|
11
11
|
if TYPE_CHECKING:
|
|
12
12
|
from ..node import InfrahubNode, InfrahubNodeSync
|
|
13
13
|
|
|
14
|
-
InfrahubNodeTypes =
|
|
14
|
+
InfrahubNodeTypes = InfrahubNode | InfrahubNodeSync
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
class RelationshipCardinality(str, Enum):
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
from pathlib import Path
|
|
4
|
-
from typing import TYPE_CHECKING, Any, TypeVar
|
|
4
|
+
from typing import TYPE_CHECKING, Any, TypeVar
|
|
5
5
|
|
|
6
6
|
from pydantic import BaseModel, ConfigDict, Field, field_validator
|
|
7
7
|
|
|
@@ -18,7 +18,7 @@ from ..utils import duplicates
|
|
|
18
18
|
if TYPE_CHECKING:
|
|
19
19
|
from ..node import InfrahubNode, InfrahubNodeSync
|
|
20
20
|
|
|
21
|
-
InfrahubNodeTypes =
|
|
21
|
+
InfrahubNodeTypes = InfrahubNode | InfrahubNodeSync
|
|
22
22
|
|
|
23
23
|
ResourceClass = TypeVar("ResourceClass")
|
|
24
24
|
|
infrahub_sdk/spec/object.py
CHANGED
|
@@ -74,7 +74,7 @@ class RelationshipInfo(BaseModel):
|
|
|
74
74
|
|
|
75
75
|
@property
|
|
76
76
|
def is_reference(self) -> bool:
|
|
77
|
-
return self.format in
|
|
77
|
+
return self.format in {RelationshipDataFormat.ONE_REF, RelationshipDataFormat.MANY_REF}
|
|
78
78
|
|
|
79
79
|
def get_context(self, value: Any) -> dict:
|
|
80
80
|
"""Return a dict to insert to the context if the relationship is mandatory"""
|
|
@@ -230,7 +230,7 @@ class InfrahubObjectFileData(BaseModel):
|
|
|
230
230
|
|
|
231
231
|
# First validate if all mandatory fields are present
|
|
232
232
|
for element in schema.mandatory_input_names:
|
|
233
|
-
if not any([element in data
|
|
233
|
+
if not any([element in data, element in context]):
|
|
234
234
|
errors.append(ObjectValidationError(position=position + [element], message=f"{element} is mandatory"))
|
|
235
235
|
|
|
236
236
|
# Validate if all attributes are valid
|
|
@@ -69,7 +69,7 @@ def _extract_constants(pattern: str, re_compiled: re.Pattern) -> tuple[list[int]
|
|
|
69
69
|
def _expand_interfaces(pattern: str, interface_constant: list[int], cartesian_list: list[list[str]]) -> list[str]:
|
|
70
70
|
def _pairwise(lst: list[int]) -> list[tuple[int, int]]:
|
|
71
71
|
it = iter(lst)
|
|
72
|
-
return list(zip(it, it))
|
|
72
|
+
return list(zip(it, it, strict=False))
|
|
73
73
|
|
|
74
74
|
if interface_constant[-1] < len(pattern):
|
|
75
75
|
interface_constant.append(len(pattern))
|
|
@@ -62,7 +62,7 @@ class LineDelimitedJSONImporter(ImporterInterface):
|
|
|
62
62
|
|
|
63
63
|
with self.wrapped_task_output("Analyzing import"):
|
|
64
64
|
import_nodes_by_kind = defaultdict(list)
|
|
65
|
-
for graphql_data, kind in zip(table.column("graphql_json"), table.column("kind")):
|
|
65
|
+
for graphql_data, kind in zip(table.column("graphql_json"), table.column("kind"), strict=False):
|
|
66
66
|
node = await InfrahubNode.from_graphql(self.client, branch, ujson.loads(str(graphql_data)))
|
|
67
67
|
import_nodes_by_kind[str(kind)].append(node)
|
|
68
68
|
self.all_nodes[node.id] = node
|
|
@@ -109,7 +109,7 @@ class LineDelimitedJSONImporter(ImporterInterface):
|
|
|
109
109
|
relationship_schema
|
|
110
110
|
)
|
|
111
111
|
|
|
112
|
-
for relationship_name in self.optional_relationships_schemas_by_node_kind[node_kind]
|
|
112
|
+
for relationship_name in self.optional_relationships_schemas_by_node_kind[node_kind]:
|
|
113
113
|
relationship_value = getattr(node, relationship_name)
|
|
114
114
|
if isinstance(relationship_value, RelationshipManager):
|
|
115
115
|
if relationship_value.peer_ids:
|
|
@@ -144,7 +144,7 @@ class LineDelimitedJSONImporter(ImporterInterface):
|
|
|
144
144
|
await self.execute_batches([update_batch], "Adding optional relationships to nodes")
|
|
145
145
|
|
|
146
146
|
async def update_many_to_many_relationships(self, file: Path) -> None:
|
|
147
|
-
relationships = ujson.loads(file.read_text())
|
|
147
|
+
relationships = ujson.loads(file.read_text(encoding="utf-8"))
|
|
148
148
|
update_batch = await self.client.create_batch(return_exceptions=True)
|
|
149
149
|
|
|
150
150
|
for relationship in relationships:
|
infrahub_sdk/types.py
CHANGED
|
@@ -2,7 +2,7 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
import enum
|
|
4
4
|
from logging import Logger
|
|
5
|
-
from typing import TYPE_CHECKING, Any, Protocol,
|
|
5
|
+
from typing import TYPE_CHECKING, Any, Protocol, runtime_checkable
|
|
6
6
|
|
|
7
7
|
from pydantic import BaseModel
|
|
8
8
|
|
|
@@ -65,7 +65,7 @@ class InfrahubLogger(Protocol):
|
|
|
65
65
|
"""Send an exception event."""
|
|
66
66
|
|
|
67
67
|
|
|
68
|
-
InfrahubLoggers =
|
|
68
|
+
InfrahubLoggers = InfrahubLogger | Logger
|
|
69
69
|
|
|
70
70
|
|
|
71
71
|
class Order(BaseModel):
|
infrahub_sdk/utils.py
CHANGED
|
@@ -168,7 +168,7 @@ def str_to_bool(value: str) -> bool:
|
|
|
168
168
|
if isinstance(value, bool):
|
|
169
169
|
return value
|
|
170
170
|
|
|
171
|
-
if isinstance(value, int) and value in
|
|
171
|
+
if isinstance(value, int) and value in {0, 1}:
|
|
172
172
|
return bool(value)
|
|
173
173
|
|
|
174
174
|
if not isinstance(value, str):
|
|
@@ -318,7 +318,7 @@ def write_to_file(path: Path, value: Any) -> bool:
|
|
|
318
318
|
raise FileExistsError(f"{path} is a directory")
|
|
319
319
|
|
|
320
320
|
to_write = str(value)
|
|
321
|
-
written = path.write_text(to_write)
|
|
321
|
+
written = path.write_text(to_write, encoding="utf-8")
|
|
322
322
|
|
|
323
323
|
return written is not None
|
|
324
324
|
|
|
@@ -1,66 +1,66 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: infrahub-server
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.6.0
|
|
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
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
Project-URL: Homepage, https://opsmill.com
|
|
6
|
+
Project-URL: Repository, https://github.com/opsmill/infrahub
|
|
7
|
+
Project-URL: Documentation, https://docs.infrahub.app/
|
|
8
|
+
Author-email: OpsMill <info@opsmill.com>
|
|
9
|
+
License-Expression: Apache-2.0
|
|
10
|
+
License-File: LICENSE.txt
|
|
9
11
|
Classifier: Intended Audience :: Developers
|
|
10
|
-
Classifier: License :: OSI Approved :: Apache Software License
|
|
11
12
|
Classifier: Programming Language :: Python :: 3
|
|
12
13
|
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
-
Requires-
|
|
14
|
-
Requires-Dist: aio-pika
|
|
15
|
-
Requires-Dist: aiodataloader
|
|
16
|
-
Requires-Dist: ariadne-codegen
|
|
17
|
-
Requires-Dist: asgi-correlation-id
|
|
18
|
-
Requires-Dist: authlib
|
|
19
|
-
Requires-Dist: bcrypt
|
|
20
|
-
Requires-Dist: boto3
|
|
21
|
-
Requires-Dist: cachetools-async
|
|
22
|
-
Requires-Dist: click
|
|
23
|
-
Requires-Dist: copier
|
|
24
|
-
Requires-Dist:
|
|
25
|
-
Requires-Dist:
|
|
26
|
-
Requires-Dist:
|
|
27
|
-
Requires-Dist:
|
|
28
|
-
Requires-Dist: fastapi-storages
|
|
29
|
-
Requires-Dist:
|
|
30
|
-
Requires-Dist:
|
|
31
|
-
Requires-Dist:
|
|
32
|
-
Requires-Dist:
|
|
33
|
-
Requires-Dist:
|
|
34
|
-
Requires-Dist:
|
|
35
|
-
Requires-Dist:
|
|
36
|
-
Requires-Dist:
|
|
37
|
-
Requires-Dist:
|
|
38
|
-
Requires-Dist:
|
|
39
|
-
Requires-Dist:
|
|
40
|
-
Requires-Dist:
|
|
41
|
-
Requires-Dist: opentelemetry-
|
|
42
|
-
Requires-Dist: opentelemetry-
|
|
43
|
-
Requires-Dist:
|
|
44
|
-
Requires-Dist:
|
|
45
|
-
Requires-Dist:
|
|
46
|
-
Requires-Dist:
|
|
47
|
-
Requires-Dist:
|
|
48
|
-
Requires-Dist:
|
|
49
|
-
Requires-Dist:
|
|
50
|
-
Requires-Dist:
|
|
51
|
-
Requires-Dist:
|
|
52
|
-
Requires-Dist:
|
|
53
|
-
Requires-Dist:
|
|
54
|
-
Requires-Dist:
|
|
55
|
-
Requires-Dist:
|
|
56
|
-
Requires-Dist:
|
|
57
|
-
Requires-Dist:
|
|
58
|
-
Requires-Dist:
|
|
59
|
-
Requires-Dist:
|
|
60
|
-
Requires-Dist:
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
Project-URL: Repository, https://github.com/opsmill/infrahub
|
|
14
|
+
Requires-Python: <3.13,>=3.12
|
|
15
|
+
Requires-Dist: aio-pika<9.5,>=9.4
|
|
16
|
+
Requires-Dist: aiodataloader==0.4.0
|
|
17
|
+
Requires-Dist: ariadne-codegen==0.15.3
|
|
18
|
+
Requires-Dist: asgi-correlation-id==4.2.0
|
|
19
|
+
Requires-Dist: authlib==1.6.5
|
|
20
|
+
Requires-Dist: bcrypt<4.2,>=4.1
|
|
21
|
+
Requires-Dist: boto3==1.34.129
|
|
22
|
+
Requires-Dist: cachetools-async==0.0.5
|
|
23
|
+
Requires-Dist: click==8.1.7
|
|
24
|
+
Requires-Dist: copier==9.8.0
|
|
25
|
+
Requires-Dist: deepdiff==8.6.1
|
|
26
|
+
Requires-Dist: dulwich==0.22.7
|
|
27
|
+
Requires-Dist: email-validator<2.2,>=2.1
|
|
28
|
+
Requires-Dist: fast-depends==2.4.12
|
|
29
|
+
Requires-Dist: fastapi-storages<0.4,>=0.3
|
|
30
|
+
Requires-Dist: fastapi==0.121.1
|
|
31
|
+
Requires-Dist: gitpython<4,>=3
|
|
32
|
+
Requires-Dist: graphene<3.5,>=3.4
|
|
33
|
+
Requires-Dist: gunicorn<24,>=23.0.0
|
|
34
|
+
Requires-Dist: jinja2<4,>=3
|
|
35
|
+
Requires-Dist: lunr<0.8,>=0.7.0.post1
|
|
36
|
+
Requires-Dist: nats-py==2.7.2
|
|
37
|
+
Requires-Dist: neo4j-rust-ext<5.29,>=5.28
|
|
38
|
+
Requires-Dist: neo4j<5.29,>=5.28
|
|
39
|
+
Requires-Dist: netaddr==1.3.0
|
|
40
|
+
Requires-Dist: netutils==1.12.0
|
|
41
|
+
Requires-Dist: numpy==1.26.2
|
|
42
|
+
Requires-Dist: opentelemetry-exporter-otlp-proto-grpc==1.28.1
|
|
43
|
+
Requires-Dist: opentelemetry-exporter-otlp-proto-http==1.28.1
|
|
44
|
+
Requires-Dist: opentelemetry-instrumentation-aio-pika==0.49b1
|
|
45
|
+
Requires-Dist: opentelemetry-instrumentation-fastapi==0.49b1
|
|
46
|
+
Requires-Dist: prefect-redis==0.2.6
|
|
47
|
+
Requires-Dist: prefect==3.5.0
|
|
48
|
+
Requires-Dist: pyarrow<15,>=14
|
|
49
|
+
Requires-Dist: pydantic-settings<2.9,>=2.8
|
|
50
|
+
Requires-Dist: pydantic<2.11,>=2.10
|
|
51
|
+
Requires-Dist: pyjwt<2.9,>=2.8
|
|
52
|
+
Requires-Dist: pytest<7.5,>=7.4
|
|
53
|
+
Requires-Dist: python-multipart==0.0.18
|
|
54
|
+
Requires-Dist: pyyaml<7,>=6
|
|
55
|
+
Requires-Dist: redis[hiredis]==6.0.0
|
|
56
|
+
Requires-Dist: rich<14,>=13
|
|
57
|
+
Requires-Dist: starlette-exporter<0.24,>=0.23
|
|
58
|
+
Requires-Dist: structlog==24.1.0
|
|
59
|
+
Requires-Dist: tomli>=1.1.0; python_version <= '3.11'
|
|
60
|
+
Requires-Dist: typer==0.19.2
|
|
61
|
+
Requires-Dist: ujson<6,>=5
|
|
62
|
+
Requires-Dist: uvicorn[standard]<0.33,>=0.32
|
|
63
|
+
Requires-Dist: whenever==0.7.3
|
|
64
64
|
Description-Content-Type: text/markdown
|
|
65
65
|
|
|
66
66
|
<h1 align="center">
|
|
@@ -137,4 +137,3 @@ To help our community with the creation of contributions, please view our [CONTR
|
|
|
137
137
|
## Security
|
|
138
138
|
|
|
139
139
|
[View our SECURITY](https://github.com/opsmill/infrahub?tab=security-ov-file) policy to find the latest information.
|
|
140
|
-
|