infrahub-server 1.5.0b0__py3-none-any.whl → 1.5.0b2__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/actions/tasks.py +8 -0
- infrahub/api/diff/diff.py +1 -1
- infrahub/api/internal.py +2 -0
- infrahub/api/oauth2.py +13 -19
- infrahub/api/oidc.py +15 -21
- infrahub/api/schema.py +24 -3
- infrahub/artifacts/models.py +2 -1
- infrahub/auth.py +137 -3
- infrahub/cli/__init__.py +2 -0
- infrahub/cli/db.py +103 -98
- infrahub/cli/db_commands/clean_duplicate_schema_fields.py +212 -0
- infrahub/cli/dev.py +118 -0
- infrahub/cli/tasks.py +46 -0
- infrahub/cli/upgrade.py +30 -3
- infrahub/computed_attribute/tasks.py +20 -8
- infrahub/core/attribute.py +13 -5
- infrahub/core/branch/enums.py +1 -1
- infrahub/core/branch/models.py +7 -3
- infrahub/core/branch/tasks.py +70 -8
- infrahub/core/changelog/models.py +4 -12
- infrahub/core/constants/__init__.py +3 -0
- infrahub/core/constants/infrahubkind.py +1 -0
- infrahub/core/diff/model/path.py +4 -0
- infrahub/core/diff/payload_builder.py +1 -1
- infrahub/core/diff/query/artifact.py +1 -0
- infrahub/core/diff/query/field_summary.py +1 -0
- infrahub/core/graph/__init__.py +1 -1
- infrahub/core/initialization.py +5 -2
- infrahub/core/ipam/utilization.py +1 -1
- infrahub/core/manager.py +6 -3
- infrahub/core/migrations/__init__.py +3 -0
- infrahub/core/migrations/exceptions.py +4 -0
- infrahub/core/migrations/graph/__init__.py +12 -11
- infrahub/core/migrations/graph/load_schema_branch.py +21 -0
- infrahub/core/migrations/graph/m013_convert_git_password_credential.py +1 -1
- infrahub/core/migrations/graph/m040_duplicated_attributes.py +81 -0
- infrahub/core/migrations/graph/m041_profile_attrs_in_db.py +145 -0
- infrahub/core/migrations/graph/m042_create_hfid_display_label_in_db.py +164 -0
- infrahub/core/migrations/graph/m043_backfill_hfid_display_label_in_db.py +866 -0
- infrahub/core/migrations/query/__init__.py +7 -8
- infrahub/core/migrations/query/attribute_add.py +8 -6
- infrahub/core/migrations/query/attribute_remove.py +134 -0
- infrahub/core/migrations/runner.py +54 -0
- infrahub/core/migrations/schema/attribute_kind_update.py +9 -3
- infrahub/core/migrations/schema/attribute_supports_profile.py +90 -0
- infrahub/core/migrations/schema/node_attribute_add.py +35 -4
- infrahub/core/migrations/schema/node_attribute_remove.py +13 -109
- infrahub/core/migrations/schema/node_kind_update.py +2 -1
- infrahub/core/migrations/schema/node_remove.py +2 -1
- infrahub/core/migrations/schema/placeholder_dummy.py +3 -2
- infrahub/core/migrations/shared.py +52 -19
- infrahub/core/node/__init__.py +158 -51
- infrahub/core/node/constraints/attribute_uniqueness.py +3 -1
- infrahub/core/node/create.py +46 -63
- infrahub/core/node/lock_utils.py +70 -44
- infrahub/core/node/node_property_attribute.py +230 -0
- infrahub/core/node/resource_manager/ip_address_pool.py +2 -1
- infrahub/core/node/resource_manager/ip_prefix_pool.py +2 -1
- infrahub/core/node/resource_manager/number_pool.py +2 -1
- infrahub/core/node/standard.py +1 -1
- infrahub/core/protocols.py +7 -1
- infrahub/core/query/attribute.py +55 -0
- infrahub/core/query/ipam.py +1 -0
- infrahub/core/query/node.py +23 -4
- infrahub/core/query/relationship.py +1 -0
- infrahub/core/registry.py +2 -2
- infrahub/core/relationship/constraints/count.py +1 -1
- infrahub/core/relationship/model.py +1 -1
- infrahub/core/schema/__init__.py +56 -0
- infrahub/core/schema/attribute_schema.py +4 -0
- infrahub/core/schema/basenode_schema.py +42 -2
- infrahub/core/schema/definitions/core/__init__.py +2 -0
- infrahub/core/schema/definitions/core/generator.py +2 -0
- infrahub/core/schema/definitions/core/group.py +16 -2
- infrahub/core/schema/definitions/internal.py +16 -3
- infrahub/core/schema/generated/attribute_schema.py +2 -2
- infrahub/core/schema/generated/base_node_schema.py +6 -1
- infrahub/core/schema/manager.py +22 -1
- infrahub/core/schema/node_schema.py +5 -2
- infrahub/core/schema/schema_branch.py +300 -8
- infrahub/core/schema/schema_branch_display.py +123 -0
- infrahub/core/schema/schema_branch_hfid.py +114 -0
- infrahub/core/validators/aggregated_checker.py +1 -1
- infrahub/core/validators/determiner.py +12 -1
- infrahub/core/validators/relationship/peer.py +1 -1
- infrahub/core/validators/tasks.py +1 -1
- infrahub/database/graph.py +21 -0
- infrahub/display_labels/__init__.py +0 -0
- infrahub/display_labels/gather.py +48 -0
- infrahub/display_labels/models.py +240 -0
- infrahub/display_labels/tasks.py +192 -0
- infrahub/display_labels/triggers.py +22 -0
- infrahub/events/branch_action.py +27 -1
- infrahub/events/group_action.py +1 -1
- infrahub/events/node_action.py +1 -1
- infrahub/generators/constants.py +7 -0
- infrahub/generators/models.py +7 -0
- infrahub/generators/tasks.py +34 -22
- infrahub/git/base.py +4 -1
- infrahub/git/integrator.py +23 -15
- infrahub/git/models.py +2 -1
- infrahub/git/repository.py +22 -5
- infrahub/git/tasks.py +66 -10
- infrahub/git/utils.py +123 -1
- infrahub/graphql/analyzer.py +1 -1
- infrahub/graphql/api/endpoints.py +14 -4
- infrahub/graphql/manager.py +4 -9
- infrahub/graphql/mutations/convert_object_type.py +11 -1
- infrahub/graphql/mutations/display_label.py +118 -0
- infrahub/graphql/mutations/generator.py +25 -7
- infrahub/graphql/mutations/hfid.py +125 -0
- infrahub/graphql/mutations/ipam.py +54 -35
- infrahub/graphql/mutations/main.py +27 -28
- infrahub/graphql/mutations/relationship.py +2 -2
- infrahub/graphql/mutations/resource_manager.py +2 -2
- infrahub/graphql/mutations/schema.py +5 -5
- infrahub/graphql/queries/resource_manager.py +1 -1
- infrahub/graphql/resolvers/resolver.py +2 -0
- infrahub/graphql/schema.py +4 -0
- infrahub/graphql/schema_sort.py +170 -0
- infrahub/graphql/types/branch.py +4 -1
- infrahub/graphql/types/enums.py +3 -0
- infrahub/groups/tasks.py +1 -1
- infrahub/hfid/__init__.py +0 -0
- infrahub/hfid/gather.py +48 -0
- infrahub/hfid/models.py +240 -0
- infrahub/hfid/tasks.py +191 -0
- infrahub/hfid/triggers.py +22 -0
- infrahub/lock.py +67 -16
- infrahub/message_bus/types.py +2 -1
- infrahub/middleware.py +26 -1
- infrahub/permissions/constants.py +2 -0
- infrahub/proposed_change/tasks.py +35 -17
- infrahub/server.py +21 -4
- infrahub/services/__init__.py +8 -5
- infrahub/services/adapters/http/__init__.py +5 -0
- infrahub/services/adapters/workflow/worker.py +14 -3
- infrahub/task_manager/event.py +5 -0
- infrahub/task_manager/models.py +7 -0
- infrahub/task_manager/task.py +73 -0
- infrahub/trigger/catalogue.py +4 -0
- infrahub/trigger/models.py +2 -0
- infrahub/trigger/setup.py +13 -4
- infrahub/trigger/tasks.py +6 -0
- infrahub/workers/dependencies.py +10 -1
- infrahub/workers/infrahub_async.py +10 -2
- infrahub/workflows/catalogue.py +80 -0
- infrahub/workflows/initialization.py +21 -0
- infrahub/workflows/utils.py +2 -1
- infrahub_sdk/checks.py +1 -1
- infrahub_sdk/client.py +13 -10
- infrahub_sdk/config.py +29 -2
- infrahub_sdk/ctl/cli_commands.py +2 -0
- infrahub_sdk/ctl/generator.py +4 -0
- infrahub_sdk/ctl/graphql.py +184 -0
- infrahub_sdk/ctl/schema.py +28 -9
- infrahub_sdk/generator.py +7 -1
- infrahub_sdk/graphql/__init__.py +12 -0
- infrahub_sdk/graphql/constants.py +1 -0
- infrahub_sdk/graphql/plugin.py +85 -0
- infrahub_sdk/graphql/query.py +77 -0
- infrahub_sdk/{graphql.py → graphql/renderers.py} +81 -73
- infrahub_sdk/graphql/utils.py +40 -0
- infrahub_sdk/protocols.py +14 -0
- infrahub_sdk/schema/__init__.py +70 -4
- infrahub_sdk/schema/repository.py +8 -0
- infrahub_sdk/spec/models.py +7 -0
- infrahub_sdk/spec/object.py +53 -44
- infrahub_sdk/spec/processors/__init__.py +0 -0
- infrahub_sdk/spec/processors/data_processor.py +10 -0
- infrahub_sdk/spec/processors/factory.py +34 -0
- infrahub_sdk/spec/processors/range_expand_processor.py +56 -0
- infrahub_sdk/spec/range_expansion.py +1 -1
- infrahub_sdk/transforms.py +1 -1
- {infrahub_server-1.5.0b0.dist-info → infrahub_server-1.5.0b2.dist-info}/METADATA +7 -4
- {infrahub_server-1.5.0b0.dist-info → infrahub_server-1.5.0b2.dist-info}/RECORD +182 -143
- infrahub_testcontainers/container.py +115 -3
- infrahub_testcontainers/docker-compose-cluster.test.yml +6 -1
- infrahub_testcontainers/docker-compose.test.yml +6 -1
- infrahub/core/migrations/graph/m040_profile_attrs_in_db.py +0 -166
- {infrahub_server-1.5.0b0.dist-info → infrahub_server-1.5.0b2.dist-info}/LICENSE.txt +0 -0
- {infrahub_server-1.5.0b0.dist-info → infrahub_server-1.5.0b2.dist-info}/WHEEL +0 -0
- {infrahub_server-1.5.0b0.dist-info → infrahub_server-1.5.0b2.dist-info}/entry_points.txt +0 -0
|
File without changes
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
from abc import ABC, abstractmethod
|
|
2
|
+
from typing import Any
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class DataProcessor(ABC):
|
|
6
|
+
"""Abstract base class for data processing strategies"""
|
|
7
|
+
|
|
8
|
+
@abstractmethod
|
|
9
|
+
async def process_data(self, data: list[dict[str, Any]]) -> list[dict[str, Any]]:
|
|
10
|
+
"""Process the data according to the strategy"""
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
from collections.abc import Sequence
|
|
2
|
+
from typing import Any
|
|
3
|
+
|
|
4
|
+
from ..models import InfrahubObjectParameters
|
|
5
|
+
from .data_processor import DataProcessor
|
|
6
|
+
from .range_expand_processor import RangeExpandDataProcessor
|
|
7
|
+
|
|
8
|
+
PROCESSOR_PER_KIND: dict[str, DataProcessor] = {}
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class DataProcessorFactory:
|
|
12
|
+
"""Factory to create appropriate data processor based on strategy"""
|
|
13
|
+
|
|
14
|
+
@classmethod
|
|
15
|
+
def get_processors(cls, kind: str, parameters: InfrahubObjectParameters) -> Sequence[DataProcessor]:
|
|
16
|
+
processors: list[DataProcessor] = []
|
|
17
|
+
if parameters.expand_range:
|
|
18
|
+
processors.append(RangeExpandDataProcessor())
|
|
19
|
+
if kind in PROCESSOR_PER_KIND:
|
|
20
|
+
processors.append(PROCESSOR_PER_KIND[kind])
|
|
21
|
+
|
|
22
|
+
return processors
|
|
23
|
+
|
|
24
|
+
@classmethod
|
|
25
|
+
async def process_data(
|
|
26
|
+
cls,
|
|
27
|
+
kind: str,
|
|
28
|
+
data: list[dict[str, Any]],
|
|
29
|
+
parameters: InfrahubObjectParameters,
|
|
30
|
+
) -> list[dict[str, Any]]:
|
|
31
|
+
processors = cls.get_processors(kind=kind, parameters=parameters)
|
|
32
|
+
for processor in processors:
|
|
33
|
+
data = await processor.process_data(data=data)
|
|
34
|
+
return data
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import copy
|
|
4
|
+
import logging
|
|
5
|
+
import re
|
|
6
|
+
from typing import Any
|
|
7
|
+
|
|
8
|
+
from ...exceptions import ValidationError
|
|
9
|
+
from ..range_expansion import MATCH_PATTERN, range_expansion
|
|
10
|
+
from .data_processor import DataProcessor
|
|
11
|
+
|
|
12
|
+
log = logging.getLogger("infrahub_sdk")
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class RangeExpandDataProcessor(DataProcessor):
|
|
16
|
+
"""Process data with range expansion"""
|
|
17
|
+
|
|
18
|
+
@classmethod
|
|
19
|
+
async def process_data(
|
|
20
|
+
cls,
|
|
21
|
+
data: list[dict[str, Any]],
|
|
22
|
+
) -> list[dict[str, Any]]:
|
|
23
|
+
"""Expand any item in data with range pattern in any value. Supports multiple fields, requires equal expansion length."""
|
|
24
|
+
range_pattern = re.compile(MATCH_PATTERN)
|
|
25
|
+
expanded = []
|
|
26
|
+
for item in data:
|
|
27
|
+
# Find all fields to expand
|
|
28
|
+
expand_fields = {}
|
|
29
|
+
for key, value in item.items():
|
|
30
|
+
if isinstance(value, str) and range_pattern.search(value):
|
|
31
|
+
try:
|
|
32
|
+
expand_fields[key] = range_expansion(value)
|
|
33
|
+
except (ValueError, TypeError, KeyError):
|
|
34
|
+
# If expansion fails, treat as no expansion
|
|
35
|
+
log.debug(
|
|
36
|
+
f"Range expansion failed for value '{value}' in key '{key}'. Treating as no expansion."
|
|
37
|
+
)
|
|
38
|
+
expand_fields[key] = [value]
|
|
39
|
+
if not expand_fields:
|
|
40
|
+
expanded.append(item)
|
|
41
|
+
continue
|
|
42
|
+
# Check all expanded lists have the same length
|
|
43
|
+
lengths = [len(v) for v in expand_fields.values()]
|
|
44
|
+
if len(set(lengths)) > 1:
|
|
45
|
+
raise ValidationError(
|
|
46
|
+
identifier="range_expansion",
|
|
47
|
+
message=f"Range expansion mismatch: fields expanded to different lengths: {lengths}",
|
|
48
|
+
)
|
|
49
|
+
n = lengths[0]
|
|
50
|
+
# Zip expanded values and produce new items
|
|
51
|
+
for i in range(n):
|
|
52
|
+
new_item = copy.deepcopy(item)
|
|
53
|
+
for key, values in expand_fields.items():
|
|
54
|
+
new_item[key] = values[i]
|
|
55
|
+
expanded.append(new_item)
|
|
56
|
+
return expanded
|
infrahub_sdk/transforms.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: infrahub-server
|
|
3
|
-
Version: 1.5.
|
|
3
|
+
Version: 1.5.0b2
|
|
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
|
License: Apache-2.0
|
|
6
6
|
Author: OpsMill
|
|
@@ -13,10 +13,13 @@ Classifier: Programming Language :: Python :: 3.12
|
|
|
13
13
|
Requires-Dist: Jinja2 (>=3,<4)
|
|
14
14
|
Requires-Dist: aio-pika (>=9.4,<9.5)
|
|
15
15
|
Requires-Dist: aiodataloader (==0.4.0)
|
|
16
|
+
Requires-Dist: ariadne-codegen (==0.15.3)
|
|
16
17
|
Requires-Dist: asgi-correlation-id (==4.2.0)
|
|
17
|
-
Requires-Dist: authlib (==1.
|
|
18
|
+
Requires-Dist: authlib (==1.6.5)
|
|
18
19
|
Requires-Dist: bcrypt (>=4.1,<4.2)
|
|
19
20
|
Requires-Dist: boto3 (==1.34.129)
|
|
21
|
+
Requires-Dist: cachetools-async (>=0.0.5,<0.0.6)
|
|
22
|
+
Requires-Dist: click (==8.1.7)
|
|
20
23
|
Requires-Dist: copier (>=9.8.0,<10.0.0)
|
|
21
24
|
Requires-Dist: dulwich (>=0.22.7,<0.23.0)
|
|
22
25
|
Requires-Dist: email-validator (>=2.1,<2.2)
|
|
@@ -37,8 +40,8 @@ Requires-Dist: opentelemetry-exporter-otlp-proto-grpc (==1.28.1)
|
|
|
37
40
|
Requires-Dist: opentelemetry-exporter-otlp-proto-http (==1.28.1)
|
|
38
41
|
Requires-Dist: opentelemetry-instrumentation-aio-pika (==0.49b1)
|
|
39
42
|
Requires-Dist: opentelemetry-instrumentation-fastapi (==0.49b1)
|
|
40
|
-
Requires-Dist: prefect (==3.4.
|
|
41
|
-
Requires-Dist: prefect-redis (==0.2.
|
|
43
|
+
Requires-Dist: prefect (==3.4.23)
|
|
44
|
+
Requires-Dist: prefect-redis (==0.2.5)
|
|
42
45
|
Requires-Dist: pyarrow (>=14)
|
|
43
46
|
Requires-Dist: pydantic (>=2.10,<2.11)
|
|
44
47
|
Requires-Dist: pydantic-settings (>=2.8,<2.9)
|