Skip to content

Commit

Permalink
Harmonize args for ssh_connect_blade() and ssh_connect_blades() (#23)
Browse files Browse the repository at this point in the history
* Add mechanism in terragrunt templates to turn off external IPs

* Harmonize args to ssh_connect_blade and ssh_connect_blades
  • Loading branch information
erl-hpe authored Jul 1, 2024
1 parent 639b286 commit 99f9142
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion vtds_provider_gcp/api_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def ssh_connect_blade(self, blade_type, instance, remote_port):

@contextmanager
@abstractmethod
def ssh_connect_blades(self, remote_port=22, blade_types=None):
def ssh_connect_blades(self, blade_types=None, remote_port=22):
"""Establish external connections to the specified remote port
on all the Virtual Blade instances on all the Virtual Blade
types listed by name in 'blade_types'. If 'blade_types' is not
Expand Down
2 changes: 1 addition & 1 deletion vtds_provider_gcp/private/api_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ def ssh_connect_blade(self, blade_type, instance, remote_port=22):
connection._disconnect() # pylint: disable=protected-access

@contextmanager
def ssh_connect_blades(self, remote_port=22, blade_types=None):
def ssh_connect_blades(self, blade_types=None, remote_port=22):
"""Establish external connections to the SSH server on all the
Virtual Blade instances on all the Virtual Blade types listed
by name in 'blade_types'. If 'blade_types' is not provided or
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ inputs = {
network = ""
subnetwork = format("{{ interconnect_name }}-%s", local.vtds_vars.provider.project.region)
subnetwork_project = dependency.service_project.outputs.project_id
{% if access_config %}
access_config = local.vtds_vars.{{ config_path }}.access_config
{% endif %}
add_hostname_suffix = local.vtds_vars.{{ config_path }}.add_hostname_suffix
hostname_suffix_separator = local.vtds_vars.{{ config_path }}.hostname_suffix_separator
hostname = local.vtds_vars.{{ config_path }}.hostname
Expand Down
4 changes: 3 additions & 1 deletion vtds_provider_gcp/private/virtual_blade.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ def initialize(self, key, blade_config):
try:
interconnect = blade_config['blade_interconnect']
boot_disk = blade_config.get('vm', {})['boot_disk']
access_config = blade_config.get('access_config', [])
except KeyError as err:
raise ContextualError(
"missing config in the Virtual Blade class '%s': %s" % (
Expand All @@ -79,7 +80,8 @@ def initialize(self, key, blade_config):
'blade_class': key,
'interconnect_name': interconnect['subnetwork'],
'config_path': "provider.virtual_blades.%s" % key,
'source_image_private': boot_disk['source_image_private']
'source_image_private': boot_disk['source_image_private'],
'access_config': access_config,
}
except KeyError as err:
raise ContextualError(
Expand Down

0 comments on commit 99f9142

Please sign in to comment.