Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check Provider is Registered with Subscription Before Making Requests #18

Merged
merged 8 commits into from
May 7, 2021
Prev Previous commit
Next Next commit
Disable pylint and rename
  • Loading branch information
jonathan-innis committed Apr 1, 2021
commit 6c10657a1f2478d2262780f543d5c8a73129d1dc
3 changes: 2 additions & 1 deletion src/k8s-extension/azext_k8s_extension/_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
logger = get_logger(__name__)


def check_cc_registration(cmd):
# pylint: disable=broad-except
def _validate_cc_registration(cmd):
try:
rp_client = _resource_providers_client(cmd.cli_ctx)
registration_state = rp_client.get(consts.PROVIDER_NAMESPACE).registration_state
Expand Down
4 changes: 2 additions & 2 deletions src/k8s-extension/azext_k8s_extension/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from azext_k8s_extension.vendored_sdks.models import ConfigurationIdentity
from azext_k8s_extension.vendored_sdks.models import ErrorResponseException
from azext_k8s_extension.vendored_sdks.models import Scope
from azext_k8s_extension._validators import check_cc_registration
from azext_k8s_extension._validators import _validate_cc_registration

from azext_k8s_extension.partner_extensions.ContainerInsights import ContainerInsights
from azext_k8s_extension.partner_extensions.AzureDefender import AzureDefender
Expand Down Expand Up @@ -134,7 +134,7 @@ def create_k8s_extension(cmd, client, resource_group_name, cluster_name, name, c
__validate_scope_after_customization(extension_instance.scope)

# Check that registration has been done on Microsoft.KubernetesConfiguration for the subscription
check_cc_registration(cmd)
_validate_cc_registration(cmd)

# Create identity, if required
if create_identity:
Expand Down