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

Migrate Azure to ARM #63

Merged
merged 12 commits into from
Mar 20, 2018
549 changes: 417 additions & 132 deletions ipa/ipa_azure.py

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion ipa/ipa_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
SUPPORTED_DISTROS = ('openSUSE_Leap', 'SLES')
SUPPORTED_PROVIDERS = ('azure', 'ec2', 'gce')

AZURE_DEFAULT_TYPE = 'Small'
AZURE_DEFAULT_TYPE = 'Standard_B1ms'
AZURE_DEFAULT_USER = 'azureuser'
EC2_DEFAULT_TYPE = 't2.micro'
EC2_DEFAULT_USER = 'ec2-user'
Expand Down
10 changes: 6 additions & 4 deletions ipa/ipa_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,11 @@ def test_image(provider_name,
ssh_key_name=None,
ssh_private_key=None,
ssh_user=None,
storage_container=None,
subnet_id=None,
test_dirs=None,
tests=None):
tests=None,
vnet_name=None,
vnet_resource_group=None):
"""Creates a cloud provider instance and initiates testing."""
if provider_name == 'azure':
provider_class = AzureProvider
Expand Down Expand Up @@ -93,10 +94,11 @@ def test_image(provider_name,
ssh_key_name=ssh_key_name,
ssh_private_key=ssh_private_key,
ssh_user=ssh_user,
storage_container=storage_container,
subnet_id=subnet_id,
test_dirs=test_dirs,
test_files=tests
test_files=tests,
vnet_name=vnet_name,
vnet_resource_group=vnet_resource_group
)

return provider.test_image()
Expand Down
6 changes: 4 additions & 2 deletions ipa/ipa_ec2.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,12 @@ def __init__(self,
ssh_key_name=None,
ssh_private_key=None,
ssh_user=None,
storage_container=None, # Not used in EC2
subnet_id=None,
test_dirs=None,
test_files=None):
test_files=None,
vnet_name=None, # Not used in EC2
vnet_resource_group=None # Not used in EC2
):
"""Initialize EC2 provider class."""
super(EC2Provider, self).__init__('ec2',
cleanup,
Expand Down
6 changes: 4 additions & 2 deletions ipa/ipa_gce.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,12 @@ def __init__(self,
ssh_key_name=None, # Not used in GCE
ssh_private_key=None,
ssh_user=None,
storage_container=None, # Not used in GCE
subnet_id=None,
test_dirs=None,
test_files=None):
test_files=None,
vnet_name=None, # Not used in GCE
vnet_resource_group=None # Not used in GCE
):
super(GCEProvider, self).__init__('gce',
cleanup,
config,
Expand Down
23 changes: 14 additions & 9 deletions ipa/scripts/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,11 +192,6 @@ def main():
'--ssh-user',
help='SSH user for accessing instance.'
)
@click.option(
'-S',
'--storage-container',
help='Azure storage container to use.'
)
@click.option(
'--subnet-id',
help='Subnet to launch the new instance into.'
Expand All @@ -205,6 +200,14 @@ def main():
'--test-dirs',
help='Directories to search for tests.'
)
@click.option(
'--vnet-name',
help='Azure virtual network name to attach network interface.'
)
@click.option(
'--vnet-resource-group',
help='Azure resource group name where virtual network is found.'
)
@click.argument(
'provider',
type=click.Choice(SUPPORTED_PROVIDERS)
Expand Down Expand Up @@ -232,9 +235,10 @@ def test(access_key_id,
ssh_key_name,
ssh_private_key,
ssh_user,
storage_container,
subnet_id,
test_dirs,
vnet_name,
vnet_resource_group,
provider,
tests):
"""Test image in the given framework using the supplied test files."""
Expand Down Expand Up @@ -262,10 +266,11 @@ def test(access_key_id,
ssh_key_name,
ssh_private_key,
ssh_user,
storage_container,
subnet_id,
test_dirs,
tests
tests,
vnet_name,
vnet_resource_group
)
echo_results(results, no_color)
sys.exit(status)
Expand Down Expand Up @@ -387,7 +392,7 @@ def results(clear,
echo_log(log_file, no_color)
else:
echo_results_file(
log_file.split('.')[0] + '.results',
log_file.rsplit('.', 1)[0] + '.results',
no_color,
verbose
)
Expand Down
10 changes: 8 additions & 2 deletions package/python3-ipa.spec
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ BuildRequires: python3-devel
BuildRequires: python3-setuptools
%if %{with test}
BuildRequires: python3-apache-libcloud
BuildRequires: python3-azurectl >= 3.0.1
BuildRequires: python3-azure-common
BuildRequires: python3-azure-mgmt-compute
BuildRequires: python3-azure-mgmt-network
BuildRequires: python3-azure-mgmt-resource
BuildRequires: python3-click
BuildRequires: python3-coverage
BuildRequires: python3-cryptography
Expand All @@ -40,7 +43,10 @@ BuildRequires: python3-PyYAML
BuildRequires: python3-testinfra
%endif
Requires: python3-apache-libcloud
Requires: python3-azurectl >= 3.0.1
Requires: python3-azure-common
Requires: python3-azure-mgmt-compute
Requires: python3-azure-mgmt-network
Requires: python3-azure-mgmt-resource
Requires: python3-click
Requires: python3-cryptography
Requires: python3-paramiko
Expand Down
8 changes: 6 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@

requirements = [
'apache-libcloud',
'azurectl>=3.0.1',
'azure-common',
'azure-mgmt-compute',
'azure-mgmt-network',
'azure-mgmt-resource',
'Click',
'cryptography',
'paramiko',
Expand Down Expand Up @@ -87,7 +90,8 @@
'Environment :: Console',
'Intended Audience :: Developers',
'Topic :: Software Development :: Testing',
'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)',
'License :: OSI Approved :: '
'GNU General Public License v3 or later (GPLv3+)',
'Natural Language :: English',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
Expand Down
13 changes: 0 additions & 13 deletions tests/azure/azure.config

This file was deleted.

6 changes: 0 additions & 6 deletions tests/azure/publishsettings

This file was deleted.

12 changes: 12 additions & 0 deletions tests/azure/test-sa.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"clientId": "12345",
"clientSecret": "12345",
"subscriptionId": "12345",
"tenantId": "12345",
"activeDirectoryEndpointUrl": "https://login.microsoftonline.com",
"resourceManagerEndpointUrl": "https://management.azure.com/",
"activeDirectoryGraphResourceId": "https://graph.windows.net/",
"sqlManagementEndpointUrl": "https://management.core.windows.net:8443/",
"galleryEndpointUrl": "https://gallery.azure.com/",
"managementEndpointUrl": "https://management.core.windows.net/"
}
Loading