Switched to Azurearm over msazure

This commit is contained in:
Tyler Johnson 2019-08-13 14:26:55 -06:00
commit 5912f24355
No known key found for this signature in database
GPG Key ID: 691E31397E27D004
7 changed files with 42 additions and 34 deletions

View File

@ -1035,15 +1035,6 @@ def request_instance(vm_):
default=False
)
vm_password = salt.utils.stringutils.to_str(
config.get_cloud_config_value(
'ssh_password', vm_, __opts__, search_global=True,
default=config.get_cloud_config_value(
'win_password', vm_, __opts__, search_global=True
)
)
)
os_kwargs = {}
win_installer = config.get_cloud_config_value(
'win_installer', vm_, __opts__, search_global=True
@ -1061,6 +1052,16 @@ def request_instance(vm_):
ssh=sshconfiguration,
)
os_kwargs['linux_configuration'] = linuxconfiguration
vm_password = None
else:
vm_password = salt.utils.stringutils.to_str(
config.get_cloud_config_value(
'ssh_password', vm_, __opts__, search_global=True,
default=config.get_cloud_config_value(
'win_password', vm_, __opts__, search_global=True
)
)
)
if win_installer or (vm_password is not None and not disable_password_authentication):
if not isinstance(vm_password, str):
@ -1327,7 +1328,7 @@ def request_instance(vm_):
),
network_profile=NetworkProfile(
network_interfaces=[
NetworkInterfaceReference(vm_['iface_id']),
NetworkInterfaceReference(id=vm_['iface_id']),
],
),
availability_set=availability_set,

View File

@ -68,7 +68,7 @@ try:
if LooseVersion(azure.storage.__version__) < LooseVersion('0.20.0'):
raise ImportError('azure.storage.__version__ must be >= 0.20.0')
HAS_AZURE = True
except ImportError:
except (ImportError, AttributeError):
HAS_AZURE = False
# Import third party libs

View File

@ -8,7 +8,7 @@ from __future__ import absolute_import, print_function, unicode_literals
import logging
# Import Salt Testing Libs
from tests.integration.cloud.helpers.cloud_test_base import TIMEOUT, CloudTest
from tests.integration.cloud.helpers.cloud_test_base import TIMEOUT as CLOUD_TIMEOUT, CloudTest
from tests.support.unit import skipIf
# Import Salt Libs
@ -16,7 +16,6 @@ from salt.utils.versions import LooseVersion
try:
import azure # pylint: disable=unused-import
HAS_AZURE = True
except ImportError:
HAS_AZURE = False
@ -24,11 +23,11 @@ except ImportError:
if HAS_AZURE and not hasattr(azure, '__version__'):
import azure.common
# Create the cloud instance name to be used throughout the tests
REQUIRED_AZURE = '0.11.1'
log = logging.getLogger(__name__)
TIMEOUT = CLOUD_TIMEOUT * 2
REQUIRED_AZURE = '0.11.1'
def __has_required_azure():
'''
@ -45,15 +44,14 @@ def __has_required_azure():
return False
@skipIf(True, 'MSAzure will be deprecated in favor of azurearm')
@skipIf(HAS_AZURE is False, 'These tests require the Azure Python SDK to be installed.')
@skipIf(__has_required_azure() is False, 'The Azure Python SDK must be >= 0.11.1.')
@skipIf(not HAS_AZURE, 'These tests require the Azure Python SDK to be installed.')
@skipIf(not __has_required_azure(), 'The Azure Python SDK must be >= 0.11.1.')
class AzureTest(CloudTest):
'''
Integration tests for the Azure cloud provider in Salt-Cloud
'''
PROVIDER = 'azure'
REQUIRED_PROVIDER_CONFIG_ITEMS = ('subscription_id', 'certificate_path', 'ssh_username', 'ssh_password', 'media_link')
PROVIDER = 'azurearm'
REQUIRED_PROVIDER_CONFIG_ITEMS = ('subscription_id',)
def test_instance(self):
'''

View File

@ -75,10 +75,12 @@ class CloudTest(ShellCase):
@property
def instance_name(self):
if not hasattr(self, '_instance_name'):
if not hasattr(self, '__instance_name'):
# Create the cloud instance name to be used throughout the tests
self._instance_name = generate_random_name('cloud-test-').lower()
return self._instance_name
subclass = self.__class__.__bases__[0].__name__.strip('Test')
# Use the first three letters of the subclass, fill with '-' if too short
self.__instance_name = generate_random_name('cloud-test-{.-<3.3}-'.format(subclass)).lower()
return self.__instance_name
@property
def providers(self):

View File

@ -1,10 +1,8 @@
azure-test:
provider: azure-config
image: 'b39f27a8b8c64d52b05eac6a62ebad85__Ubuntu-14_04-LTS-amd64-server-20140724-en-us-30GB'
size: Medium
location: West US
size: Standard_D1
slot: production
ssh_username: ''
ssh_password: ''
media_link: ''
script_args: '-P'

View File

@ -1,7 +0,0 @@
azure-config:
driver: azure
subscription_id: ''
certificate_path: ''
cleanup_disks: True
cleanup_vhds: True
cleanup_services: True

View File

@ -0,0 +1,16 @@
azure-config:
driver: azurearm
subscription_id: ''
cleanup_disks: True
cleanup_interfaces: True
cleanup_vhds: True
cleanup_services: True
minion:
master_type: str
username: ''
password: ''
location: ''
network_resource_group: ''
network: ''
subnet: ''
resource_group: ''