infrahub-server 1.1.6__py3-none-any.whl → 1.2.0rc0__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.
Files changed (346) hide show
  1. infrahub/api/artifact.py +16 -4
  2. infrahub/api/dependencies.py +8 -0
  3. infrahub/api/oauth2.py +0 -1
  4. infrahub/api/oidc.py +0 -1
  5. infrahub/api/query.py +18 -7
  6. infrahub/api/schema.py +32 -6
  7. infrahub/api/transformation.py +12 -5
  8. infrahub/{message_bus/messages/check_artifact_create.py → artifacts/models.py} +2 -4
  9. infrahub/{message_bus/operations/check/artifact.py → artifacts/tasks.py} +26 -25
  10. infrahub/cli/__init__.py +0 -2
  11. infrahub/cli/db.py +6 -7
  12. infrahub/cli/events.py +8 -3
  13. infrahub/cli/git_agent.py +9 -7
  14. infrahub/cli/tasks.py +4 -6
  15. infrahub/computed_attribute/tasks.py +63 -17
  16. infrahub/computed_attribute/triggers.py +90 -0
  17. infrahub/config.py +1 -1
  18. infrahub/context.py +39 -0
  19. infrahub/core/account.py +5 -8
  20. infrahub/core/attribute.py +53 -21
  21. infrahub/core/branch/models.py +4 -4
  22. infrahub/core/branch/tasks.py +89 -130
  23. infrahub/core/changelog/__init__.py +0 -0
  24. infrahub/core/changelog/diff.py +232 -0
  25. infrahub/core/changelog/models.py +488 -0
  26. infrahub/core/constants/__init__.py +19 -2
  27. infrahub/core/constants/infrahubkind.py +1 -0
  28. infrahub/core/diff/combiner.py +12 -8
  29. infrahub/core/diff/coordinator.py +49 -70
  30. infrahub/core/diff/data_check_synchronizer.py +86 -7
  31. infrahub/core/diff/enricher/aggregated.py +3 -3
  32. infrahub/core/diff/enricher/cardinality_one.py +2 -7
  33. infrahub/core/diff/enricher/hierarchy.py +5 -3
  34. infrahub/core/diff/enricher/labels.py +14 -4
  35. infrahub/core/diff/enricher/path_identifier.py +3 -9
  36. infrahub/core/diff/enricher/summary_counts.py +3 -1
  37. infrahub/core/diff/merger/merger.py +8 -4
  38. infrahub/core/diff/model/path.py +47 -29
  39. infrahub/core/diff/query/all_conflicts.py +6 -3
  40. infrahub/core/diff/query/artifact.py +1 -1
  41. infrahub/core/diff/query/delete_query.py +1 -1
  42. infrahub/core/diff/query/diff_get.py +3 -2
  43. infrahub/core/diff/query/diff_summary.py +1 -1
  44. infrahub/core/diff/query/field_specifiers.py +3 -1
  45. infrahub/core/diff/query/field_summary.py +3 -2
  46. infrahub/core/diff/query/filters.py +12 -1
  47. infrahub/core/diff/query/get_conflict_query.py +1 -1
  48. infrahub/core/diff/query/has_conflicts_query.py +6 -3
  49. infrahub/core/diff/query/merge.py +3 -3
  50. infrahub/core/diff/query/{drop_tracking_id.py → merge_tracking_id.py} +4 -4
  51. infrahub/core/diff/query/roots_metadata.py +9 -2
  52. infrahub/core/diff/query/save.py +151 -66
  53. infrahub/core/diff/query/summary_counts_enricher.py +220 -0
  54. infrahub/core/diff/query/time_range_query.py +3 -2
  55. infrahub/core/diff/query/update_conflict_query.py +1 -1
  56. infrahub/core/diff/query_parser.py +49 -24
  57. infrahub/core/diff/repository/deserializer.py +24 -25
  58. infrahub/core/diff/repository/repository.py +76 -20
  59. infrahub/core/diff/tasks.py +9 -8
  60. infrahub/core/enums.py +1 -1
  61. infrahub/core/integrity/object_conflict/conflict_recorder.py +1 -1
  62. infrahub/core/ipam/reconciler.py +1 -1
  63. infrahub/core/ipam/tasks.py +2 -3
  64. infrahub/core/manager.py +18 -13
  65. infrahub/core/merge.py +5 -2
  66. infrahub/core/migrations/graph/m001_add_version_to_graph.py +1 -1
  67. infrahub/core/migrations/graph/m002_attribute_is_default.py +2 -2
  68. infrahub/core/migrations/graph/m003_relationship_parent_optional.py +2 -2
  69. infrahub/core/migrations/graph/m004_add_attr_documentation.py +1 -1
  70. infrahub/core/migrations/graph/m005_add_rel_read_only.py +1 -1
  71. infrahub/core/migrations/graph/m006_add_rel_on_delete.py +1 -1
  72. infrahub/core/migrations/graph/m007_add_rel_allow_override.py +1 -1
  73. infrahub/core/migrations/graph/m008_add_human_friendly_id.py +1 -1
  74. infrahub/core/migrations/graph/m009_add_generate_profile_attr.py +1 -1
  75. infrahub/core/migrations/graph/m010_add_generate_profile_attr_generic.py +1 -1
  76. infrahub/core/migrations/graph/m011_remove_profile_relationship_schema.py +2 -2
  77. infrahub/core/migrations/graph/m012_convert_account_generic.py +12 -23
  78. infrahub/core/migrations/graph/m013_convert_git_password_credential.py +7 -11
  79. infrahub/core/migrations/graph/m014_remove_index_attr_value.py +2 -2
  80. infrahub/core/migrations/graph/m015_diff_format_update.py +1 -1
  81. infrahub/core/migrations/graph/m016_diff_delete_bug_fix.py +1 -1
  82. infrahub/core/migrations/graph/m017_add_core_profile.py +1 -1
  83. infrahub/core/migrations/graph/m018_uniqueness_nulls.py +2 -2
  84. infrahub/core/migrations/query/attribute_add.py +1 -1
  85. infrahub/core/migrations/query/attribute_rename.py +1 -1
  86. infrahub/core/migrations/query/delete_element_in_schema.py +1 -1
  87. infrahub/core/migrations/query/node_duplicate.py +1 -1
  88. infrahub/core/migrations/query/relationship_duplicate.py +1 -1
  89. infrahub/core/migrations/query/schema_attribute_update.py +1 -1
  90. infrahub/core/migrations/schema/node_attribute_remove.py +1 -1
  91. infrahub/core/migrations/schema/node_remove.py +1 -1
  92. infrahub/core/migrations/schema/tasks.py +5 -5
  93. infrahub/core/migrations/shared.py +4 -4
  94. infrahub/core/models.py +7 -8
  95. infrahub/core/node/__init__.py +161 -40
  96. infrahub/core/node/base.py +1 -1
  97. infrahub/core/node/constraints/grouped_uniqueness.py +9 -2
  98. infrahub/core/node/delete_validator.py +4 -4
  99. infrahub/core/node/ipam.py +13 -8
  100. infrahub/core/node/permissions.py +4 -0
  101. infrahub/core/node/resource_manager/ip_prefix_pool.py +8 -5
  102. infrahub/core/node/standard.py +3 -5
  103. infrahub/core/property.py +1 -1
  104. infrahub/core/protocols.py +4 -0
  105. infrahub/core/protocols_base.py +4 -2
  106. infrahub/core/query/__init__.py +2 -5
  107. infrahub/core/query/attribute.py +9 -9
  108. infrahub/core/query/branch.py +5 -5
  109. infrahub/core/query/delete.py +1 -1
  110. infrahub/core/query/diff.py +45 -7
  111. infrahub/core/query/ipam.py +4 -4
  112. infrahub/core/query/node.py +19 -14
  113. infrahub/core/query/relationship.py +10 -11
  114. infrahub/core/query/resource_manager.py +13 -11
  115. infrahub/core/query/standard_node.py +6 -6
  116. infrahub/core/query/task.py +3 -3
  117. infrahub/core/query/task_log.py +1 -1
  118. infrahub/core/query/utils.py +5 -5
  119. infrahub/core/registry.py +0 -2
  120. infrahub/core/relationship/constraints/count.py +1 -1
  121. infrahub/core/relationship/constraints/peer_kind.py +1 -1
  122. infrahub/core/relationship/model.py +66 -26
  123. infrahub/core/schema/__init__.py +6 -4
  124. infrahub/core/schema/basenode_schema.py +1 -3
  125. infrahub/core/schema/definitions/core.py +14 -2
  126. infrahub/core/schema/definitions/internal.py +16 -0
  127. infrahub/core/schema/generated/genericnode_schema.py +5 -0
  128. infrahub/core/schema/generated/node_schema.py +5 -0
  129. infrahub/core/schema/generic_schema.py +5 -1
  130. infrahub/core/schema/manager.py +45 -42
  131. infrahub/core/schema/node_schema.py +4 -0
  132. infrahub/core/schema/profile_schema.py +4 -0
  133. infrahub/core/schema/relationship_schema.py +2 -2
  134. infrahub/core/schema/schema_branch.py +248 -14
  135. infrahub/core/schema/template_schema.py +36 -0
  136. infrahub/core/task/user_task.py +7 -5
  137. infrahub/core/timestamp.py +1 -1
  138. infrahub/core/utils.py +3 -2
  139. infrahub/core/validators/attribute/choices.py +1 -1
  140. infrahub/core/validators/attribute/enum.py +1 -1
  141. infrahub/core/validators/attribute/kind.py +1 -1
  142. infrahub/core/validators/attribute/length.py +1 -1
  143. infrahub/core/validators/attribute/optional.py +1 -1
  144. infrahub/core/validators/attribute/regex.py +1 -1
  145. infrahub/core/validators/attribute/unique.py +1 -1
  146. infrahub/core/validators/checks_runner.py +37 -0
  147. infrahub/core/validators/node/generate_profile.py +1 -1
  148. infrahub/core/validators/node/hierarchy.py +1 -1
  149. infrahub/core/validators/query.py +1 -1
  150. infrahub/core/validators/relationship/count.py +1 -1
  151. infrahub/core/validators/relationship/optional.py +1 -1
  152. infrahub/core/validators/relationship/peer.py +1 -1
  153. infrahub/core/validators/tasks.py +8 -6
  154. infrahub/core/validators/uniqueness/query.py +20 -17
  155. infrahub/database/__init__.py +15 -2
  156. infrahub/database/memgraph.py +1 -1
  157. infrahub/dependencies/builder/constraint/grouped/node_runner.py +0 -2
  158. infrahub/dependencies/builder/diff/combiner.py +1 -1
  159. infrahub/dependencies/builder/diff/conflicts_enricher.py +1 -1
  160. infrahub/dependencies/builder/diff/coordinator.py +0 -2
  161. infrahub/dependencies/builder/diff/deserializer.py +1 -1
  162. infrahub/dependencies/builder/diff/enricher/summary_counts.py +1 -1
  163. infrahub/events/branch_action.py +47 -21
  164. infrahub/events/group_action.py +73 -0
  165. infrahub/events/models.py +159 -51
  166. infrahub/events/node_action.py +74 -8
  167. infrahub/events/repository_action.py +8 -8
  168. infrahub/events/schema_action.py +21 -8
  169. infrahub/generators/tasks.py +12 -13
  170. infrahub/git/base.py +3 -5
  171. infrahub/git/constants.py +0 -1
  172. infrahub/git/integrator.py +36 -35
  173. infrahub/git/repository.py +7 -8
  174. infrahub/git/tasks.py +43 -107
  175. infrahub/git_credential/helper.py +2 -3
  176. infrahub/graphql/analyzer.py +572 -11
  177. infrahub/graphql/app.py +34 -26
  178. infrahub/graphql/auth/query_permission_checker/anonymous_checker.py +5 -5
  179. infrahub/graphql/auth/query_permission_checker/default_branch_checker.py +4 -4
  180. infrahub/graphql/auth/query_permission_checker/merge_operation_checker.py +4 -4
  181. infrahub/graphql/auth/query_permission_checker/object_permission_checker.py +28 -35
  182. infrahub/graphql/auth/query_permission_checker/super_admin_checker.py +5 -5
  183. infrahub/graphql/enums.py +1 -1
  184. infrahub/graphql/initialization.py +5 -1
  185. infrahub/graphql/loaders/node.py +2 -2
  186. infrahub/graphql/manager.py +59 -54
  187. infrahub/graphql/mutations/account.py +20 -13
  188. infrahub/graphql/mutations/artifact_definition.py +16 -12
  189. infrahub/graphql/mutations/branch.py +61 -40
  190. infrahub/graphql/mutations/computed_attribute.py +19 -13
  191. infrahub/graphql/mutations/diff.py +37 -9
  192. infrahub/graphql/mutations/diff_conflict.py +9 -8
  193. infrahub/graphql/mutations/graphql_query.py +19 -11
  194. infrahub/graphql/mutations/ipam.py +21 -19
  195. infrahub/graphql/mutations/main.py +197 -44
  196. infrahub/graphql/mutations/menu.py +8 -8
  197. infrahub/graphql/mutations/proposed_change.py +36 -28
  198. infrahub/graphql/mutations/relationship.py +302 -105
  199. infrahub/graphql/mutations/repository.py +41 -35
  200. infrahub/graphql/mutations/resource_manager.py +26 -26
  201. infrahub/graphql/mutations/schema.py +51 -33
  202. infrahub/graphql/mutations/tasks.py +16 -10
  203. infrahub/graphql/parser.py +1 -1
  204. infrahub/graphql/permissions.py +6 -4
  205. infrahub/graphql/queries/account.py +22 -18
  206. infrahub/graphql/queries/branch.py +6 -4
  207. infrahub/graphql/queries/diff/tree.py +48 -42
  208. infrahub/graphql/queries/event.py +112 -0
  209. infrahub/graphql/queries/internal.py +3 -3
  210. infrahub/graphql/queries/ipam.py +23 -18
  211. infrahub/graphql/queries/relationship.py +11 -10
  212. infrahub/graphql/queries/resource_manager.py +43 -27
  213. infrahub/graphql/queries/search.py +9 -8
  214. infrahub/graphql/queries/status.py +12 -9
  215. infrahub/graphql/queries/task.py +11 -9
  216. infrahub/graphql/resolvers/resolver.py +69 -43
  217. infrahub/graphql/resolvers/single_relationship.py +16 -10
  218. infrahub/graphql/schema.py +2 -0
  219. infrahub/graphql/subscription/__init__.py +1 -1
  220. infrahub/graphql/subscription/events.py +1 -1
  221. infrahub/graphql/subscription/graphql_query.py +8 -8
  222. infrahub/graphql/types/branch.py +2 -2
  223. infrahub/graphql/types/common.py +6 -1
  224. infrahub/graphql/types/enums.py +2 -0
  225. infrahub/graphql/types/event.py +100 -0
  226. infrahub/graphql/types/interface.py +2 -2
  227. infrahub/graphql/types/node.py +3 -3
  228. infrahub/graphql/types/permission.py +2 -2
  229. infrahub/graphql/types/relationship.py +3 -3
  230. infrahub/graphql/types/standard_node.py +9 -11
  231. infrahub/graphql/utils.py +28 -182
  232. infrahub/groups/tasks.py +2 -3
  233. infrahub/lock.py +1 -1
  234. infrahub/menu/constants.py +1 -0
  235. infrahub/menu/generator.py +14 -3
  236. infrahub/menu/menu.py +116 -127
  237. infrahub/menu/models.py +4 -4
  238. infrahub/message_bus/messages/__init__.py +0 -4
  239. infrahub/message_bus/messages/event_branch_merge.py +3 -0
  240. infrahub/message_bus/messages/request_proposedchange_pipeline.py +2 -0
  241. infrahub/message_bus/operations/__init__.py +3 -5
  242. infrahub/message_bus/operations/check/__init__.py +2 -2
  243. infrahub/message_bus/operations/check/generator.py +1 -3
  244. infrahub/message_bus/operations/check/repository.py +1 -1
  245. infrahub/message_bus/operations/event/branch.py +7 -3
  246. infrahub/message_bus/operations/event/schema.py +1 -1
  247. infrahub/message_bus/operations/finalize/validator.py +1 -1
  248. infrahub/message_bus/operations/git/file.py +2 -2
  249. infrahub/message_bus/operations/git/repository.py +1 -1
  250. infrahub/message_bus/operations/requests/__init__.py +0 -2
  251. infrahub/message_bus/operations/requests/generator_definition.py +1 -1
  252. infrahub/message_bus/operations/requests/proposed_change.py +26 -11
  253. infrahub/message_bus/operations/requests/repository.py +2 -2
  254. infrahub/message_bus/operations/send/echo.py +1 -1
  255. infrahub/message_bus/types.py +1 -1
  256. infrahub/permissions/__init__.py +2 -1
  257. infrahub/permissions/types.py +26 -0
  258. infrahub/pools/prefix.py +29 -165
  259. infrahub/prefect_server/__init__.py +0 -0
  260. infrahub/prefect_server/app.py +18 -0
  261. infrahub/prefect_server/database.py +20 -0
  262. infrahub/prefect_server/events.py +28 -0
  263. infrahub/prefect_server/models.py +46 -0
  264. infrahub/proposed_change/models.py +15 -1
  265. infrahub/proposed_change/tasks.py +173 -35
  266. infrahub/pytest_plugin.py +4 -4
  267. infrahub/server.py +12 -11
  268. infrahub/services/__init__.py +147 -62
  269. infrahub/services/adapters/cache/__init__.py +7 -5
  270. infrahub/services/adapters/cache/nats.py +40 -22
  271. infrahub/services/adapters/cache/redis.py +0 -4
  272. infrahub/services/adapters/event/__init__.py +10 -18
  273. infrahub/services/adapters/http/__init__.py +0 -5
  274. infrahub/services/adapters/http/httpx.py +22 -15
  275. infrahub/services/adapters/message_bus/__init__.py +23 -6
  276. infrahub/services/adapters/message_bus/local.py +8 -6
  277. infrahub/services/adapters/message_bus/nats.py +12 -6
  278. infrahub/services/adapters/message_bus/rabbitmq.py +22 -9
  279. infrahub/services/adapters/workflow/__init__.py +11 -8
  280. infrahub/services/adapters/workflow/local.py +28 -7
  281. infrahub/services/adapters/workflow/worker.py +23 -7
  282. infrahub/services/component.py +38 -35
  283. infrahub/services/scheduler.py +32 -29
  284. infrahub/storage.py +2 -4
  285. infrahub/task_manager/constants.py +1 -1
  286. infrahub/task_manager/event.py +182 -0
  287. infrahub/task_manager/models.py +125 -1
  288. infrahub/task_manager/task.py +1 -1
  289. infrahub/tasks/artifact.py +14 -16
  290. infrahub/tasks/registry.py +1 -1
  291. infrahub/tasks/telemetry.py +13 -14
  292. infrahub/transformations/tasks.py +3 -5
  293. infrahub/trigger/__init__.py +0 -0
  294. infrahub/trigger/catalogue.py +15 -0
  295. infrahub/trigger/constants.py +9 -0
  296. infrahub/trigger/models.py +69 -0
  297. infrahub/trigger/tasks.py +85 -0
  298. infrahub/types.py +1 -1
  299. infrahub/utils.py +1 -1
  300. infrahub/webhook/constants.py +0 -2
  301. infrahub/webhook/models.py +8 -2
  302. infrahub/webhook/tasks.py +20 -73
  303. infrahub/webhook/triggers.py +20 -0
  304. infrahub/workers/infrahub_async.py +36 -25
  305. infrahub/workers/utils.py +63 -0
  306. infrahub/workflows/catalogue.py +13 -37
  307. infrahub/workflows/initialization.py +6 -8
  308. infrahub/workflows/models.py +3 -5
  309. infrahub/workflows/utils.py +1 -1
  310. infrahub_sdk/ctl/check.py +3 -3
  311. infrahub_sdk/ctl/cli_commands.py +11 -10
  312. infrahub_sdk/ctl/exceptions.py +0 -6
  313. infrahub_sdk/ctl/exporter.py +1 -1
  314. infrahub_sdk/ctl/generator.py +5 -5
  315. infrahub_sdk/ctl/importer.py +3 -2
  316. infrahub_sdk/ctl/menu.py +1 -1
  317. infrahub_sdk/ctl/object.py +1 -1
  318. infrahub_sdk/ctl/repository.py +23 -15
  319. infrahub_sdk/ctl/schema.py +2 -2
  320. infrahub_sdk/ctl/utils.py +4 -3
  321. infrahub_sdk/ctl/validate.py +2 -1
  322. infrahub_sdk/exceptions.py +6 -0
  323. infrahub_sdk/generator.py +3 -0
  324. infrahub_sdk/node.py +2 -2
  325. infrahub_sdk/schema/__init__.py +14 -2
  326. infrahub_sdk/schema/main.py +7 -0
  327. infrahub_sdk/utils.py +11 -1
  328. infrahub_sdk/yaml.py +2 -3
  329. {infrahub_server-1.1.6.dist-info → infrahub_server-1.2.0rc0.dist-info}/METADATA +46 -12
  330. {infrahub_server-1.1.6.dist-info → infrahub_server-1.2.0rc0.dist-info}/RECORD +338 -321
  331. infrahub_testcontainers/container.py +14 -6
  332. infrahub_testcontainers/docker-compose.test.yml +24 -5
  333. infrahub_testcontainers/haproxy.cfg +43 -0
  334. infrahub_testcontainers/helpers.py +85 -1
  335. infrahub/core/branch/constants.py +0 -2
  336. infrahub/graphql/query.py +0 -52
  337. infrahub/message_bus/messages/request_artifactdefinition_check.py +0 -17
  338. infrahub/message_bus/operations/requests/artifact_definition.py +0 -148
  339. infrahub/schema/constants.py +0 -1
  340. infrahub/schema/tasks.py +0 -76
  341. infrahub/services/adapters/database/__init__.py +0 -9
  342. infrahub_sdk/ctl/_file.py +0 -13
  343. /infrahub/{schema → artifacts}/__init__.py +0 -0
  344. {infrahub_server-1.1.6.dist-info → infrahub_server-1.2.0rc0.dist-info}/LICENSE.txt +0 -0
  345. {infrahub_server-1.1.6.dist-info → infrahub_server-1.2.0rc0.dist-info}/WHEEL +0 -0
  346. {infrahub_server-1.1.6.dist-info → infrahub_server-1.2.0rc0.dist-info}/entry_points.txt +0 -0
@@ -8,3 +8,4 @@ class MenuSection(InfrahubStringEnum):
8
8
 
9
9
  DEFAULT_MENU = "Other"
10
10
  FULL_DEFAULT_MENU = "BuiltinOther"
11
+ TEMPLATE_MENU = "Object templates"
@@ -3,10 +3,11 @@ from __future__ import annotations
3
3
  from typing import TYPE_CHECKING
4
4
 
5
5
  from infrahub.core import registry
6
+ from infrahub.core.constants import InfrahubKind
6
7
  from infrahub.core.protocols import CoreMenuItem
7
8
  from infrahub.log import get_logger
8
9
 
9
- from .constants import FULL_DEFAULT_MENU
10
+ from .constants import FULL_DEFAULT_MENU, TEMPLATE_MENU
10
11
  from .models import MenuDict, MenuItemDict
11
12
 
12
13
  if TYPE_CHECKING:
@@ -39,7 +40,6 @@ async def generate_restricted_menu(
39
40
  return menu
40
41
 
41
42
 
42
- # pylint: disable=too-many-branches,too-many-statements
43
43
  async def generate_menu(db: InfrahubDatabase, branch: Branch, menu_items: list[CoreMenuItem]) -> MenuDict:
44
44
  structure = MenuDict()
45
45
  full_schema = registry.schema.get_full(branch=branch, duplicate=False)
@@ -82,6 +82,11 @@ async def generate_menu(db: InfrahubDatabase, branch: Branch, menu_items: list[C
82
82
 
83
83
  items_to_add = {schema.kind: False for schema in full_schema.values() if schema.include_in_menu is True}
84
84
 
85
+ # Object templates should go into a dedicated menu item
86
+ object_templates_menu = MenuItemDict(
87
+ identifier=InfrahubKind.OBJECTTEMPLATE, label=TEMPLATE_MENU.title(), icon="mdi:pencil-ruler", order_weight=20000
88
+ )
89
+
85
90
  nbr_remaining_items_last_round = len(items_to_add.values())
86
91
  nbr_remaining_items = len([value for value in items_to_add.values() if value is False])
87
92
  while not all(items_to_add.values()):
@@ -96,7 +101,10 @@ async def generate_menu(db: InfrahubDatabase, branch: Branch, menu_items: list[C
96
101
  items_to_add[item_name] = True
97
102
  continue
98
103
 
99
- if not schema.menu_placement:
104
+ if schema.namespace == "Template":
105
+ object_templates_menu.children[menu_item.identifier] = menu_item
106
+ items_to_add[item_name] = True
107
+ elif not schema.menu_placement:
100
108
  first_element = MenuItemDict.from_schema(model=schema)
101
109
  first_element.identifier = f"{first_element.identifier}Sub"
102
110
  first_element.order_weight = 1
@@ -113,6 +121,9 @@ async def generate_menu(db: InfrahubDatabase, branch: Branch, menu_items: list[C
113
121
  break
114
122
  nbr_remaining_items_last_round = nbr_remaining_items
115
123
 
124
+ if object_templates_menu.children:
125
+ structure.data[object_templates_menu.identifier] = object_templates_menu
126
+
116
127
  # ----------------------------------------------------------------------------
117
128
  # Assign the remaining items for which we couldn't find the menu_placement to the default menu
118
129
  # ----------------------------------------------------------------------------
infrahub/menu/menu.py CHANGED
@@ -96,6 +96,16 @@ default_menu = [
96
96
  section=MenuSection.INTERNAL,
97
97
  order_weight=1000,
98
98
  ),
99
+ MenuItemDefinition(
100
+ namespace="Builtin",
101
+ name="Branches",
102
+ label="Branches",
103
+ path="/branches",
104
+ icon="mdi:layers-triple",
105
+ protected=True,
106
+ section=MenuSection.INTERNAL,
107
+ order_weight=1500,
108
+ ),
99
109
  MenuItemDefinition(
100
110
  namespace="Builtin",
101
111
  name="ObjectManagement",
@@ -103,7 +113,7 @@ default_menu = [
103
113
  icon="mdi:cube-outline",
104
114
  protected=True,
105
115
  section=MenuSection.INTERNAL,
106
- order_weight=1500,
116
+ order_weight=2000,
107
117
  children=[
108
118
  MenuItemDefinition(
109
119
  namespace="Builtin",
@@ -123,232 +133,211 @@ default_menu = [
123
133
  icon=_extract_node_icon(infrahub_schema.get(InfrahubKind.PROFILE)),
124
134
  protected=True,
125
135
  section=MenuSection.INTERNAL,
126
- order_weight=2000,
136
+ order_weight=1500,
127
137
  ),
128
138
  MenuItemDefinition(
129
139
  namespace="Builtin",
130
140
  name="ResourceManager",
131
- label="Resource Manager",
141
+ label="Resource Managers",
132
142
  path="/resource-manager",
133
143
  icon=_extract_node_icon(infrahub_schema.get(InfrahubKind.RESOURCEPOOL)),
134
144
  protected=True,
135
145
  section=MenuSection.INTERNAL,
136
- order_weight=3000,
146
+ order_weight=2000,
137
147
  ),
138
- ],
139
- ),
140
- MenuItemDefinition(
141
- namespace="Builtin",
142
- name="ChangeControl",
143
- label="Change Control",
144
- icon="mdi:source-branch",
145
- protected=True,
146
- section=MenuSection.INTERNAL,
147
- order_weight=2000,
148
- children=[
149
148
  MenuItemDefinition(
150
149
  namespace="Builtin",
151
- name="Branches",
152
- label="Branches",
153
- path="/branches",
154
- icon="mdi:layers-triple",
150
+ name="Artifact",
151
+ label="Artifacts",
152
+ kind=InfrahubKind.ARTIFACT,
153
+ icon=_extract_node_icon(infrahub_schema.get(InfrahubKind.ARTIFACT)),
155
154
  protected=True,
156
155
  section=MenuSection.INTERNAL,
157
- order_weight=1000,
156
+ order_weight=2500,
158
157
  ),
159
158
  MenuItemDefinition(
160
159
  namespace="Builtin",
161
- name="CheckDefinition",
162
- label="Check Definition",
163
- kind=InfrahubKind.CHECKDEFINITION,
164
- icon=_extract_node_icon(infrahub_schema.get(InfrahubKind.CHECKDEFINITION)),
160
+ name="Schema",
161
+ label="Schemas",
162
+ path="/schema",
163
+ icon="mdi:file-code",
165
164
  protected=True,
166
165
  section=MenuSection.INTERNAL,
167
- order_weight=3000,
166
+ order_weight=2000,
168
167
  ),
169
168
  MenuItemDefinition(
170
169
  namespace="Builtin",
171
- name="Tasks",
172
- label="Tasks",
173
- path="/tasks",
174
- icon="mdi:shield-check",
170
+ name="GraphqlQuery",
171
+ label="GraphQL Queries",
172
+ kind=InfrahubKind.GRAPHQLQUERY,
173
+ icon=_extract_node_icon(infrahub_schema.get(InfrahubKind.GRAPHQLQUERY)),
175
174
  protected=True,
176
175
  section=MenuSection.INTERNAL,
177
- order_weight=3000,
176
+ order_weight=3500,
177
+ ),
178
+ MenuItemDefinition(
179
+ namespace="Builtin",
180
+ name="ActivityLogs",
181
+ label="Activity Logs",
182
+ path="/activities",
183
+ icon="mdi:format-list-bulleted",
184
+ protected=True,
185
+ section=MenuSection.INTERNAL,
186
+ order_weight=4000,
178
187
  ),
179
188
  ],
180
189
  ),
181
190
  MenuItemDefinition(
182
191
  namespace="Builtin",
183
- name="UnifiedStorage",
184
- label="Unified Storage",
185
- icon="mdi:nas",
192
+ name="Actions",
193
+ label="Actions",
194
+ icon="mdi:rocket-launch",
186
195
  protected=True,
187
196
  section=MenuSection.INTERNAL,
188
197
  order_weight=2500,
189
198
  children=[
190
199
  MenuItemDefinition(
191
200
  namespace="Builtin",
192
- name="Schema",
193
- label="Schema",
194
- path="/schema",
195
- icon="mdi:file-code",
201
+ name="CheckDefinition",
202
+ label="Check Definition",
203
+ kind=InfrahubKind.CHECKDEFINITION,
204
+ icon=_extract_node_icon(infrahub_schema.get(InfrahubKind.CHECKDEFINITION)),
205
+ protected=True,
206
+ section=MenuSection.INTERNAL,
207
+ order_weight=3000,
208
+ ),
209
+ MenuItemDefinition(
210
+ namespace="Builtin",
211
+ name="ArtifactDefinition",
212
+ label="Artifact Definitions",
213
+ kind=InfrahubKind.ARTIFACTDEFINITION,
214
+ icon=_extract_node_icon(infrahub_schema.get(InfrahubKind.ARTIFACTDEFINITION)),
196
215
  protected=True,
197
216
  section=MenuSection.INTERNAL,
198
217
  order_weight=1000,
199
218
  ),
200
219
  MenuItemDefinition(
201
220
  namespace="Builtin",
202
- name="Git Repository",
203
- label="Repository",
204
- kind=InfrahubKind.GENERICREPOSITORY,
205
- icon=_extract_node_icon(infrahub_schema.get(InfrahubKind.GENERICREPOSITORY)),
221
+ name="Transformation",
222
+ label="Transformations",
223
+ kind=InfrahubKind.TRANSFORM,
224
+ icon=_extract_node_icon(infrahub_schema.get(InfrahubKind.TRANSFORM)),
206
225
  protected=True,
207
226
  section=MenuSection.INTERNAL,
208
- order_weight=2000,
227
+ order_weight=3000,
209
228
  ),
210
229
  MenuItemDefinition(
211
230
  namespace="Builtin",
212
- name="Credentials",
213
- label="Credentials",
214
- kind=InfrahubKind.CREDENTIAL,
215
- icon=_extract_node_icon(infrahub_schema.get(InfrahubKind.CREDENTIAL)),
231
+ name="GeneratorInstance",
232
+ label="Generators",
233
+ kind=InfrahubKind.GENERATORINSTANCE,
234
+ icon=_extract_node_icon(infrahub_schema.get(InfrahubKind.GENERATORINSTANCE)),
216
235
  protected=True,
217
236
  section=MenuSection.INTERNAL,
218
- order_weight=2000,
237
+ order_weight=1000,
219
238
  ),
220
239
  MenuItemDefinition(
221
240
  namespace="Builtin",
222
- name="GraphqlQuery",
223
- label="GraphQL Query",
224
- kind=InfrahubKind.GRAPHQLQUERY,
225
- icon=_extract_node_icon(infrahub_schema.get(InfrahubKind.GRAPHQLQUERY)),
241
+ name="GeneratorDefinition",
242
+ label="Generator Definitions",
243
+ kind=InfrahubKind.GENERATORDEFINITION,
244
+ icon=_extract_node_icon(infrahub_schema.get(InfrahubKind.GENERATORDEFINITION)),
226
245
  protected=True,
227
246
  section=MenuSection.INTERNAL,
228
- order_weight=3000,
247
+ order_weight=2000,
229
248
  ),
230
249
  ],
231
250
  ),
232
251
  MenuItemDefinition(
233
252
  namespace="Builtin",
234
- name="Deployment",
235
- label="Deployment",
236
- icon="mdi:rocket-launch",
253
+ name="Integration",
254
+ label="Integrations",
255
+ icon="mdi:connection",
237
256
  protected=True,
238
257
  section=MenuSection.INTERNAL,
239
258
  order_weight=3000,
240
259
  children=[
241
260
  MenuItemDefinition(
242
261
  namespace="Builtin",
243
- name="ArtifactMenu",
244
- label="Artifact",
262
+ name="Webhooks",
263
+ label="Webhooks",
264
+ icon=_extract_node_icon(infrahub_schema.get(InfrahubKind.CUSTOMWEBHOOK)),
245
265
  protected=True,
246
266
  section=MenuSection.INTERNAL,
247
- order_weight=1000,
267
+ order_weight=3000,
248
268
  children=[
249
269
  MenuItemDefinition(
250
270
  namespace="Builtin",
251
- name="Artifact",
252
- label="Artifact",
253
- kind=InfrahubKind.ARTIFACT,
254
- icon=_extract_node_icon(infrahub_schema.get(InfrahubKind.ARTIFACT)),
271
+ name="WebhookStandard",
272
+ label="Webhooks",
273
+ kind=InfrahubKind.STANDARDWEBHOOK,
274
+ icon=_extract_node_icon(infrahub_schema.get(InfrahubKind.STANDARDWEBHOOK)),
255
275
  protected=True,
256
276
  section=MenuSection.INTERNAL,
257
277
  order_weight=1000,
258
278
  ),
259
279
  MenuItemDefinition(
260
280
  namespace="Builtin",
261
- name="ArtifactDefinition",
262
- label="Artifact Definition",
263
- kind=InfrahubKind.ARTIFACTDEFINITION,
264
- icon=_extract_node_icon(infrahub_schema.get(InfrahubKind.ARTIFACTDEFINITION)),
281
+ name="WebhookCustom",
282
+ label="Custom Webhooks",
283
+ kind=InfrahubKind.CUSTOMWEBHOOK,
284
+ icon=_extract_node_icon(infrahub_schema.get(InfrahubKind.CUSTOMWEBHOOK)),
265
285
  protected=True,
266
286
  section=MenuSection.INTERNAL,
267
- order_weight=1000,
287
+ order_weight=2000,
268
288
  ),
269
289
  ],
270
290
  ),
271
291
  MenuItemDefinition(
272
292
  namespace="Builtin",
273
- name="GeneratorMenu",
274
- label="Generator",
293
+ name="Git Repository",
294
+ label="Git Repositories",
295
+ kind=InfrahubKind.GENERICREPOSITORY,
296
+ icon=_extract_node_icon(infrahub_schema.get(InfrahubKind.GENERICREPOSITORY)),
275
297
  protected=True,
276
298
  section=MenuSection.INTERNAL,
277
- order_weight=1000,
278
- children=[
279
- MenuItemDefinition(
280
- namespace="Builtin",
281
- name="GeneratorInstance",
282
- label="Generator Instance",
283
- kind=InfrahubKind.GENERATORINSTANCE,
284
- icon=_extract_node_icon(infrahub_schema.get(InfrahubKind.GENERATORINSTANCE)),
285
- protected=True,
286
- section=MenuSection.INTERNAL,
287
- order_weight=1000,
288
- ),
289
- MenuItemDefinition(
290
- namespace="Builtin",
291
- name="GeneratorDefinition",
292
- label="Generator Definition",
293
- kind=InfrahubKind.GENERATORDEFINITION,
294
- icon=_extract_node_icon(infrahub_schema.get(InfrahubKind.GENERATORDEFINITION)),
295
- protected=True,
296
- section=MenuSection.INTERNAL,
297
- order_weight=2000,
298
- ),
299
- ],
299
+ order_weight=2000,
300
300
  ),
301
301
  MenuItemDefinition(
302
302
  namespace="Builtin",
303
- name="Transformation",
304
- label="Transformation",
305
- kind=InfrahubKind.TRANSFORM,
306
- icon=_extract_node_icon(infrahub_schema.get(InfrahubKind.TRANSFORM)),
303
+ name="Credentials",
304
+ label="Credentials",
305
+ kind=InfrahubKind.CREDENTIAL,
306
+ icon=_extract_node_icon(infrahub_schema.get(InfrahubKind.CREDENTIAL)),
307
307
  protected=True,
308
308
  section=MenuSection.INTERNAL,
309
- order_weight=3000,
309
+ order_weight=2000,
310
310
  ),
311
311
  ],
312
312
  ),
313
313
  MenuItemDefinition(
314
314
  namespace="Builtin",
315
- name="Integration",
316
- label="Integrations",
317
- icon="mdi:connection",
315
+ name="Activity",
316
+ label="Activity",
317
+ icon="mdi:chart-bar-stacked",
318
318
  protected=True,
319
319
  section=MenuSection.INTERNAL,
320
- order_weight=3500,
320
+ order_weight=4000,
321
321
  children=[
322
322
  MenuItemDefinition(
323
323
  namespace="Builtin",
324
- name="Webhooks",
325
- label="Webhooks",
326
- icon=_extract_node_icon(infrahub_schema.get(InfrahubKind.CUSTOMWEBHOOK)),
324
+ name="Tasks",
325
+ label="Tasks",
326
+ path="/tasks",
327
+ icon="mdi:shield-check",
327
328
  protected=True,
328
329
  section=MenuSection.INTERNAL,
329
- order_weight=3000,
330
- children=[
331
- MenuItemDefinition(
332
- namespace="Builtin",
333
- name="WebhookStandard",
334
- label="Webhook",
335
- kind=InfrahubKind.STANDARDWEBHOOK,
336
- icon=_extract_node_icon(infrahub_schema.get(InfrahubKind.STANDARDWEBHOOK)),
337
- protected=True,
338
- section=MenuSection.INTERNAL,
339
- order_weight=1000,
340
- ),
341
- MenuItemDefinition(
342
- namespace="Builtin",
343
- name="WebhookCustom",
344
- label="Custom Webhook",
345
- kind=InfrahubKind.CUSTOMWEBHOOK,
346
- icon=_extract_node_icon(infrahub_schema.get(InfrahubKind.CUSTOMWEBHOOK)),
347
- protected=True,
348
- section=MenuSection.INTERNAL,
349
- order_weight=2000,
350
- ),
351
- ],
330
+ order_weight=1000,
331
+ ),
332
+ MenuItemDefinition(
333
+ namespace="Builtin",
334
+ name="ActivityLog",
335
+ label="Activity Log",
336
+ path="/activity-log",
337
+ icon="mdi:timeline-text",
338
+ protected=True,
339
+ section=MenuSection.INTERNAL,
340
+ order_weight=2000,
352
341
  ),
353
342
  ],
354
343
  ),
infrahub/menu/models.py CHANGED
@@ -9,7 +9,7 @@ from typing_extensions import Self
9
9
  from infrahub.core.account import GlobalPermission
10
10
  from infrahub.core.node import Node
11
11
  from infrahub.core.protocols import CoreMenuItem
12
- from infrahub.core.schema import GenericSchema, MainSchemaTypes, NodeSchema, ProfileSchema
12
+ from infrahub.core.schema import GenericSchema, MainSchemaTypes, NodeSchema, ProfileSchema, TemplateSchema
13
13
 
14
14
  from .constants import MenuSection
15
15
 
@@ -17,8 +17,8 @@ if TYPE_CHECKING:
17
17
  from infrahub.database import InfrahubDatabase
18
18
 
19
19
 
20
- def get_full_name(obj: CoreMenuItem | NodeSchema | GenericSchema | ProfileSchema) -> str:
21
- if isinstance(obj, (NodeSchema, GenericSchema, ProfileSchema)):
20
+ def get_full_name(obj: CoreMenuItem | NodeSchema | GenericSchema | ProfileSchema | TemplateSchema) -> str:
21
+ if isinstance(obj, NodeSchema | GenericSchema | ProfileSchema | TemplateSchema):
22
22
  return _get_full_name_schema(obj)
23
23
  return _get_full_name_node(obj)
24
24
 
@@ -97,7 +97,7 @@ class MenuItem(BaseModel):
97
97
  )
98
98
 
99
99
  @classmethod
100
- def from_schema(cls, model: NodeSchema | GenericSchema | ProfileSchema) -> Self:
100
+ def from_schema(cls, model: NodeSchema | GenericSchema | ProfileSchema | TemplateSchema) -> Self:
101
101
  return cls(
102
102
  identifier=get_full_name(model),
103
103
  label=model.label or model.kind,
@@ -1,6 +1,5 @@
1
1
  from infrahub.message_bus import InfrahubMessage, InfrahubResponse
2
2
 
3
- from .check_artifact_create import CheckArtifactCreate
4
3
  from .check_generator_run import CheckGeneratorRun
5
4
  from .check_repository_checkdefinition import CheckRepositoryCheckDefinition
6
5
  from .check_repository_mergeconflicts import CheckRepositoryMergeConflicts
@@ -19,7 +18,6 @@ from .proposed_change.request_proposedchange_refreshartifacts import RequestProp
19
18
  from .refresh_git_fetch import RefreshGitFetch
20
19
  from .refresh_registry_branches import RefreshRegistryBranches
21
20
  from .refresh_registry_rebasedbranch import RefreshRegistryRebasedBranch
22
- from .request_artifactdefinition_check import RequestArtifactDefinitionCheck
23
21
  from .request_generatordefinition_check import RequestGeneratorDefinitionCheck
24
22
  from .request_proposedchange_pipeline import RequestProposedChangePipeline
25
23
  from .request_repository_checks import RequestRepositoryChecks
@@ -27,7 +25,6 @@ from .request_repository_userchecks import RequestRepositoryUserChecks
27
25
  from .send_echo_request import SendEchoRequest, SendEchoRequestResponse
28
26
 
29
27
  MESSAGE_MAP: dict[str, type[InfrahubMessage]] = {
30
- "check.artifact.create": CheckArtifactCreate,
31
28
  "check.generator.run": CheckGeneratorRun,
32
29
  "check.repository.check_definition": CheckRepositoryCheckDefinition,
33
30
  "check.repository.merge_conflicts": CheckRepositoryMergeConflicts,
@@ -45,7 +42,6 @@ MESSAGE_MAP: dict[str, type[InfrahubMessage]] = {
45
42
  "refresh.git.fetch": RefreshGitFetch,
46
43
  "refresh.registry.branches": RefreshRegistryBranches,
47
44
  "refresh.registry.rebased_branch": RefreshRegistryRebasedBranch,
48
- "request.artifact_definition.check": RequestArtifactDefinitionCheck,
49
45
  "request.generator_definition.check": RequestGeneratorDefinitionCheck,
50
46
  "request.proposed_change.pipeline": RequestProposedChangePipeline,
51
47
  "request.proposed_change.refresh_artifacts": RequestProposedChangeRefreshArtifacts,
@@ -1,5 +1,6 @@
1
1
  from pydantic import Field
2
2
 
3
+ from infrahub.context import InfrahubContext
3
4
  from infrahub.message_bus import InfrahubMessage
4
5
 
5
6
 
@@ -8,3 +9,5 @@ class EventBranchMerge(InfrahubMessage):
8
9
 
9
10
  source_branch: str = Field(..., description="The source branch")
10
11
  target_branch: str = Field(..., description="The target branch")
12
+
13
+ context: InfrahubContext = Field(..., description="The context of the event")
@@ -1,5 +1,6 @@
1
1
  from pydantic import Field
2
2
 
3
+ from infrahub.context import InfrahubContext
3
4
  from infrahub.core.constants import CheckType
4
5
  from infrahub.message_bus import InfrahubMessage
5
6
 
@@ -14,3 +15,4 @@ class RequestProposedChangePipeline(InfrahubMessage):
14
15
  check_type: CheckType = Field(
15
16
  default=CheckType.ALL, description="Can be used to restrict the pipeline to a specific type of job"
16
17
  )
18
+ context: InfrahubContext = Field(..., description="The context of the task")
@@ -18,7 +18,6 @@ from infrahub.services import InfrahubServices
18
18
  from infrahub.tasks.check import set_check_status
19
19
 
20
20
  COMMAND_MAP = {
21
- "check.artifact.create": check.artifact.create,
22
21
  "check.generator.run": check.generator.run,
23
22
  "check.repository.check_definition": check.repository.check_definition,
24
23
  "check.repository.merge_conflicts": check.repository.merge_conflicts,
@@ -34,7 +33,6 @@ COMMAND_MAP = {
34
33
  "refresh.registry.branches": refresh.registry.branches,
35
34
  "refresh.registry.rebased_branch": refresh.registry.rebased_branch,
36
35
  "request.generator_definition.check": requests.generator_definition.check,
37
- "request.artifact_definition.check": requests.artifact_definition.check,
38
36
  "request.proposed_change.pipeline": requests.proposed_change.pipeline,
39
37
  "request.proposed_change.refresh_artifacts": requests.proposed_change.refresh_artifacts,
40
38
  "request.repository.checks": requests.repository.checks,
@@ -54,15 +52,15 @@ async def execute_message(
54
52
  if skip_flow and isinstance(func, Flow):
55
53
  func = func.fn
56
54
  await func(message=message, service=service)
57
- except Exception as exc: # pylint: disable=broad-except
55
+ except Exception as exc:
58
56
  if message.reply_requested:
59
57
  response = RPCErrorResponse(errors=[str(exc)], initial_message=message.model_dump())
60
- await service.reply(message=response, initiator=message)
58
+ await service.message_bus.reply_if_initiator_meta(message=response, initiator=message)
61
59
  return None
62
60
  if message.reached_max_retries:
63
61
  service.log.exception("Message failed after maximum number of retries", error=exc)
64
62
  await set_check_status(message, conclusion="failure", service=service)
65
63
  return None
66
64
  message.increase_retry_count()
67
- await service.send(message, delay=MessageTTL.FIVE, is_retry=True)
65
+ await service.message_bus.send(message, delay=MessageTTL.FIVE, is_retry=True)
68
66
  return MessageTTL.FIVE
@@ -1,3 +1,3 @@
1
- from . import artifact, generator, repository
1
+ from . import generator, repository
2
2
 
3
- __all__ = ["artifact", "generator", "repository"]
3
+ __all__ = ["generator", "repository"]
@@ -14,8 +14,6 @@ from infrahub.services import InfrahubServices
14
14
  from infrahub.tasks.check import set_check_status
15
15
  from infrahub.workflows.utils import add_tags
16
16
 
17
- # pylint: disable=duplicate-code
18
-
19
17
 
20
18
  @flow(
21
19
  name="git-repository-check-generator-run",
@@ -81,7 +79,7 @@ async def run(message: messages.CheckGeneratorRun, service: InfrahubServices) ->
81
79
  generator_instance.status.value = GeneratorInstanceStatus.ERROR.value
82
80
  check_message = f"Failed to import generator: {exc.message}"
83
81
  log.exception(check_message, exc_info=exc)
84
- except Exception as exc: # pylint: disable=broad-exception-caught
82
+ except Exception as exc:
85
83
  conclusion = ValidatorConclusion.FAILURE
86
84
  generator_instance.status.value = GeneratorInstanceStatus.ERROR.value
87
85
  check_message = f"Failed to execute generator: {str(exc)}"
@@ -132,7 +132,7 @@ async def check_definition(message: messages.CheckRepositoryCheckDefinition, ser
132
132
 
133
133
  for event in events:
134
134
  event.assign_meta(parent=message)
135
- await service.send(message=event)
135
+ await service.message_bus.send(message=event)
136
136
 
137
137
 
138
138
  @flow(
@@ -1,3 +1,5 @@
1
+ from __future__ import annotations
2
+
1
3
  from prefect import flow
2
4
 
3
5
  from infrahub.core import registry
@@ -7,7 +9,7 @@ from infrahub.core.diff.repository.repository import DiffRepository
7
9
  from infrahub.dependencies.registry import get_component_registry
8
10
  from infrahub.log import get_logger
9
11
  from infrahub.message_bus import InfrahubMessage, messages
10
- from infrahub.services import InfrahubServices
12
+ from infrahub.services import InfrahubServices # noqa: TC001 needed for prefect flow
11
13
  from infrahub.workflows.catalogue import (
12
14
  DIFF_UPDATE,
13
15
  TRIGGER_ARTIFACT_DEFINITION_GENERATE,
@@ -33,11 +35,13 @@ async def merge(message: messages.EventBranchMerge, service: InfrahubServices) -
33
35
 
34
36
  await service.workflow.submit_workflow(
35
37
  workflow=TRIGGER_ARTIFACT_DEFINITION_GENERATE,
38
+ context=message.context,
36
39
  parameters={"branch": message.target_branch},
37
40
  )
38
41
 
39
42
  await service.workflow.submit_workflow(
40
43
  workflow=TRIGGER_GENERATOR_DEFINITION_RUN,
44
+ context=message.context,
41
45
  parameters={"branch": message.target_branch},
42
46
  )
43
47
 
@@ -49,9 +53,9 @@ async def merge(message: messages.EventBranchMerge, service: InfrahubServices) -
49
53
  ):
50
54
  request_diff_update_model = RequestDiffUpdate(branch_name=diff_root.diff_branch_name)
51
55
  await service.workflow.submit_workflow(
52
- workflow=DIFF_UPDATE, parameters={"model": request_diff_update_model}
56
+ workflow=DIFF_UPDATE, context=message.context, parameters={"model": request_diff_update_model}
53
57
  )
54
58
 
55
59
  for event in events:
56
60
  event.assign_meta(parent=message)
57
- await service.send(message=event)
61
+ await service.message_bus.send(message=event)
@@ -14,4 +14,4 @@ async def update(message: messages.EventSchemaUpdate, service: InfrahubServices)
14
14
  msg = messages.RefreshRegistryBranches()
15
15
 
16
16
  msg.assign_meta(parent=message)
17
- await service.send(message=msg)
17
+ await service.message_bus.send(message=msg)
@@ -67,7 +67,7 @@ async def execution(message: messages.FinalizeValidatorExecution, service: Infra
67
67
  validator_id=message.validator_id,
68
68
  validator_execution_id=message.validator_execution_id,
69
69
  )
70
- await service.send(message=message, delay=MessageTTL.FIVE)
70
+ await service.message_bus.send(message=message, delay=MessageTTL.FIVE)
71
71
  return
72
72
 
73
73
  log.info(
@@ -27,8 +27,8 @@ async def get(message: messages.GitFileGet, service: InfrahubServices) -> None:
27
27
  except (FileOutOfRepositoryError, RepositoryFileNotFoundError) as e:
28
28
  if message.reply_requested:
29
29
  response = GitFileGetResponse(data=GitFileGetResponseData(error_message=e.message, http_code=e.HTTP_CODE))
30
- await service.reply(message=response, initiator=message)
30
+ await service.message_bus.reply_if_initiator_meta(message=response, initiator=message)
31
31
  else:
32
32
  if message.reply_requested:
33
33
  response = GitFileGetResponse(data=GitFileGetResponseData(content=content))
34
- await service.reply(message=response, initiator=message)
34
+ await service.message_bus.reply_if_initiator_meta(message=response, initiator=message)