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 GCE to Google API. #242

Merged
merged 6 commits into from
Apr 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions img_proof/ipa_azure.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ def __init__(
timeout=None,
vnet_name=None,
vnet_resource_group=None,
collect_vm_info=None
collect_vm_info=None,
enable_secure_boot=None,
enable_uefi=None
):
"""Initialize Azure Cloud class."""
super(AzureCloud, self).__init__(
Expand All @@ -89,7 +91,9 @@ def __init__(
collect_vm_info,
ssh_private_key_file,
ssh_user,
subnet_id
subnet_id,
enable_secure_boot,
enable_uefi
)

self.vnet_name = vnet_name or self.ipa_config['vnet_name']
Expand Down
23 changes: 10 additions & 13 deletions img_proof/ipa_cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@
from img_proof.ipa_exceptions import (
IpaException,
IpaCloudException,
IpaSSHException,
IpaRetryableError,
GCECloudRetryableError
IpaSSHException
)
from img_proof.results_plugin import Report

Expand Down Expand Up @@ -95,7 +93,9 @@ def __init__(
collect_vm_info=None,
ssh_private_key_file=None,
ssh_user=None,
subnet_id=None
subnet_id=None,
enable_secure_boot=None,
enable_uefi=None
):
"""Initialize base cloud framework class."""
super(IpaCloud, self).__init__()
Expand Down Expand Up @@ -157,6 +157,11 @@ def __init__(
self.ssh_private_key_file = self.ipa_config['ssh_private_key_file']
self.ssh_user = self.ipa_config['ssh_user']
self.subnet_id = self.ipa_config['subnet_id']
self.enable_secure_boot = self.ipa_config['enable_secure_boot']
self.enable_uefi = self.ipa_config['enable_uefi']

if self.enable_secure_boot and not self.enable_uefi:
self.enable_uefi = True

if self.cloud_config:
self.cloud_config = os.path.expanduser(self.cloud_config)
Expand Down Expand Up @@ -668,19 +673,11 @@ def test_image(self):
self.logger.info('Launching new instance')
try:
self._launch_instance()
except GCECloudRetryableError as error:
with ipa_utils.ignored(Exception):
self._cleanup_instance(1)

msg = 'Unable to connect to instance: %s' % error
self.logger.error(msg)
raise IpaRetryableError(msg)
except Exception as error:
with ipa_utils.ignored(Exception):
self._cleanup_instance(1)

msg = 'Unable to connect to instance: %s' % error
self.logger.error(msg)
self.logger.error(error)
raise

if not self.instance_ip:
Expand Down
10 changes: 8 additions & 2 deletions img_proof/ipa_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ def test_image(
early_exit=None,
history_log=None,
image_id=None,
image_project=None,
inject=None,
instance_type=None,
ip_address=None,
Expand Down Expand Up @@ -75,7 +76,9 @@ def test_image(
signing_key_fingerprint=None,
signing_key_file=None,
tenancy=None,
oci_user_id=None
oci_user_id=None,
enable_secure_boot=None,
enable_uefi=None
):
"""Creates a cloud framework instance and initiates testing."""
kwargs = {
Expand All @@ -100,7 +103,9 @@ def test_image(
'test_dirs': test_dirs,
'test_files': tests,
'timeout': timeout,
'collect_vm_info': collect_vm_info
'collect_vm_info': collect_vm_info,
'enable_secure_boot': enable_secure_boot,
'enable_uefi': enable_uefi
}

cloud_name = cloud_name.lower()
Expand All @@ -124,6 +129,7 @@ def test_image(
elif cloud_name == 'gce':
cloud = GCECloud(
service_account_file=service_account_file,
image_project=image_project,
**kwargs
)
elif cloud_name == 'ssh':
Expand Down
8 changes: 6 additions & 2 deletions img_proof/ipa_ec2.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ def __init__(
test_dirs=None,
test_files=None,
timeout=None,
collect_vm_info=None
collect_vm_info=None,
enable_secure_boot=None,
enable_uefi=None
):
"""Initialize EC2 cloud framework class."""
super(EC2Cloud, self).__init__(
Expand All @@ -93,7 +95,9 @@ def __init__(
collect_vm_info,
ssh_private_key_file,
ssh_user,
subnet_id
subnet_id,
enable_secure_boot,
enable_uefi
)
# Get command line values that are not None
cmd_line_values = self._get_non_null_values(locals())
Expand Down
4 changes: 0 additions & 4 deletions img_proof/ipa_exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@ class GCECloudException(IpaCloudException):
"""Generic GCE exception."""


class GCECloudRetryableError(GCECloudException):
"""GCE retryable error exception."""


class OCICloudException(IpaCloudException):
"""Generic OCI exception."""

Expand Down
Loading