mrok 0.1.8__tar.gz → 0.1.9__tar.gz

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 (118) hide show
  1. {mrok-0.1.8 → mrok-0.1.9}/.github/workflows/pr-build-merge.yaml +2 -2
  2. {mrok-0.1.8 → mrok-0.1.9}/PKG-INFO +1 -1
  3. {mrok-0.1.8 → mrok-0.1.9}/mrok/ziti/api.py +3 -0
  4. {mrok-0.1.8 → mrok-0.1.9}/mrok/ziti/bootstrap.py +9 -4
  5. {mrok-0.1.8 → mrok-0.1.9}/pyproject.toml +1 -1
  6. {mrok-0.1.8 → mrok-0.1.9}/tests/ziti/test_api.py +1 -0
  7. {mrok-0.1.8 → mrok-0.1.9}/tests/ziti/test_bootstrap.py +40 -0
  8. {mrok-0.1.8 → mrok-0.1.9}/.github/actions/setup-python-env/action.yml +0 -0
  9. {mrok-0.1.8 → mrok-0.1.9}/.github/workflows/assets/turing_team_pr_bot.png +0 -0
  10. {mrok-0.1.8 → mrok-0.1.9}/.github/workflows/notify-pr-closed.yaml +0 -0
  11. {mrok-0.1.8 → mrok-0.1.9}/.github/workflows/notify-pr-reviewed.yml +0 -0
  12. {mrok-0.1.8 → mrok-0.1.9}/.github/workflows/release.yml +0 -0
  13. {mrok-0.1.8 → mrok-0.1.9}/.gitignore +0 -0
  14. {mrok-0.1.8 → mrok-0.1.9}/.pre-commit-config.yaml +0 -0
  15. {mrok-0.1.8 → mrok-0.1.9}/.python-version +0 -0
  16. {mrok-0.1.8 → mrok-0.1.9}/LICENSE.txt +0 -0
  17. {mrok-0.1.8 → mrok-0.1.9}/README.md +0 -0
  18. {mrok-0.1.8 → mrok-0.1.9}/dev.Dockerfile +0 -0
  19. {mrok-0.1.8 → mrok-0.1.9}/docker-compose.yaml +0 -0
  20. {mrok-0.1.8 → mrok-0.1.9}/entrypoint.sh +0 -0
  21. {mrok-0.1.8 → mrok-0.1.9}/mrok/__init__.py +0 -0
  22. {mrok-0.1.8 → mrok-0.1.9}/mrok/agent/__init__.py +0 -0
  23. {mrok-0.1.8 → mrok-0.1.9}/mrok/agent/sidecar/__init__.py +0 -0
  24. {mrok-0.1.8 → mrok-0.1.9}/mrok/agent/sidecar/app.py +0 -0
  25. {mrok-0.1.8 → mrok-0.1.9}/mrok/agent/sidecar/main.py +0 -0
  26. {mrok-0.1.8 → mrok-0.1.9}/mrok/agent/ziticorn.py +0 -0
  27. {mrok-0.1.8 → mrok-0.1.9}/mrok/cli/__init__.py +0 -0
  28. {mrok-0.1.8 → mrok-0.1.9}/mrok/cli/commands/__init__.py +0 -0
  29. {mrok-0.1.8 → mrok-0.1.9}/mrok/cli/commands/admin/__init__.py +0 -0
  30. {mrok-0.1.8 → mrok-0.1.9}/mrok/cli/commands/admin/bootstrap.py +0 -0
  31. {mrok-0.1.8 → mrok-0.1.9}/mrok/cli/commands/admin/list/__init__.py +0 -0
  32. {mrok-0.1.8 → mrok-0.1.9}/mrok/cli/commands/admin/list/extensions.py +0 -0
  33. {mrok-0.1.8 → mrok-0.1.9}/mrok/cli/commands/admin/list/instances.py +0 -0
  34. {mrok-0.1.8 → mrok-0.1.9}/mrok/cli/commands/admin/register/__init__.py +0 -0
  35. {mrok-0.1.8 → mrok-0.1.9}/mrok/cli/commands/admin/register/extensions.py +0 -0
  36. {mrok-0.1.8 → mrok-0.1.9}/mrok/cli/commands/admin/register/instances.py +0 -0
  37. {mrok-0.1.8 → mrok-0.1.9}/mrok/cli/commands/admin/unregister/__init__.py +0 -0
  38. {mrok-0.1.8 → mrok-0.1.9}/mrok/cli/commands/admin/unregister/extensions.py +0 -0
  39. {mrok-0.1.8 → mrok-0.1.9}/mrok/cli/commands/admin/unregister/instances.py +0 -0
  40. {mrok-0.1.8 → mrok-0.1.9}/mrok/cli/commands/admin/utils.py +0 -0
  41. {mrok-0.1.8 → mrok-0.1.9}/mrok/cli/commands/agent/__init__.py +0 -0
  42. {mrok-0.1.8 → mrok-0.1.9}/mrok/cli/commands/agent/run/__init__.py +0 -0
  43. {mrok-0.1.8 → mrok-0.1.9}/mrok/cli/commands/agent/run/asgi.py +0 -0
  44. {mrok-0.1.8 → mrok-0.1.9}/mrok/cli/commands/agent/run/sidecar.py +0 -0
  45. {mrok-0.1.8 → mrok-0.1.9}/mrok/cli/commands/controller/__init__.py +0 -0
  46. {mrok-0.1.8 → mrok-0.1.9}/mrok/cli/commands/controller/openapi.py +0 -0
  47. {mrok-0.1.8 → mrok-0.1.9}/mrok/cli/commands/controller/run.py +0 -0
  48. {mrok-0.1.8 → mrok-0.1.9}/mrok/cli/main.py +0 -0
  49. {mrok-0.1.8 → mrok-0.1.9}/mrok/cli/rich.py +0 -0
  50. {mrok-0.1.8 → mrok-0.1.9}/mrok/conf.py +0 -0
  51. {mrok-0.1.8 → mrok-0.1.9}/mrok/controller/__init__.py +0 -0
  52. {mrok-0.1.8 → mrok-0.1.9}/mrok/controller/app.py +0 -0
  53. {mrok-0.1.8 → mrok-0.1.9}/mrok/controller/auth.py +0 -0
  54. {mrok-0.1.8 → mrok-0.1.9}/mrok/controller/dependencies/__init__.py +0 -0
  55. {mrok-0.1.8 → mrok-0.1.9}/mrok/controller/dependencies/conf.py +0 -0
  56. {mrok-0.1.8 → mrok-0.1.9}/mrok/controller/dependencies/ziti.py +0 -0
  57. {mrok-0.1.8 → mrok-0.1.9}/mrok/controller/openapi/__init__.py +0 -0
  58. {mrok-0.1.8 → mrok-0.1.9}/mrok/controller/openapi/examples.py +0 -0
  59. {mrok-0.1.8 → mrok-0.1.9}/mrok/controller/openapi/utils.py +0 -0
  60. {mrok-0.1.8 → mrok-0.1.9}/mrok/controller/pagination.py +0 -0
  61. {mrok-0.1.8 → mrok-0.1.9}/mrok/controller/routes.py +0 -0
  62. {mrok-0.1.8 → mrok-0.1.9}/mrok/controller/schemas.py +0 -0
  63. {mrok-0.1.8 → mrok-0.1.9}/mrok/errors.py +0 -0
  64. {mrok-0.1.8 → mrok-0.1.9}/mrok/http/__init__.py +0 -0
  65. {mrok-0.1.8 → mrok-0.1.9}/mrok/http/config.py +0 -0
  66. {mrok-0.1.8 → mrok-0.1.9}/mrok/http/forwarder.py +0 -0
  67. {mrok-0.1.8 → mrok-0.1.9}/mrok/http/lifespan.py +0 -0
  68. {mrok-0.1.8 → mrok-0.1.9}/mrok/http/master.py +0 -0
  69. {mrok-0.1.8 → mrok-0.1.9}/mrok/http/protocol.py +0 -0
  70. {mrok-0.1.8 → mrok-0.1.9}/mrok/http/server.py +0 -0
  71. {mrok-0.1.8 → mrok-0.1.9}/mrok/logging.py +0 -0
  72. {mrok-0.1.8 → mrok-0.1.9}/mrok/ziti/__init__.py +0 -0
  73. {mrok-0.1.8 → mrok-0.1.9}/mrok/ziti/constants.py +0 -0
  74. {mrok-0.1.8 → mrok-0.1.9}/mrok/ziti/errors.py +0 -0
  75. {mrok-0.1.8 → mrok-0.1.9}/mrok/ziti/identities.py +0 -0
  76. {mrok-0.1.8 → mrok-0.1.9}/mrok/ziti/pki.py +0 -0
  77. {mrok-0.1.8 → mrok-0.1.9}/mrok/ziti/services.py +0 -0
  78. {mrok-0.1.8 → mrok-0.1.9}/prod.Dockerfile +0 -0
  79. {mrok-0.1.8 → mrok-0.1.9}/scripts/ziti.sh +0 -0
  80. {mrok-0.1.8 → mrok-0.1.9}/settings.yaml +0 -0
  81. {mrok-0.1.8 → mrok-0.1.9}/sonar-project.properties +0 -0
  82. {mrok-0.1.8 → mrok-0.1.9}/tests/__init__.py +0 -0
  83. {mrok-0.1.8 → mrok-0.1.9}/tests/agent/__init__.py +0 -0
  84. {mrok-0.1.8 → mrok-0.1.9}/tests/agent/sidecar/__init__.py +0 -0
  85. {mrok-0.1.8 → mrok-0.1.9}/tests/agent/sidecar/test_app.py +0 -0
  86. {mrok-0.1.8 → mrok-0.1.9}/tests/agent/sidecar/test_main.py +0 -0
  87. {mrok-0.1.8 → mrok-0.1.9}/tests/agent/test_ziticorn.py +0 -0
  88. {mrok-0.1.8 → mrok-0.1.9}/tests/cli/__init__.py +0 -0
  89. {mrok-0.1.8 → mrok-0.1.9}/tests/cli/admin/__init__.py +0 -0
  90. {mrok-0.1.8 → mrok-0.1.9}/tests/cli/admin/test_bootstrap.py +0 -0
  91. {mrok-0.1.8 → mrok-0.1.9}/tests/cli/admin/test_list.py +0 -0
  92. {mrok-0.1.8 → mrok-0.1.9}/tests/cli/admin/test_register.py +0 -0
  93. {mrok-0.1.8 → mrok-0.1.9}/tests/cli/admin/test_unregister.py +0 -0
  94. {mrok-0.1.8 → mrok-0.1.9}/tests/cli/admin/test_utils.py +0 -0
  95. {mrok-0.1.8 → mrok-0.1.9}/tests/cli/agent/__init__.py +0 -0
  96. {mrok-0.1.8 → mrok-0.1.9}/tests/cli/agent/test_run.py +0 -0
  97. {mrok-0.1.8 → mrok-0.1.9}/tests/cli/controller/__init__.py +0 -0
  98. {mrok-0.1.8 → mrok-0.1.9}/tests/cli/controller/test_openapi.py +0 -0
  99. {mrok-0.1.8 → mrok-0.1.9}/tests/cli/controller/test_run.py +0 -0
  100. {mrok-0.1.8 → mrok-0.1.9}/tests/cli/test_main.py +0 -0
  101. {mrok-0.1.8 → mrok-0.1.9}/tests/conftest.py +0 -0
  102. {mrok-0.1.8 → mrok-0.1.9}/tests/controller/__init__.py +0 -0
  103. {mrok-0.1.8 → mrok-0.1.9}/tests/controller/test_auth.py +0 -0
  104. {mrok-0.1.8 → mrok-0.1.9}/tests/controller/test_extensions.py +0 -0
  105. {mrok-0.1.8 → mrok-0.1.9}/tests/controller/test_instances.py +0 -0
  106. {mrok-0.1.8 → mrok-0.1.9}/tests/controller/test_openapi.py +0 -0
  107. {mrok-0.1.8 → mrok-0.1.9}/tests/http/__init__.py +0 -0
  108. {mrok-0.1.8 → mrok-0.1.9}/tests/http/test_config.py +0 -0
  109. {mrok-0.1.8 → mrok-0.1.9}/tests/http/test_forwarder.py +0 -0
  110. {mrok-0.1.8 → mrok-0.1.9}/tests/http/test_lifespan.py +0 -0
  111. {mrok-0.1.8 → mrok-0.1.9}/tests/http/test_master.py +0 -0
  112. {mrok-0.1.8 → mrok-0.1.9}/tests/http/test_protocol.py +0 -0
  113. {mrok-0.1.8 → mrok-0.1.9}/tests/http/test_server.py +0 -0
  114. {mrok-0.1.8 → mrok-0.1.9}/tests/ziti/__init__.py +0 -0
  115. {mrok-0.1.8 → mrok-0.1.9}/tests/ziti/test_identities.py +0 -0
  116. {mrok-0.1.8 → mrok-0.1.9}/tests/ziti/test_pki.py +0 -0
  117. {mrok-0.1.8 → mrok-0.1.9}/tests/ziti/test_services.py +0 -0
  118. {mrok-0.1.8 → mrok-0.1.9}/uv.lock +0 -0
@@ -38,7 +38,7 @@ jobs:
38
38
  with:
39
39
  python-version: ${{ matrix.python-version }}
40
40
 
41
- - name: Install the project dependancies
41
+ - name: Install the project dependencies
42
42
  run: uv sync --all-extras --dev
43
43
 
44
44
  - name: Run formatting checks
@@ -77,7 +77,7 @@ jobs:
77
77
  with:
78
78
  python-version-file: ".python-version"
79
79
 
80
- - name: Install the project dependancies
80
+ - name: Install the project dependencies
81
81
  run: uv sync --all-extras --dev
82
82
 
83
83
  - name: Run tests
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mrok
3
- Version: 0.1.8
3
+ Version: 0.1.9
4
4
  Summary: MPT Extensions OpenZiti Orchestrator
5
5
  Author: SoftwareOne AG
6
6
  License: Apache License
@@ -397,6 +397,9 @@ class ZitiManagementAPI(BaseZitiAPI):
397
397
  async def search_config_type(self, id_or_name: str) -> dict[str, Any] | None:
398
398
  return await self.search_by_id_or_name("/config-types", id_or_name)
399
399
 
400
+ async def delete_config_type(self, config_type_id: str) -> dict[str, Any] | None:
401
+ return await self.delete("/config-types", config_type_id)
402
+
400
403
  async def get_identity(self, identity_id: str) -> dict[str, Any]:
401
404
  return await self.get("/identities", identity_id)
402
405
 
@@ -19,19 +19,27 @@ async def bootstrap_identity(
19
19
 
20
20
  identity_json = None
21
21
  existing_identity = await mgmt_api.search_identity(identity_name)
22
+ policy = await mgmt_api.search_router_policy(identity_name)
23
+ config_type_name = f"{mode}.proxy.v1"
24
+ config_type = await mgmt_api.search_config_type(config_type_name)
22
25
 
23
26
  if forced and existing_identity:
24
27
  logger.info(f"Deleting existing identity '{identity_name}' ({existing_identity['id']})")
25
28
 
26
- policy = await mgmt_api.search_router_policy(identity_name)
27
29
  if policy:
28
30
  await mgmt_api.delete_router_policy(policy["id"])
29
31
  logger.info(f"Deleted existing ERP '{policy['name']}' ({policy['id']})")
32
+ policy = None
30
33
 
31
34
  await mgmt_api.delete_identity(existing_identity["id"])
32
35
  logger.info("Deleted existing identity")
33
36
  existing_identity = None
34
37
 
38
+ if forced and config_type:
39
+ await mgmt_api.delete_config_type(config_type["id"])
40
+ logger.info(f"Deleted existing config type '{config_type_name}' ({config_type['id']})")
41
+ config_type = None
42
+
35
43
  if existing_identity:
36
44
  frontend_id = existing_identity["id"]
37
45
  logger.info(f"Identity '{identity_name}' ({frontend_id}) is already enrolled")
@@ -44,7 +52,6 @@ async def bootstrap_identity(
44
52
  )
45
53
  logger.info(f"Identity '{identity_name}' ({frontend_id}) successfully enrolled")
46
54
 
47
- policy = await mgmt_api.search_router_policy(identity_name)
48
55
  if not policy:
49
56
  policy_id = await mgmt_api.create_router_policy(
50
57
  identity_name,
@@ -55,8 +62,6 @@ async def bootstrap_identity(
55
62
  else:
56
63
  logger.info(f"Found ERP '{policy['name']}' ({policy['id']})")
57
64
 
58
- config_type_name = f"{mode}.proxy.v1"
59
- config_type = await mgmt_api.search_config_type(config_type_name)
60
65
  if config_type is None:
61
66
  config_type_id = await mgmt_api.create_config_type(config_type_name, tags=tags)
62
67
  logger.info(f"Created '{config_type_name}' ({config_type_id}) config type")
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "mrok"
3
- version = "0.1.8"
3
+ version = "0.1.9"
4
4
  description = "MPT Extensions OpenZiti Orchestrator"
5
5
  readme = { file = "README.md", content-type = "text/markdown" }
6
6
  authors = [
@@ -236,6 +236,7 @@ async def test_search_methods(
236
236
  ("method_name", "endpoint"),
237
237
  [
238
238
  ("delete_config", "/configs"),
239
+ ("delete_config_type", "/config-types"),
239
240
  ("delete_service_policy", "/service-policies"),
240
241
  ("delete_service_router_policy", "/service-edge-router-policies"),
241
242
  ("delete_router_policy", "/edge-router-policies"),
@@ -140,3 +140,43 @@ async def test_bootstrap_identity_already_bootstrapped(
140
140
 
141
141
  assert identity_id == "identity-id"
142
142
  assert identity_json is None
143
+
144
+
145
+ @pytest.mark.asyncio
146
+ async def test_bootstrap_identity_with_forced_and_config_type(
147
+ mocker: MockerFixture,
148
+ settings_factory: SettingsFactory,
149
+ ):
150
+ settings = settings_factory()
151
+ mocked_mgmt_api = mocker.AsyncMock()
152
+
153
+ mocked_mgmt_api.search_identity.return_value = {"id": "old-proxy-identity-id"}
154
+ mocked_mgmt_api.search_router_policy.side_effect = [
155
+ {"id": "old-router-policy-id", "name": "policy"},
156
+ None,
157
+ ]
158
+ mocked_mgmt_api.search_config_type.return_value = {"id": "old-config-type-id"}
159
+ mocked_mgmt_api.delete_router_policy.return_value = None
160
+ mocked_mgmt_api.delete_identity.return_value = None
161
+ mocked_mgmt_api.delete_config_type.return_value = None
162
+
163
+ mocker.patch(
164
+ "mrok.ziti.bootstrap.enroll_proxy_identity",
165
+ new_callable=mocker.AsyncMock,
166
+ return_value=("new-identity-id", {"id": "key, cert and ca", "ztAPI": "https://ziti.api"}),
167
+ )
168
+
169
+ mocked_mgmt_api.create_router_policy.return_value = "new-policy-id"
170
+ mocked_mgmt_api.create_config_type.return_value = "config-type-id"
171
+
172
+ identity_id, identity_json = await bootstrap_identity(
173
+ mocked_mgmt_api,
174
+ mocker.AsyncMock(),
175
+ settings.proxy.identity,
176
+ settings.proxy.mode,
177
+ True,
178
+ {},
179
+ )
180
+
181
+ assert identity_id == "new-identity-id"
182
+ assert identity_json == {"id": "key, cert and ca", "ztAPI": "https://ziti.api"}
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes