infrahub-server 1.3.0b2__py3-none-any.whl → 1.3.0b3__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/constants.py +87 -0
- infrahub/actions/gather.py +3 -3
- infrahub/actions/models.py +10 -8
- infrahub/actions/parsers.py +6 -6
- infrahub/actions/schema.py +46 -37
- infrahub/core/protocols.py +3 -3
- infrahub/graphql/mutations/resource_manager.py +9 -1
- infrahub/proposed_change/tasks.py +8 -8
- {infrahub_server-1.3.0b2.dist-info → infrahub_server-1.3.0b3.dist-info}/METADATA +1 -1
- {infrahub_server-1.3.0b2.dist-info → infrahub_server-1.3.0b3.dist-info}/RECORD +13 -13
- {infrahub_server-1.3.0b2.dist-info → infrahub_server-1.3.0b3.dist-info}/LICENSE.txt +0 -0
- {infrahub_server-1.3.0b2.dist-info → infrahub_server-1.3.0b3.dist-info}/WHEEL +0 -0
- {infrahub_server-1.3.0b2.dist-info → infrahub_server-1.3.0b3.dist-info}/entry_points.txt +0 -0
infrahub/actions/constants.py
CHANGED
|
@@ -46,6 +46,93 @@ class BranchScope(Enum):
|
|
|
46
46
|
raise NotImplementedError(f"The defined value {value} doesn't match a branch scope")
|
|
47
47
|
|
|
48
48
|
|
|
49
|
+
class MemberAction(Enum):
|
|
50
|
+
ADD_MEMBER = DropdownChoice(
|
|
51
|
+
name="add_member",
|
|
52
|
+
label="Add member",
|
|
53
|
+
description="Add impacted member to the selected group",
|
|
54
|
+
color="#86efac",
|
|
55
|
+
)
|
|
56
|
+
REMOVE_MEMBER = DropdownChoice(
|
|
57
|
+
name="remove_member",
|
|
58
|
+
label="Remove member",
|
|
59
|
+
description="Remove impacted member from the selected group",
|
|
60
|
+
color="#fef08a",
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
@classmethod
|
|
64
|
+
def available_types(cls) -> list[DropdownChoice]:
|
|
65
|
+
return [cls.__members__[member].value for member in list(cls.__members__)]
|
|
66
|
+
|
|
67
|
+
@classmethod
|
|
68
|
+
def from_value(cls, value: str) -> MemberAction:
|
|
69
|
+
for member in cls.__members__:
|
|
70
|
+
if value == cls.__members__[member].value.name:
|
|
71
|
+
return cls.__members__[member]
|
|
72
|
+
|
|
73
|
+
raise NotImplementedError(f"The defined value {value} doesn't match a member action")
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
class MemberUpdate(Enum):
|
|
77
|
+
ADDED = DropdownChoice(
|
|
78
|
+
name="added",
|
|
79
|
+
label="Added",
|
|
80
|
+
description="Trigger when members are added to this group",
|
|
81
|
+
color="#86efac",
|
|
82
|
+
)
|
|
83
|
+
REMOVED = DropdownChoice(
|
|
84
|
+
name="removed",
|
|
85
|
+
label="Removed",
|
|
86
|
+
description="Trigger when members are removed from this group",
|
|
87
|
+
color="#fef08a",
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
@classmethod
|
|
91
|
+
def available_types(cls) -> list[DropdownChoice]:
|
|
92
|
+
return [cls.__members__[member].value for member in list(cls.__members__)]
|
|
93
|
+
|
|
94
|
+
@classmethod
|
|
95
|
+
def from_value(cls, value: str) -> MemberUpdate:
|
|
96
|
+
for member in cls.__members__:
|
|
97
|
+
if value == cls.__members__[member].value.name:
|
|
98
|
+
return cls.__members__[member]
|
|
99
|
+
|
|
100
|
+
raise NotImplementedError(f"The defined value {value} doesn't match a MemberUpdate")
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
class RelationshipMatch(Enum):
|
|
104
|
+
ADDED = DropdownChoice(
|
|
105
|
+
name="added",
|
|
106
|
+
label="Added",
|
|
107
|
+
description="Check if the selected relationship was added",
|
|
108
|
+
color="#86efac",
|
|
109
|
+
)
|
|
110
|
+
REMOVED = DropdownChoice(
|
|
111
|
+
name="removed",
|
|
112
|
+
label="Removed",
|
|
113
|
+
description="Check if the selected relationship was removed",
|
|
114
|
+
color="#fef08a",
|
|
115
|
+
)
|
|
116
|
+
UPDATED = DropdownChoice(
|
|
117
|
+
name="updated",
|
|
118
|
+
label="Updated",
|
|
119
|
+
description="Check if the selected relationship was updated, added or removed.",
|
|
120
|
+
color="#e5e7eb",
|
|
121
|
+
)
|
|
122
|
+
|
|
123
|
+
@classmethod
|
|
124
|
+
def available_types(cls) -> list[DropdownChoice]:
|
|
125
|
+
return [cls.__members__[member].value for member in list(cls.__members__)]
|
|
126
|
+
|
|
127
|
+
@classmethod
|
|
128
|
+
def from_value(cls, value: str) -> RelationshipMatch:
|
|
129
|
+
for member in cls.__members__:
|
|
130
|
+
if value == cls.__members__[member].value.name:
|
|
131
|
+
return cls.__members__[member]
|
|
132
|
+
|
|
133
|
+
raise NotImplementedError(f"The defined value {value} doesn't match a RelationshipMatch")
|
|
134
|
+
|
|
135
|
+
|
|
49
136
|
class ValueMatch(Enum):
|
|
50
137
|
VALUE = DropdownChoice(
|
|
51
138
|
name="value",
|
infrahub/actions/gather.py
CHANGED
|
@@ -46,7 +46,7 @@ async def gather_trigger_action_rules(db: InfrahubDatabase) -> list[ActionTrigge
|
|
|
46
46
|
},
|
|
47
47
|
"... on CoreNodeTriggerRelationshipMatch": {
|
|
48
48
|
"relationship_name": {"value": None},
|
|
49
|
-
"
|
|
49
|
+
"modification_type": {"value": None},
|
|
50
50
|
"peer": {"value": None},
|
|
51
51
|
},
|
|
52
52
|
}
|
|
@@ -54,7 +54,7 @@ async def gather_trigger_action_rules(db: InfrahubDatabase) -> list[ActionTrigge
|
|
|
54
54
|
},
|
|
55
55
|
},
|
|
56
56
|
"... on CoreGroupTriggerRule": {
|
|
57
|
-
"
|
|
57
|
+
"member_update": {"value": None},
|
|
58
58
|
"group": {
|
|
59
59
|
"node": {
|
|
60
60
|
"id": None,
|
|
@@ -68,7 +68,7 @@ async def gather_trigger_action_rules(db: InfrahubDatabase) -> list[ActionTrigge
|
|
|
68
68
|
"id": None,
|
|
69
69
|
"name": {"value": None},
|
|
70
70
|
"... on CoreGroupAction": {
|
|
71
|
-
"
|
|
71
|
+
"member_action": {"value": None},
|
|
72
72
|
"group": {
|
|
73
73
|
"node": {
|
|
74
74
|
"id": None,
|
infrahub/actions/models.py
CHANGED
|
@@ -23,7 +23,7 @@ from infrahub.workflows.catalogue import (
|
|
|
23
23
|
REMOVE_ADD_NODE_FROM_GROUP,
|
|
24
24
|
)
|
|
25
25
|
|
|
26
|
-
from .constants import BranchScope, ValueMatch
|
|
26
|
+
from .constants import BranchScope, MemberAction, MemberUpdate, RelationshipMatch, ValueMatch
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
class EventGroupMember(BaseModel):
|
|
@@ -40,7 +40,7 @@ class CoreGeneratorAction(CoreAction):
|
|
|
40
40
|
|
|
41
41
|
|
|
42
42
|
class CoreGroupAction(CoreAction):
|
|
43
|
-
|
|
43
|
+
member_action: MemberAction
|
|
44
44
|
group_id: str
|
|
45
45
|
|
|
46
46
|
|
|
@@ -52,7 +52,7 @@ class CoreTriggerRule(BaseModel):
|
|
|
52
52
|
|
|
53
53
|
|
|
54
54
|
class CoreGroupTriggerRule(CoreTriggerRule):
|
|
55
|
-
|
|
55
|
+
member_update: MemberUpdate
|
|
56
56
|
group_id: str
|
|
57
57
|
group_kind: str
|
|
58
58
|
|
|
@@ -70,7 +70,7 @@ class CoreNodeTriggerAttributeMatch(CoreNodeTriggerMatch):
|
|
|
70
70
|
|
|
71
71
|
class CoreNodeTriggerRelationshipMatch(CoreNodeTriggerMatch):
|
|
72
72
|
relationship_name: str
|
|
73
|
-
|
|
73
|
+
modification_type: RelationshipMatch
|
|
74
74
|
peer: str | None
|
|
75
75
|
|
|
76
76
|
|
|
@@ -135,14 +135,16 @@ class ActionTriggerRuleTriggerDefinition(TriggerDefinition):
|
|
|
135
135
|
match_related["infrahub.attribute.value_previous"] = match.value_previous or ""
|
|
136
136
|
|
|
137
137
|
elif isinstance(match, CoreNodeTriggerRelationshipMatch):
|
|
138
|
-
peer_status = "added" if match.added else "removed"
|
|
139
138
|
match_related = {
|
|
140
139
|
"prefect.resource.role": "infrahub.node.relationship_update",
|
|
141
140
|
"infrahub.field.name": match.relationship_name,
|
|
142
|
-
"infrahub.relationship.peer_status": peer_status,
|
|
143
141
|
}
|
|
144
142
|
if isinstance(match.peer, str):
|
|
145
143
|
match_related["infrahub.relationship.peer_id"] = match.peer
|
|
144
|
+
|
|
145
|
+
if match.modification_type != RelationshipMatch.UPDATED:
|
|
146
|
+
match_related["infrahub.relationship.peer_status"] = match.modification_type.value.name
|
|
147
|
+
|
|
146
148
|
related_matches.append(match_related)
|
|
147
149
|
|
|
148
150
|
event_trigger.match_related = related_matches or {}
|
|
@@ -164,7 +166,7 @@ class ActionTriggerRuleTriggerDefinition(TriggerDefinition):
|
|
|
164
166
|
},
|
|
165
167
|
)
|
|
166
168
|
elif isinstance(trigger_rule.action, CoreGroupAction):
|
|
167
|
-
if trigger_rule.action.
|
|
169
|
+
if trigger_rule.action.member_action == MemberAction.ADD_MEMBER:
|
|
168
170
|
flow = ACTION_ADD_NODE_TO_GROUP
|
|
169
171
|
else:
|
|
170
172
|
flow = REMOVE_ADD_NODE_FROM_GROUP
|
|
@@ -198,7 +200,7 @@ class ActionTriggerRuleTriggerDefinition(TriggerDefinition):
|
|
|
198
200
|
) -> Self:
|
|
199
201
|
event_trigger = EventTrigger()
|
|
200
202
|
|
|
201
|
-
if trigger_rule.
|
|
203
|
+
if trigger_rule.member_update == MemberUpdate.ADDED:
|
|
202
204
|
event_trigger.events.add(GroupMemberAddedEvent.event_name)
|
|
203
205
|
else:
|
|
204
206
|
event_trigger.events.add(GroupMemberRemovedEvent.event_name)
|
infrahub/actions/parsers.py
CHANGED
|
@@ -2,7 +2,7 @@ from typing import Any
|
|
|
2
2
|
|
|
3
3
|
from infrahub.core.constants import InfrahubKind
|
|
4
4
|
|
|
5
|
-
from .constants import BranchScope, ValueMatch
|
|
5
|
+
from .constants import BranchScope, MemberAction, MemberUpdate, RelationshipMatch, ValueMatch
|
|
6
6
|
from .models import (
|
|
7
7
|
CoreAction,
|
|
8
8
|
CoreGeneratorAction,
|
|
@@ -35,14 +35,14 @@ def _parse_graphql_node(data: dict[str, Any]) -> CoreTriggerRule | None:
|
|
|
35
35
|
action = _parse_graphql_action_response(data=data["action"]["node"])
|
|
36
36
|
match typename:
|
|
37
37
|
case "CoreGroupTriggerRule":
|
|
38
|
-
|
|
38
|
+
member_update = MemberUpdate.from_value(data["member_update"]["value"])
|
|
39
39
|
group_id = data["group"]["node"]["id"]
|
|
40
40
|
group_kind = data["group"]["node"]["__typename"]
|
|
41
41
|
return CoreGroupTriggerRule(
|
|
42
42
|
name=name,
|
|
43
43
|
branch_scope=branch_scope,
|
|
44
44
|
action=action,
|
|
45
|
-
|
|
45
|
+
member_update=member_update,
|
|
46
46
|
group_id=group_id,
|
|
47
47
|
group_kind=group_kind,
|
|
48
48
|
active=active,
|
|
@@ -70,9 +70,9 @@ def _parse_graphql_action_response(data: dict[str, Any]) -> CoreAction:
|
|
|
70
70
|
generator_id = data["generator"]["node"]["id"]
|
|
71
71
|
return CoreGeneratorAction(generator_id=generator_id)
|
|
72
72
|
case "CoreGroupAction":
|
|
73
|
-
|
|
73
|
+
member_action = MemberAction.from_value(data["member_action"]["value"])
|
|
74
74
|
group_id = data["group"]["node"]["id"]
|
|
75
|
-
return CoreGroupAction(
|
|
75
|
+
return CoreGroupAction(member_action=member_action, group_id=group_id)
|
|
76
76
|
|
|
77
77
|
raise NotImplementedError(f"{typename} is not a valid CoreAction")
|
|
78
78
|
|
|
@@ -96,7 +96,7 @@ def _parse_node_trigger_matches(data: list[dict[str, Any]]) -> list[CoreNodeTrig
|
|
|
96
96
|
matches.append(
|
|
97
97
|
CoreNodeTriggerRelationshipMatch(
|
|
98
98
|
relationship_name=node["relationship_name"]["value"],
|
|
99
|
-
|
|
99
|
+
modification_type=RelationshipMatch.from_value(node["modification_type"]["value"]),
|
|
100
100
|
peer=node["peer"]["value"],
|
|
101
101
|
)
|
|
102
102
|
)
|
infrahub/actions/schema.py
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
from infrahub.actions.constants import
|
|
1
|
+
from infrahub.actions.constants import (
|
|
2
|
+
BranchScope,
|
|
3
|
+
MemberAction,
|
|
4
|
+
MemberUpdate,
|
|
5
|
+
NodeAction,
|
|
6
|
+
RelationshipMatch,
|
|
7
|
+
ValueMatch,
|
|
8
|
+
)
|
|
2
9
|
from infrahub.core.constants import AllowOverrideType, BranchSupportType, InfrahubKind
|
|
3
10
|
from infrahub.core.constants import RelationshipCardinality as Cardinality
|
|
4
11
|
from infrahub.core.constants import RelationshipKind as RelKind
|
|
@@ -28,14 +35,14 @@ core_trigger_rule = GenericSchema(
|
|
|
28
35
|
kind="Text",
|
|
29
36
|
description="The name of the trigger rule",
|
|
30
37
|
unique=True,
|
|
31
|
-
order_weight=
|
|
38
|
+
order_weight=100,
|
|
32
39
|
),
|
|
33
40
|
Attr(
|
|
34
41
|
name="description",
|
|
35
42
|
kind="Text",
|
|
36
43
|
description="A longer description to define the purpose of this trigger",
|
|
37
44
|
optional=True,
|
|
38
|
-
order_weight=
|
|
45
|
+
order_weight=200,
|
|
39
46
|
),
|
|
40
47
|
Attr(
|
|
41
48
|
name="active",
|
|
@@ -43,7 +50,7 @@ core_trigger_rule = GenericSchema(
|
|
|
43
50
|
description="Indicates if this trigger is enabled or if it's just prepared, could be useful as you are setting up a trigger",
|
|
44
51
|
optional=False,
|
|
45
52
|
default_value=True,
|
|
46
|
-
order_weight=
|
|
53
|
+
order_weight=200,
|
|
47
54
|
),
|
|
48
55
|
Attr(
|
|
49
56
|
name="branch_scope",
|
|
@@ -52,7 +59,7 @@ core_trigger_rule = GenericSchema(
|
|
|
52
59
|
choices=BranchScope.available_types(),
|
|
53
60
|
default_value=BranchScope.DEFAULT_BRANCH.value.name,
|
|
54
61
|
optional=False,
|
|
55
|
-
order_weight=
|
|
62
|
+
order_weight=200,
|
|
56
63
|
allow_override=AllowOverrideType.NONE,
|
|
57
64
|
),
|
|
58
65
|
],
|
|
@@ -65,7 +72,7 @@ core_trigger_rule = GenericSchema(
|
|
|
65
72
|
kind=RelKind.ATTRIBUTE,
|
|
66
73
|
cardinality=Cardinality.ONE,
|
|
67
74
|
optional=False,
|
|
68
|
-
order_weight=
|
|
75
|
+
order_weight=1000,
|
|
69
76
|
),
|
|
70
77
|
],
|
|
71
78
|
)
|
|
@@ -89,14 +96,14 @@ core_action = GenericSchema(
|
|
|
89
96
|
description="Short descriptive name",
|
|
90
97
|
kind="Text",
|
|
91
98
|
unique=True,
|
|
92
|
-
order_weight=
|
|
99
|
+
order_weight=100,
|
|
93
100
|
),
|
|
94
101
|
Attr(
|
|
95
102
|
name="description",
|
|
96
103
|
description="A detailed description of the action",
|
|
97
104
|
kind="Text",
|
|
98
105
|
optional=True,
|
|
99
|
-
order_weight=
|
|
106
|
+
order_weight=200,
|
|
100
107
|
),
|
|
101
108
|
],
|
|
102
109
|
relationships=[
|
|
@@ -108,7 +115,7 @@ core_action = GenericSchema(
|
|
|
108
115
|
cardinality=Cardinality.MANY,
|
|
109
116
|
identifier="core_action__core_triggerrule",
|
|
110
117
|
optional=True,
|
|
111
|
-
order_weight=
|
|
118
|
+
order_weight=1000,
|
|
112
119
|
),
|
|
113
120
|
],
|
|
114
121
|
)
|
|
@@ -132,7 +139,7 @@ core_node_trigger_match = GenericSchema(
|
|
|
132
139
|
cardinality=Cardinality.ONE,
|
|
133
140
|
optional=False,
|
|
134
141
|
identifier="core_node_trigger_match__core_trigger_rule",
|
|
135
|
-
order_weight=
|
|
142
|
+
order_weight=1000,
|
|
136
143
|
),
|
|
137
144
|
],
|
|
138
145
|
)
|
|
@@ -161,7 +168,7 @@ core_generator_action = NodeSchema(
|
|
|
161
168
|
cardinality=Cardinality.ONE,
|
|
162
169
|
identifier="core_generator_action__generator_definition",
|
|
163
170
|
optional=False,
|
|
164
|
-
order_weight=
|
|
171
|
+
order_weight=400,
|
|
165
172
|
),
|
|
166
173
|
],
|
|
167
174
|
)
|
|
@@ -182,13 +189,14 @@ core_group_action = NodeSchema(
|
|
|
182
189
|
inherit_from=[InfrahubKind.ACTION],
|
|
183
190
|
attributes=[
|
|
184
191
|
Attr(
|
|
185
|
-
name="
|
|
186
|
-
kind="
|
|
192
|
+
name="member_action",
|
|
193
|
+
kind="Dropdown",
|
|
187
194
|
description="Defines if the action should add or remove members from a group when triggered",
|
|
195
|
+
choices=MemberAction.available_types(),
|
|
196
|
+
default_value=MemberAction.ADD_MEMBER.value.name,
|
|
188
197
|
unique=False,
|
|
189
198
|
optional=False,
|
|
190
|
-
|
|
191
|
-
order_weight=3000,
|
|
199
|
+
order_weight=300,
|
|
192
200
|
),
|
|
193
201
|
],
|
|
194
202
|
relationships=[
|
|
@@ -200,7 +208,7 @@ core_group_action = NodeSchema(
|
|
|
200
208
|
cardinality=Cardinality.ONE,
|
|
201
209
|
identifier="core_action__group",
|
|
202
210
|
optional=False,
|
|
203
|
-
order_weight=
|
|
211
|
+
order_weight=400,
|
|
204
212
|
),
|
|
205
213
|
],
|
|
206
214
|
)
|
|
@@ -227,7 +235,7 @@ core_node_trigger_rule = NodeSchema(
|
|
|
227
235
|
description="The kind of node to match against",
|
|
228
236
|
unique=False,
|
|
229
237
|
optional=False,
|
|
230
|
-
order_weight=
|
|
238
|
+
order_weight=300,
|
|
231
239
|
),
|
|
232
240
|
Attr(
|
|
233
241
|
name="mutation_action",
|
|
@@ -236,7 +244,7 @@ core_node_trigger_rule = NodeSchema(
|
|
|
236
244
|
enum=NodeAction.available_types(),
|
|
237
245
|
unique=False,
|
|
238
246
|
optional=False,
|
|
239
|
-
order_weight=
|
|
247
|
+
order_weight=400,
|
|
240
248
|
),
|
|
241
249
|
],
|
|
242
250
|
relationships=[
|
|
@@ -248,7 +256,7 @@ core_node_trigger_rule = NodeSchema(
|
|
|
248
256
|
cardinality=Cardinality.MANY,
|
|
249
257
|
optional=True,
|
|
250
258
|
identifier="core_node_trigger_match__core_trigger_rule",
|
|
251
|
-
order_weight=
|
|
259
|
+
order_weight=800,
|
|
252
260
|
),
|
|
253
261
|
],
|
|
254
262
|
)
|
|
@@ -270,7 +278,7 @@ core_node_trigger_attribute_match = NodeSchema(
|
|
|
270
278
|
description="The attribue to match against",
|
|
271
279
|
unique=False,
|
|
272
280
|
optional=False,
|
|
273
|
-
order_weight=
|
|
281
|
+
order_weight=100,
|
|
274
282
|
),
|
|
275
283
|
Attr(
|
|
276
284
|
name="value",
|
|
@@ -278,7 +286,7 @@ core_node_trigger_attribute_match = NodeSchema(
|
|
|
278
286
|
description="The value the attribute is updated to",
|
|
279
287
|
unique=False,
|
|
280
288
|
optional=True,
|
|
281
|
-
order_weight=
|
|
289
|
+
order_weight=200,
|
|
282
290
|
),
|
|
283
291
|
Attr(
|
|
284
292
|
name="value_previous",
|
|
@@ -286,7 +294,7 @@ core_node_trigger_attribute_match = NodeSchema(
|
|
|
286
294
|
description="The previous value of the targeted attribute",
|
|
287
295
|
unique=False,
|
|
288
296
|
optional=True,
|
|
289
|
-
order_weight=
|
|
297
|
+
order_weight=300,
|
|
290
298
|
),
|
|
291
299
|
Attr(
|
|
292
300
|
name="value_match",
|
|
@@ -295,7 +303,7 @@ core_node_trigger_attribute_match = NodeSchema(
|
|
|
295
303
|
choices=ValueMatch.available_types(),
|
|
296
304
|
default_value=ValueMatch.VALUE.value.name,
|
|
297
305
|
optional=False,
|
|
298
|
-
order_weight=
|
|
306
|
+
order_weight=500,
|
|
299
307
|
),
|
|
300
308
|
],
|
|
301
309
|
relationships=[],
|
|
@@ -318,16 +326,17 @@ core_node_trigger_relationship_match = NodeSchema(
|
|
|
318
326
|
description="The name of the relationship to match against",
|
|
319
327
|
unique=False,
|
|
320
328
|
optional=False,
|
|
321
|
-
order_weight=
|
|
329
|
+
order_weight=100,
|
|
322
330
|
),
|
|
323
331
|
Attr(
|
|
324
|
-
name="
|
|
325
|
-
kind="
|
|
326
|
-
description="Indicates if the relationship was added or removed",
|
|
327
|
-
|
|
332
|
+
name="modification_type",
|
|
333
|
+
kind="Dropdown",
|
|
334
|
+
description="Indicates if the relationship was added or removed or just updated in any way",
|
|
335
|
+
choices=RelationshipMatch.available_types(),
|
|
336
|
+
default_value=RelationshipMatch.ADDED.value.name,
|
|
328
337
|
optional=False,
|
|
329
|
-
|
|
330
|
-
|
|
338
|
+
order_weight=200,
|
|
339
|
+
allow_override=AllowOverrideType.NONE,
|
|
331
340
|
),
|
|
332
341
|
Attr(
|
|
333
342
|
name="peer",
|
|
@@ -335,7 +344,7 @@ core_node_trigger_relationship_match = NodeSchema(
|
|
|
335
344
|
description="The node_id of the relationship peer to match against",
|
|
336
345
|
unique=False,
|
|
337
346
|
optional=True,
|
|
338
|
-
order_weight=
|
|
347
|
+
order_weight=300,
|
|
339
348
|
),
|
|
340
349
|
],
|
|
341
350
|
relationships=[],
|
|
@@ -358,13 +367,13 @@ core_group_trigger_rule = NodeSchema(
|
|
|
358
367
|
inherit_from=[InfrahubKind.TRIGGERRULE],
|
|
359
368
|
attributes=[
|
|
360
369
|
Attr(
|
|
361
|
-
name="
|
|
362
|
-
kind="
|
|
370
|
+
name="member_update",
|
|
371
|
+
kind="Dropdown",
|
|
363
372
|
description="Indicate if the match should be for when members are added or removed",
|
|
364
|
-
|
|
373
|
+
choices=MemberUpdate.available_types(),
|
|
374
|
+
default_value=MemberUpdate.ADDED.value.name,
|
|
365
375
|
optional=False,
|
|
366
|
-
|
|
367
|
-
order_weight=3000,
|
|
376
|
+
order_weight=300,
|
|
368
377
|
),
|
|
369
378
|
],
|
|
370
379
|
relationships=[
|
|
@@ -376,7 +385,7 @@ core_group_trigger_rule = NodeSchema(
|
|
|
376
385
|
cardinality=Cardinality.ONE,
|
|
377
386
|
identifier="core_group_trigger__group",
|
|
378
387
|
optional=False,
|
|
379
|
-
order_weight=
|
|
388
|
+
order_weight=400,
|
|
380
389
|
),
|
|
381
390
|
],
|
|
382
391
|
)
|
infrahub/core/protocols.py
CHANGED
|
@@ -403,12 +403,12 @@ class CoreGraphQLQueryGroup(CoreGroup):
|
|
|
403
403
|
|
|
404
404
|
|
|
405
405
|
class CoreGroupAction(CoreAction):
|
|
406
|
-
|
|
406
|
+
member_action: Dropdown
|
|
407
407
|
group: RelationshipManager
|
|
408
408
|
|
|
409
409
|
|
|
410
410
|
class CoreGroupTriggerRule(CoreTriggerRule):
|
|
411
|
-
|
|
411
|
+
member_update: Dropdown
|
|
412
412
|
group: RelationshipManager
|
|
413
413
|
|
|
414
414
|
|
|
@@ -440,7 +440,7 @@ class CoreNodeTriggerAttributeMatch(CoreNodeTriggerMatch):
|
|
|
440
440
|
|
|
441
441
|
class CoreNodeTriggerRelationshipMatch(CoreNodeTriggerMatch):
|
|
442
442
|
relationship_name: String
|
|
443
|
-
|
|
443
|
+
modification_type: Dropdown
|
|
444
444
|
peer: StringOptional
|
|
445
445
|
|
|
446
446
|
|
|
@@ -7,7 +7,7 @@ from graphene.types.generic import GenericScalar
|
|
|
7
7
|
from typing_extensions import Self
|
|
8
8
|
|
|
9
9
|
from infrahub.core import protocols, registry
|
|
10
|
-
from infrahub.core.constants import InfrahubKind
|
|
10
|
+
from infrahub.core.constants import InfrahubKind, NumberPoolType
|
|
11
11
|
from infrahub.core.ipam.constants import PrefixMemberType
|
|
12
12
|
from infrahub.core.manager import NodeManager
|
|
13
13
|
from infrahub.core.schema import NodeSchema
|
|
@@ -235,6 +235,14 @@ class InfrahubNumberPoolMutation(InfrahubMutationMixin, Mutation):
|
|
|
235
235
|
number_pool, result = await super().mutate_update(
|
|
236
236
|
info=info, data=data, branch=branch, database=dbt, node=node
|
|
237
237
|
)
|
|
238
|
+
|
|
239
|
+
if number_pool.pool_type.value.value == NumberPoolType.SCHEMA.value and ( # type: ignore[attr-defined]
|
|
240
|
+
"start_range" in data.keys() or "end_range" in data.keys()
|
|
241
|
+
):
|
|
242
|
+
raise ValidationError(
|
|
243
|
+
input_value="start_range or end_range can't be updated on schema defined pools, update the schema in the default branch instead"
|
|
244
|
+
)
|
|
245
|
+
|
|
238
246
|
if number_pool.start_range.value > number_pool.end_range.value: # type: ignore[attr-defined]
|
|
239
247
|
raise ValidationError(input_value="start_range can't be larger than end_range")
|
|
240
248
|
|
|
@@ -254,12 +254,12 @@ async def run_proposed_change_data_integrity_check(
|
|
|
254
254
|
"""Triggers a data integrity validation check on the provided proposed change to start."""
|
|
255
255
|
await add_tags(branches=[model.source_branch], nodes=[model.proposed_change])
|
|
256
256
|
|
|
257
|
-
async with service.database.
|
|
258
|
-
destination_branch = await registry.get_branch(db=
|
|
259
|
-
source_branch = await registry.get_branch(db=
|
|
257
|
+
async with service.database.start_session() as dbs:
|
|
258
|
+
destination_branch = await registry.get_branch(db=dbs, branch=model.destination_branch)
|
|
259
|
+
source_branch = await registry.get_branch(db=dbs, branch=model.source_branch)
|
|
260
260
|
component_registry = get_component_registry()
|
|
261
261
|
|
|
262
|
-
diff_coordinator = await component_registry.get_component(DiffCoordinator, db=
|
|
262
|
+
diff_coordinator = await component_registry.get_component(DiffCoordinator, db=dbs, branch=source_branch)
|
|
263
263
|
await diff_coordinator.update_branch_diff(base_branch=destination_branch, diff_branch=source_branch)
|
|
264
264
|
|
|
265
265
|
|
|
@@ -1006,11 +1006,11 @@ async def run_proposed_change_pipeline(
|
|
|
1006
1006
|
|
|
1007
1007
|
await _gather_repository_repository_diffs(repositories=repositories, service=service)
|
|
1008
1008
|
|
|
1009
|
-
async with service.database.
|
|
1010
|
-
destination_branch = await registry.get_branch(db=
|
|
1011
|
-
source_branch = await registry.get_branch(db=
|
|
1009
|
+
async with service.database.start_session() as dbs:
|
|
1010
|
+
destination_branch = await registry.get_branch(db=dbs, branch=model.destination_branch)
|
|
1011
|
+
source_branch = await registry.get_branch(db=dbs, branch=model.source_branch)
|
|
1012
1012
|
component_registry = get_component_registry()
|
|
1013
|
-
diff_coordinator = await component_registry.get_component(DiffCoordinator, db=
|
|
1013
|
+
diff_coordinator = await component_registry.get_component(DiffCoordinator, db=dbs, branch=source_branch)
|
|
1014
1014
|
await diff_coordinator.update_branch_diff(base_branch=destination_branch, diff_branch=source_branch)
|
|
1015
1015
|
|
|
1016
1016
|
diff_summary = await service.client.get_diff_summary(branch=model.source_branch)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: infrahub-server
|
|
3
|
-
Version: 1.3.
|
|
3
|
+
Version: 1.3.0b3
|
|
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: AGPL-3.0-only
|
|
6
6
|
Author: OpsMill
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
infrahub/__init__.py,sha256=OF6hovR3975Zu6-9DOL_Nh_FTgGn8kS_yOfQ-xp-chg,87
|
|
2
2
|
infrahub/actions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
-
infrahub/actions/constants.py,sha256=
|
|
4
|
-
infrahub/actions/gather.py,sha256=
|
|
5
|
-
infrahub/actions/models.py,sha256=
|
|
6
|
-
infrahub/actions/parsers.py,sha256=
|
|
7
|
-
infrahub/actions/schema.py,sha256=
|
|
3
|
+
infrahub/actions/constants.py,sha256=2g0MKToJy4fH7VAB3ZYTc577my0hnm0pkkUUkKWfOwY,5310
|
|
4
|
+
infrahub/actions/gather.py,sha256=s6RaegkD9zx7WL8ePS6eGam8TlUA3TH38tarLmQeT98,4746
|
|
5
|
+
infrahub/actions/models.py,sha256=7EVJuGLqEy71sop1XEDLpuAZfLc9ei3hxXPy2FeyY4U,8558
|
|
6
|
+
infrahub/actions/parsers.py,sha256=L0ZE2gvhSoBZHuHok0wO4UeWo8fyhbnpuMTHHZX_W7c,3997
|
|
7
|
+
infrahub/actions/schema.py,sha256=AWVSvw0pWEVXuqvVo3IQTx_LAAyPOZwy7PocvgPZpsQ,12690
|
|
8
8
|
infrahub/actions/tasks.py,sha256=Oaz6sku7E_2aadh4fFIjDeZn9YUGIY6zhzVlctQ3xbw,3820
|
|
9
9
|
infrahub/actions/triggers.py,sha256=5BKt8NkafArs8tdSQUb2uBtJVXfZrYUePByOn9d7-1Y,772
|
|
10
10
|
infrahub/api/__init__.py,sha256=dtRtBRpEgt7Y9Zdwy85jpSr8qfO_2xNTgTQLCJPQiZI,2182
|
|
@@ -218,7 +218,7 @@ infrahub/core/node/resource_manager/number_pool.py,sha256=XGzFYdodQ3ZZmia2hxHLEz
|
|
|
218
218
|
infrahub/core/node/standard.py,sha256=Cfbq01InTVRUpp9l4R3nxn_tlX6V3HchjEJ4kSxjiZM,7170
|
|
219
219
|
infrahub/core/path.py,sha256=dHIZRrNOLafdlApt0rF8zRe3KwhRbfwA_mbLcJue-4s,5840
|
|
220
220
|
infrahub/core/property.py,sha256=rwsqeaIvCMkHfJYl4WfsNPAS7KS0POo5rAN7vAprXGA,5102
|
|
221
|
-
infrahub/core/protocols.py,sha256=
|
|
221
|
+
infrahub/core/protocols.py,sha256=BDXKAT4QxMbPFnuRqIdhGJB8VY5jPpCkqdGK_li9fFU,12282
|
|
222
222
|
infrahub/core/protocols_base.py,sha256=cEi6giHtEUmaD0JWfDfWHJhEv_6wjaBA3oJRJCbvc6Q,3411
|
|
223
223
|
infrahub/core/query/__init__.py,sha256=2qIMaODLwJ6pK6BUd5vODTlA15Aecf5I8_-J44UlCso,23089
|
|
224
224
|
infrahub/core/query/attribute.py,sha256=DzwbElgTaZs6-nBYGmnDpBr9n0lmUPK3p7eyI30Snh8,11783
|
|
@@ -478,7 +478,7 @@ infrahub/graphql/mutations/node_getter/interface.py,sha256=3MVTz_3EQnI7REp-ytQvg
|
|
|
478
478
|
infrahub/graphql/mutations/proposed_change.py,sha256=4y9YTE6f9Rqk_TC2K_uued1bECthE8DmrRm1wfxXzmM,10374
|
|
479
479
|
infrahub/graphql/mutations/relationship.py,sha256=b-zi8O0JZo52zVoGabIrWvIFh64PbhHzjF9klZ7p8ac,20139
|
|
480
480
|
infrahub/graphql/mutations/repository.py,sha256=Whrt1uYWt7Ro6omJYN8zc3D-poZ6bOBrpBHIG4odAmo,11316
|
|
481
|
-
infrahub/graphql/mutations/resource_manager.py,sha256=
|
|
481
|
+
infrahub/graphql/mutations/resource_manager.py,sha256=DvnmfXmS9bNYXjtgedGTKPdJmtdaCbM5qxl0OJ-t1yQ,11342
|
|
482
482
|
infrahub/graphql/mutations/schema.py,sha256=vOwP8SIcQxamhP_JwbeXPG5iOEwxHhHawgqU6bD-4us,12897
|
|
483
483
|
infrahub/graphql/mutations/tasks.py,sha256=j2t5pMXRQ1i3ohQ-WjfDaDNQpj-CnFnqYCTZ3y5p7ec,3806
|
|
484
484
|
infrahub/graphql/mutations/webhook.py,sha256=IW_WPpBRySd-mpbkuGnR28VpU9naM2bLZBjJOaAGuH4,4777
|
|
@@ -593,7 +593,7 @@ infrahub/proposed_change/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZ
|
|
|
593
593
|
infrahub/proposed_change/branch_diff.py,sha256=Oerw3cHo51XPKwBsAmpO0T470Fg9mkpWViHVY51hToY,2303
|
|
594
594
|
infrahub/proposed_change/constants.py,sha256=w8fPxKWJM1DzeClRd7Vr53hxkzl2Bq-rnXWfE2y3Bz0,1296
|
|
595
595
|
infrahub/proposed_change/models.py,sha256=ivWJmEAihprKmwgaBGDJ4Koq4ETciE5GfDp86KHDnns,5892
|
|
596
|
-
infrahub/proposed_change/tasks.py,sha256
|
|
596
|
+
infrahub/proposed_change/tasks.py,sha256=YUdbLiF7qim1LBa7Z8O-W5MIp1_FCiuPOLnPqLHbb0c,61865
|
|
597
597
|
infrahub/pytest_plugin.py,sha256=u3t0WgLMo9XmuQYeb28mccQ3xbnyv2Fv173YWl1zBiM,6678
|
|
598
598
|
infrahub/schema/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
599
599
|
infrahub/schema/tasks.py,sha256=vEaWWksqrfwwCAIgPxscVU81W9PIxODX552Rtkte1Cs,947
|
|
@@ -796,8 +796,8 @@ infrahub_testcontainers/models.py,sha256=ASYyvl7d_WQz_i7y8-3iab9hwwmCl3OCJavqVbe
|
|
|
796
796
|
infrahub_testcontainers/performance_test.py,sha256=hvwiy6tc_lWniYqGkqfOXVGAmA_IV15VOZqbiD9ezno,6149
|
|
797
797
|
infrahub_testcontainers/plugin.py,sha256=I3RuZQ0dARyKHuqCf0y1Yj731P2Mwf3BJUehRJKeWrs,5645
|
|
798
798
|
infrahub_testcontainers/prometheus.yml,sha256=610xQEyj3xuVJMzPkC4m1fRnCrjGpiRBrXA2ytCLa54,599
|
|
799
|
-
infrahub_server-1.3.
|
|
800
|
-
infrahub_server-1.3.
|
|
801
|
-
infrahub_server-1.3.
|
|
802
|
-
infrahub_server-1.3.
|
|
803
|
-
infrahub_server-1.3.
|
|
799
|
+
infrahub_server-1.3.0b3.dist-info/LICENSE.txt,sha256=TfPDBt3ar0uv_f9cqCDMZ5rIzW3CY8anRRd4PkL6ejs,34522
|
|
800
|
+
infrahub_server-1.3.0b3.dist-info/METADATA,sha256=_26WKs27krLzlTYjXXoZhIyzPrKcKxhqnM_LLCr2QMc,8207
|
|
801
|
+
infrahub_server-1.3.0b3.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
|
802
|
+
infrahub_server-1.3.0b3.dist-info/entry_points.txt,sha256=UXIeFWDsrV-4IllNvUEd6KieYGzQfn9paga2YyABOQI,393
|
|
803
|
+
infrahub_server-1.3.0b3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|