зеркало из
1
0
Форкнуть 0

Remove mgmt azure-sdk-tools reqs

***NO_CI***
This commit is contained in:
mccoyp 2022-10-17 15:44:28 -07:00 коммит произвёл Wes Haggard
Родитель caadcf06ad
Коммит 5f21d78c6f
40 изменённых файлов: 54 добавлений и 170 удалений

Просмотреть файл

@ -1,3 +1,4 @@
-e ../../../tools/azure-sdk-tools
-e ../../../tools/azure-devtools
-e ../../resources/azure-mgmt-resource
../../identity/azure-identity

Просмотреть файл

@ -1,3 +1,4 @@
-e ../../../tools/azure-devtools
-e ../../../tools/azure-sdk-tools
-e ../../resources/azure-mgmt-resource
azure-identity

Просмотреть файл

@ -1,3 +1,4 @@
-e ../../../tools/azure-sdk-tools
-e ../../../tools/azure-devtools
../../identity/azure-identity
../../identity/azure-identity
azure-mgmt-resource<=21.1.0

Просмотреть файл

@ -1,4 +1,6 @@
-e ../../../tools/azure-sdk-tools
-e ../azure-mgmt-batch
-e ../../identity/azure-identity
-e ../../../tools/azure-devtools
-e ../../../tools/azure-devtools
azure-mgmt-resource<=21.1.0
azure-mgmt-storage<=20.0.0

Просмотреть файл

@ -2,4 +2,6 @@
azure-mgmt-keyvault<9.0.0
azure-mgmt-network<19.0.0
-e ../../../tools/azure-devtools
-e ../../resources/azure-mgmt-resource
-e ../../storage/azure-mgmt-storage
../../identity/azure-identity

Просмотреть файл

@ -1,3 +1,4 @@
-e ../../../tools/azure-sdk-tools
-e ../../../tools/azure-devtools
-e ../../resources/azure-mgmt-resource
../../identity/azure-identity

Просмотреть файл

@ -2,6 +2,7 @@
-e ../../authorization/azure-mgmt-authorization
-e ../../storage/azure-mgmt-storage
-e ../../network/azure-mgmt-network
-e ../../resources/azure-mgmt-resource
aiohttp>=3.0; python_version >= '3.5'
-e ../../../tools/azure-devtools
../../identity/azure-identity

Просмотреть файл

@ -1,3 +1,4 @@
-e ../../../tools/azure-sdk-tools
-e ../../../tools/azure-devtools
-e ../../resources/azure-mgmt-resource
../../identity/azure-identity

Просмотреть файл

@ -1,2 +1,3 @@
-e ../../../tools/azure-sdk-tools
-e ../../../tools/azure-devtools
-e ../../../tools/azure-devtools
-e ../../resources/azure-mgmt-resource

Просмотреть файл

@ -1,2 +1,3 @@
-e ../../../tools/azure-sdk-tools
-e ../../../tools/azure-devtools
-e ../../../tools/azure-devtools
-e ../../resources/azure-mgmt-resource

Просмотреть файл

@ -1,2 +1,3 @@
-e ../../../tools/azure-sdk-tools
-e ../../../tools/azure-devtools
-e ../../../tools/azure-devtools
azure-mgmt-resource<=21.1.0

Просмотреть файл

@ -1,3 +1,4 @@
-e ../../../tools/azure-sdk-tools
-e ../../../tools/azure-devtools
../../identity/azure-identity
../../identity/azure-identity
azure-mgmt-resource<=21.1.0

Просмотреть файл

@ -1,3 +1,4 @@
-e ../../../tools/azure-sdk-tools
-e ../../../tools/azure-devtools
-e ../../resources/azure-mgmt-resource
../../identity/azure-identity

Просмотреть файл

@ -2,6 +2,7 @@
-e ../../../tools/azure-sdk-tools
-e ../../core/azure-core
-e ../../identity/azure-identity
-e ../../resources/azure-mgmt-resource
-e ../azure-mgmt-eventgrid
azure-storage-queue
cloudevents<=2.0.0; python_version >= "3.6"

Просмотреть файл

@ -1,3 +1,4 @@
-e ../../../tools/azure-sdk-tools
-e ../../../tools/azure-devtools
-e ../../resources/azure-mgmt-resource
../../identity/azure-identity

Просмотреть файл

@ -1,2 +1,3 @@
-e ../../../tools/azure-sdk-tools
-e ../../../tools/azure-devtools
-e ../../../tools/azure-devtools
azure-mgmt-resource<=21.1.0

Просмотреть файл

@ -2,6 +2,8 @@
-e ../../core/azure-core
-e ../../keyvault/azure-keyvault-keys
-e ../../keyvault/azure-mgmt-keyvault
-e ../../resources/azure-mgmt-resource
-e ../../storage/azure-mgmt-storage
azure-mgmt-loganalytics==2.0.0
-e ../../resources/azure-mgmt-msi/
-e ../../../tools/azure-devtools

Просмотреть файл

@ -1,3 +1,4 @@
-e ../../../tools/azure-sdk-tools
-e ../../../tools/azure-devtools
-e ../../resources/azure-mgmt-resource
../../identity/azure-identity

Просмотреть файл

@ -1,4 +1,5 @@
aiohttp>=3.0
-e ../../../tools/azure-sdk-tools
-e ../../../tools/azure-devtools
-e ../../resources/azure-mgmt-resource
../../identity/azure-identity

Просмотреть файл

@ -1,4 +1,4 @@
-e ../../../tools/azure-sdk-tools
-e ../../../tools/azure-devtools
-e ../../resources/azure-mgmt-resource
../../identity/azure-identity

Просмотреть файл

@ -1,3 +1,4 @@
-e ../../../tools/azure-sdk-tools
-e ../../../tools/azure-devtools
-e ../../resources/azure-mgmt-resource
../../identity/azure-identity

Просмотреть файл

@ -1,2 +1,3 @@
-e ../../../tools/azure-sdk-tools
-e ../../../tools/azure-devtools
-e ../../../tools/azure-devtools
-e ../../resources/azure-mgmt-resource

Просмотреть файл

@ -1,3 +1,4 @@
-e ../../../tools/azure-sdk-tools
-e ../../../tools/azure-devtools
-e ../../resources/azure-mgmt-resource
../../identity/azure-identity

Просмотреть файл

@ -1,3 +1,4 @@
-e ../../../tools/azure-sdk-tools
-e ../../storage/azure-mgmt-storage
-e ../../../tools/azure-devtools
-e ../../../tools/azure-devtools
-e ../../resources/azure-mgmt-resource

Просмотреть файл

@ -1,4 +1,5 @@
-e ../../../tools/azure-sdk-tools
-e ../azure-mgmt-network
-e ../../../tools/azure-devtools
../../identity/azure-identity
../../identity/azure-identity
azure-mgmt-resource<=21.1.0

Просмотреть файл

@ -1,6 +1,7 @@
-e ../../../tools/azure-sdk-tools
aiohttp>=3.0; python_version >= '3.5'
-e ../../../tools/azure-devtools
-e ../../resources/azure-mgmt-resource
../../identity/azure-identity
azure-mgmt-compute==26.1.0
azure-mgmt-storage==20.0.0

Просмотреть файл

@ -1,3 +1,4 @@
-e ../../../tools/azure-sdk-tools
-e ../../../tools/azure-devtools
-e ../../resources/azure-mgmt-resource
../../identity/azure-identity

Просмотреть файл

@ -1,3 +1,4 @@
-e ../../../tools/azure-sdk-tools
-e ../../../tools/azure-devtools
-e ../../resources/azure-mgmt-resource
../../identity/azure-identity

Просмотреть файл

@ -1,3 +1,4 @@
-e ../../../tools/azure-sdk-tools
-e ../../../tools/azure-devtools
-e ../../resources/azure-mgmt-resource
../../identity/azure-identity

Просмотреть файл

@ -2,3 +2,4 @@
-e ../../../tools/azure-sdk-tools
../../nspkg/azure-search-nspkg
aiohttp>=3.0
azure-mgmt-resource<=21.1.0

Просмотреть файл

@ -1,3 +1,4 @@
-e ../../../tools/azure-sdk-tools
-e ../../../tools/azure-devtools
-e ../../resources/azure-mgmt-resource
../../identity/azure-identity

Просмотреть файл

@ -3,4 +3,5 @@
-e ../../../tools/azure-devtools
-e ../../../tools/azure-sdk-tools
azure-mgmt-servicebus~=1.0.0
aiohttp>=3.0
aiohttp>=3.0
azure-mgmt-resource<=16.0.0

Просмотреть файл

@ -1,3 +1,4 @@
-e ../../../tools/azure-sdk-tools
-e ../../../tools/azure-devtools
-e ../../resources/azure-mgmt-resource
../../identity/azure-identity

Просмотреть файл

@ -1,6 +1,8 @@
-e ../../../tools/vcrpy
-e ../../../tools/azure-devtools
-e ../../../tools/azure-sdk-tools
-e ../../resources/azure-mgmt-resource
-e ../azure-mgmt-storage
../../core/azure-core
azure-identity
aiohttp>=3.0

Просмотреть файл

@ -1,6 +1,7 @@
-e ../../../tools/azure-devtools
-e ../../../tools/azure-sdk-tools
-e ../../cosmos/azure-mgmt-cosmosdb
-e ../../resources/azure-mgmt-resource
../../core/azure-core
../../nspkg/azure-data-nspkg
aiohttp>=3.0

Просмотреть файл

@ -13,7 +13,6 @@
* [`FakeStorageAccount`][fake_storage_account]:
* [`StorageAccountPreparer`][storage_account_preparer]:
* [`CachedStorageAccountPreparer`][cached_storage_account_preparer]:
* [`KeyVaultPreparer`][kv_preparer]:
* [`EnvironmentVariableLoader`][env_loader]: Abstract preparer for delivering secrets from environment variables to individual tests
* [`RetryCounter`][retry_counter]: Object for counting retries on a request.
* [`ResponseCallback`][response_callback]: Object for mocking response callbacks.
@ -41,7 +40,6 @@ the `azure-sdk-for-python`'s use of CredScan, please refer to the [CredScan moni
[fake_storage_account]: https://github.com/Azure/azure-sdk-for-python/blob/master/tools/azure-sdk-tools/devtools_testutils/storage_testcase.py#L25
[storage_account_preparer]: https://github.com/Azure/azure-sdk-for-python/blob/520ea7175e10a971eae9d3e6cd0735efd80447b1/tools/azure-sdk-tools/devtools_testutils/storage_testcase.py#L29
[cached_storage_account_preparer]: https://github.com/Azure/azure-sdk-for-python/blob/master/tools/azure-sdk-tools/devtools_testutils/storage_testcase.py#L140
[kv_preparer]: https://github.com/Azure/azure-sdk-for-python/blob/520ea7175e10a971eae9d3e6cd0735efd80447b1/tools/azure-sdk-tools/devtools_testutils/keyvault_preparer.py#L49
[env_loader]: https://github.com/Azure/azure-sdk-for-python/blob/main/tools/azure-sdk-tools/devtools_testutils/envvariable_loader.py#L15
[retry_counter]: https://github.com/Azure/azure-sdk-for-python/blob/ab7e7f1a7b2a6d7255abdc77a40e2d6a86c9de0a/tools/azure-sdk-tools/devtools_testutils/helpers.py#L6
[response_callback]: https://github.com/Azure/azure-sdk-for-python/blob/ab7e7f1a7b2a6d7255abdc77a40e2d6a86c9de0a/tools/azure-sdk-tools/devtools_testutils/helpers.py#L14

Просмотреть файл

@ -14,7 +14,6 @@ from .storage_testcase import (
BlobAccountPreparer,
CachedStorageAccountPreparer,
)
from .keyvault_preparer import KeyVaultPreparer
# cSpell:disable
from .envvariable_loader import EnvironmentVariableLoader
@ -85,7 +84,6 @@ __all__ = [
"AzureTestCase",
"is_live",
"get_region_override",
"KeyVaultPreparer",
"RandomNameResourceGroupPreparer",
"CachedResourceGroupPreparer",
"PemCertificate",

Просмотреть файл

@ -1,149 +0,0 @@
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
import time
import random
from string import ascii_letters
from azure.mgmt.keyvault import KeyVaultManagementClient
from azure.mgmt.keyvault.models import (
SecretPermissions,
KeyPermissions,
CertificatePermissions,
StoragePermissions,
Permissions,
Sku,
SkuName,
AccessPolicyEntry,
VaultProperties,
VaultCreateOrUpdateParameters,
)
try:
from azure.mgmt.keyvault.models import SkuFamily
except ImportError:
pass
from azure_devtools.scenario_tests.exceptions import (
AzureTestError,
NameInUseError,
ReservedResourceNameError,
)
from . import AzureMgmtPreparer, ResourceGroupPreparer
from .resource_testcase import RESOURCE_GROUP_PARAM
DEFAULT_PERMISSIONS = Permissions(
keys=[perm.value for perm in KeyPermissions],
secrets=[perm.value for perm in SecretPermissions],
certificates=[perm.value for perm in CertificatePermissions],
storage=[perm.value for perm in StoragePermissions],
)
DEFAULT_SKU = SkuName.premium.value
CLIENT_OID = "00000000-0000-0000-0000-000000000000"
class KeyVaultPreparer(AzureMgmtPreparer):
def __init__(
self,
name_prefix=random.choice(ascii_letters).lower(),
sku=DEFAULT_SKU,
permissions=DEFAULT_PERMISSIONS,
enabled_for_deployment=True,
enabled_for_disk_encryption=True,
enabled_for_template_deployment=True,
enable_soft_delete=None,
location="westus",
parameter_name="vault_uri",
resource_group_parameter_name=RESOURCE_GROUP_PARAM,
disable_recording=True,
playback_fake_resource=None,
client_kwargs=None,
random_name_enabled=True,
):
super(KeyVaultPreparer, self).__init__(
name_prefix,
24,
disable_recording=disable_recording,
playback_fake_resource=playback_fake_resource,
client_kwargs=client_kwargs,
random_name_enabled=random_name_enabled,
)
self.location = location
self.sku = sku
self.permissions = permissions
self.enabled_for_deployment = enabled_for_deployment
self.enabled_for_disk_encryption = enabled_for_disk_encryption
self.enabled_for_template_deployment = enabled_for_template_deployment
self.enable_soft_delete = enable_soft_delete
self.resource_group_parameter_name = resource_group_parameter_name
self.parameter_name = parameter_name
if random_name_enabled:
self.resource_moniker = "vaultname"
self.client_oid = None
def create_resource(self, name, **kwargs):
self.client_oid = self.test_class_instance.set_value_to_scrub("CLIENT_OID", CLIENT_OID)
if self.is_live:
group = self._get_resource_group(**kwargs).name
access_policies = [
AccessPolicyEntry(
tenant_id=self.test_class_instance.get_settings_value("TENANT_ID"),
object_id=self.client_oid,
permissions=self.permissions,
)
]
properties = VaultProperties(
tenant_id=self.test_class_instance.get_settings_value("TENANT_ID"),
sku=Sku(name=self.sku, family=SkuFamily.A) if SkuFamily else Sku(name=self.sku),
access_policies=access_policies,
vault_uri=None,
enabled_for_deployment=self.enabled_for_deployment,
enabled_for_disk_encryption=self.enabled_for_disk_encryption,
enabled_for_template_deployment=self.enabled_for_template_deployment,
enable_soft_delete=self.enable_soft_delete,
enable_purge_protection=None,
)
parameters = VaultCreateOrUpdateParameters(location=self.location, properties=properties)
self.client = self.create_mgmt_client(KeyVaultManagementClient)
# ARM may return not found at first even though the resource group has been created
retries = 4
for i in range(retries):
try:
vault = self.client.vaults.begin_create_or_update(group, name, parameters).result()
break
except Exception as ex:
if "VaultAlreadyExists" in str(ex):
raise NameInUseError(name)
if "ReservedResourceName" in str(ex):
raise ReservedResourceNameError(name)
if "ResourceGroupNotFound" not in str(ex) or i == retries - 1:
raise
time.sleep(3)
self.test_class_instance.scrubber.register_name_pair(name, self.resource_moniker)
vault_uri = vault.properties.vault_uri
else:
# playback => we need only the uri used in the recording
vault_uri = "https://{}.vault.azure.net/".format(name)
return {self.parameter_name: vault_uri}
def remove_resource(self, name, **kwargs):
if self.is_live:
group = self._get_resource_group(**kwargs).name
self.client.vaults.delete(group, name)
if self.enable_soft_delete:
self.client.vaults.purge_deleted(name, self.location).wait()
def _get_resource_group(self, **kwargs):
try:
return kwargs[self.resource_group_parameter_name]
except KeyError:
template = (
"To create a key vault a resource group is required. Please add "
"decorator @{} in front of this storage account preparer."
)
raise AzureTestError(template.format(ResourceGroupPreparer.__name__))

Просмотреть файл

@ -11,7 +11,10 @@ import logging
from azure_devtools.scenario_tests import AzureTestError, ReservedResourceNameError
from azure.mgmt.resource import ResourceManagementClient
try:
from azure.mgmt.resource import ResourceManagementClient
except ImportError:
pass
from . import AzureMgmtPreparer
from .sanitizers import add_general_regex_sanitizer

Просмотреть файл

@ -17,11 +17,7 @@ DEPENDENCIES = [
"pytest-cov",
"pytest>=3.5.1",
"readme_renderer",
"azure-storage-common<1.4.1",
"pyopenssl",
"azure-mgmt-resource",
"azure-mgmt-storage",
"azure-mgmt-keyvault",
"python-dotenv",
"PyYAML",
]