forked from Azure/azure-cli-extensions
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Check Provider is Registered with Subscription Before Making Requests (…
…#18) * Add check for KubernetesConfiguration * Disable pylint and rename * Update provider registration link * Update version * Remove extra blank line * Fix bug in import
- Loading branch information
1 parent
9709504
commit 3f620a8
Showing
6 changed files
with
46 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# -------------------------------------------------------------------------------------------- | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. See License.txt in the project root for license information. | ||
# -------------------------------------------------------------------------------------------- | ||
|
||
from knack.log import get_logger | ||
from azext_k8s_extension._client_factory import _resource_providers_client | ||
from . import consts | ||
|
||
|
||
logger = get_logger(__name__) | ||
|
||
|
||
# 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 | ||
|
||
if registration_state != "Registered": | ||
logger.warning("'Extensions' cannot be used because '%s' provider has not been registered." | ||
"More details for registering this provider can be found here - " | ||
"https://aka.ms/RegisterKubernetesConfigurationProvider", consts.PROVIDER_NAMESPACE) | ||
except Exception: | ||
logger.warning("Unable to fetch registration state of '%s' provider. " | ||
"Failed to enable 'extensions' feature...", consts.PROVIDER_NAMESPACE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters