Skip to content

Commit

Permalink
Update api_objects.py
Browse files Browse the repository at this point in the history
Fix comments seen as problematic in code review.
  • Loading branch information
erl-hpe authored Jul 2, 2024
1 parent e4d1bcb commit 95daff7
Showing 1 changed file with 36 additions and 23 deletions.
59 changes: 36 additions & 23 deletions vtds_provider_gcp/api_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,14 @@ def blade_ssh_key_paths(self, blade_type):
def connect_blade(self, blade_type, instance, remote_port):
"""Establish an external connection to the specified remote
port on the specified instance of the named Virtual Blade
type. Return a context manager (suitable for use in a 'with'
clause) yielding an APIBladeConnection object for the
connection. Upon leaving the 'with' context, the connection in
the APIBladeConnection is closed.
type. Return a BladeConnection object for the connection.
BladeConnections are context managed, so if this is used
in a 'with' clause, upon leaving the 'with' context, the
connection in the BladeConnection is automatically closed.
This can also be used to connect to a host with an IP address
reachable by the blade if 'host' is specified. In this case,
the port will be tunneled through the blade to the specified
host instead of the blade itself.
To close the connection outside of a 'with' clause call
the __exit__() method on the BladeConnection.
"""

Expand All @@ -112,21 +111,30 @@ def connect_blades(self, remote_port, blade_types=None):
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 None, all available blade types are used. Return a
context manager (suitable for use in a 'with' clause) yielding
the list of APIBladeConnection objects representing the
connections. Upon leaving the 'with' context, all the
connections in the resulting list are closed.
BladeConnectionSet object representing the connections.
BladeConnectionSets are context managed, so if this is used
in a 'with' clause, upon leaving the 'with' context, the
connections in the BladeConnectionSet are automatically closed.
To close the connections outside of a 'with' clause call
the __exit__() method on the BladeConnectionSet.
"""

@abstractmethod
def ssh_connect_blade(self, blade_type, instance, remote_port):
"""Establish an external connection to the SSH server
port on the specified instance of the named Virtual Blade
type. Return a context manager (suitable for use in a 'with'
clause) yielding a BladeSSHConnection object for the
connection. Upon leaving the 'with' context, the connection in
the BladeSSHConnection is closed.
type. Return a BladeSSHConnection object for the
connection.
BladeSSHConnection are context managed, so if this is used
in a 'with' clause, upon leaving the 'with' context, the
connection in the BladeSSHConnection is automatically closed.
To close the connection outside of a 'with' clause call
the __exit__() method on the BladeSSHConnection.
"""

Expand All @@ -136,10 +144,15 @@ def ssh_connect_blades(self, blade_types=None, remote_port=22):
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 None, all available blade types are used. Return a
context manager (suitable for use in a 'with' clause) yielding
the list of APIBladeConnection objects representing the
connections. Upon leaving the 'with' context, all the
connections in the resulting list are closed.
BladeSSHConnectionSet object representing the
connections.
BladeSSHConnectionSets are context managed, so if this is used
in a 'with' clause, upon leaving the 'with' context, the
connections in the BladeSSHConnectionSet are automatically closed.
To close the connections outside of a 'with' clause call
the __exit__() method on the BladeSSHConnectionSet.
"""

Expand Down Expand Up @@ -217,7 +230,7 @@ def __exit__(
exception_value=None,
traceback=None
):
"""Context departure handler to make BladeConnection
"""Context exit handler to make BladeConnection
objects usable with the 'with ... as' construct. This cleans
up all resources associated with the BladeConnection on
exit from the 'with' block context. Not called if the object
Expand Down Expand Up @@ -265,7 +278,7 @@ def __exit__(
exception_value=None,
traceback=None
):
"""Context departure handler to make BladeConnectionSet
"""Context exit handler to make BladeConnectionSet
objects usable with the 'with ... as' construct. This cleans
up all resources associated with the BladeConnectionSet on
exit from the 'with' block context. Not called if the object
Expand Down Expand Up @@ -396,7 +409,7 @@ def __exit__(
exception_value=None,
traceback=None
):
"""Context departure handler to make BladeSSHConnection objects
"""Context exit handler to make BladeSSHConnection objects
usable with the 'with ... as' construct. This cleans up all
resources associated with the BladeSSHConnection on exit from
the 'with' block context. Not called if the object is used
Expand Down

0 comments on commit 95daff7

Please sign in to comment.