Skip to content

Commit

Permalink
Mark get_short_command() as private.
Browse files Browse the repository at this point in the history
This method is only used internally by the Reporter class.

Bug: T212783
Change-Id: I4af69c995864a13c4d53cfb40b7f4bad2e47d14f
  • Loading branch information
Guillaume Lederrey committed Oct 16, 2020
1 parent 34bb1b8 commit a8bb9cd
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions cumin/transports/clustershell.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ def _get_log_message(self, num: int, num_hosts: int, message: str, # pylint: di

return log_message, nodes_string

def get_short_command(self, command: Command) -> str:
def _get_short_command(self, command: Command) -> str:
"""Return a shortened representation of a command omitting the central part, if it's too long.
Arguments:
Expand Down Expand Up @@ -240,7 +240,7 @@ def commands_output_report(self, buffer_iterator: Any, command: Optional[Command
"""
nodelist = None
if command is not None:
output_message = "----- OUTPUT of '{command}' -----".format(command=self.get_short_command(command))
output_message = "----- OUTPUT of '{command}' -----".format(command=self._get_short_command(command))
else:
output_message = '----- OUTPUT -----'

Expand All @@ -261,7 +261,7 @@ def commands_output_report(self, buffer_iterator: Any, command: Optional[Command
def report_single_command_output(self, command: Command) -> None:
"""Reports a single command execution."""
output_message = "----- OUTPUT of '{command}' -----".format(
command=self.get_short_command(command))
command=self._get_short_command(command))
tqdm.write(Colored.blue(output_message), file=sys.stdout)

# FIXME: worker, node and msg should have more specific type annotations.
Expand Down Expand Up @@ -309,7 +309,7 @@ def failed_commands_report(self, nodes: Dict[str, Node], num_hosts: int, command
if filter_command_index >= 0 and command is not None and index != filter_command_index:
continue

short_command = self.get_short_command(command) if command is not None else ''
short_command = self._get_short_command(command) if command is not None else ''
message = "of nodes {state} to execute command '{command}'".format(
state=State.states_representation[state], command=short_command)
log_message, nodes_string = self._get_log_message(len(failed_nodes), num_hosts=num_hosts,
Expand Down Expand Up @@ -342,7 +342,7 @@ def report_nodes_success(self, command: Optional[Command], # pylint: disable=to
post = '.'
message_string = ' of nodes successfully executed all commands'
if command is not None:
message_string = " for command: '{command}'".format(command=self.get_short_command(command))
message_string = " for command: '{command}'".format(command=self._get_short_command(command))
nodes_to_log = None
if num_successfull_nodes not in (0, tot):
nodes_to_log = [node.name for node in nodes.values() if node.state.is_success]
Expand Down

0 comments on commit a8bb9cd

Please sign in to comment.