Skip to content

Commit

Permalink
registry movement
Browse files Browse the repository at this point in the history
  • Loading branch information
vilit1 committed Oct 8, 2024
1 parent 71bdc00 commit 1057dbb
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 7 deletions.
3 changes: 3 additions & 0 deletions azext_edge/edge/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -1205,6 +1205,9 @@ def load_iotops_help():
If the indicated storage account container does not exist it will be created with default
settings.
If the required Resource Providers for IoT Operations are not registered, this will
register them.
examples:
- name: Create a schema registry called 'myregistry' with minimum inputs.
text: >
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from knack.log import get_logger
from rich.console import Console


from ....util.az_client import (
get_registry_mgmt_client,
get_storage_mgmt_client,
Expand Down Expand Up @@ -66,7 +67,11 @@ def create(
custom_role_id: Optional[str] = None,
**kwargs,
) -> dict:
from ..rp_namespace import register_providers
with console.status("Working...") as c:
# Register providers - may as well do all for AIO
register_providers(self.default_subscription_id)

if not location:
location = self.get_resource_group(name=resource_group_name)["location"]

Expand Down
6 changes: 6 additions & 0 deletions azext_edge/tests/edge/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ def mocked_urlopen(mocker):
yield patched


@pytest.fixture
def mocked_register_providers(mocker):
patched = mocker.patch("azext_edge.edge.providers.orchestration.rp_namespace.register_providers", autospec=True)
yield patched


@pytest.fixture
def mocked_resource_management_client(request, mocker):
request_results = getattr(request, "param", {})
Expand Down
6 changes: 0 additions & 6 deletions azext_edge/tests/edge/init/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,6 @@ def mocked_verify_cli_client_connections(mocker):
yield patched


@pytest.fixture
def mocked_register_providers(mocker):
patched = mocker.patch("azext_edge.edge.providers.orchestration.rp_namespace.register_providers", autospec=True)
yield patched


@pytest.fixture
def mocked_edge_api_keyvault_api_v1(mocker):
patched = mocker.patch("azext_edge.edge.providers.edge_api.keyvault.KEYVAULT_API_V1", autospec=False)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,9 @@ def test_schema_registry_delete(mocked_cmd, mocked_responses: responses):
)
def test_schema_registry_create(
mocked_cmd,
mocked_responses: responses,
mocker,
mocked_register_providers,
mocked_responses: responses,
location: Optional[str],
display_name: Optional[str],
description: Optional[str],
Expand Down Expand Up @@ -343,6 +344,7 @@ def test_schema_registry_create(
== f"{mock_storage_record['properties']['primaryEndpoints']['blob']}{storage_container_name}"
)

mocked_register_providers.assert_called_with(ZEROED_SUBSCRIPTION)
mock_permission_manager.assert_called_with(ZEROED_SUBSCRIPTION)
target_role_id = custom_role_id or ROLE_DEF_FORMAT_STR.format(
subscription_id=ZEROED_SUBSCRIPTION, role_id=STORAGE_BLOB_DATA_CONTRIBUTOR_ROLE_ID
Expand Down

0 comments on commit 1057dbb

Please sign in to comment.