mirror of
https://github.com/valitydev/salt.git
synced 2024-11-06 16:45:27 +00:00
Switched to Azurearm over msazure
This commit is contained in:
commit
5912f24355
@ -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,
|
||||
|
@ -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
|
||||
|
@ -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):
|
||||
'''
|
||||
|
@ -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):
|
||||
|
@ -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'
|
||||
|
@ -1,7 +0,0 @@
|
||||
azure-config:
|
||||
driver: azure
|
||||
subscription_id: ''
|
||||
certificate_path: ''
|
||||
cleanup_disks: True
|
||||
cleanup_vhds: True
|
||||
cleanup_services: True
|
16
tests/integration/files/conf/cloud.providers.d/azurearm.conf
Normal file
16
tests/integration/files/conf/cloud.providers.d/azurearm.conf
Normal 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: ''
|
Loading…
Reference in New Issue
Block a user