Remove unused code when failing to start console
Processutils.ProcessExecutionError is never raised when it is unable to stop an old shellinabox process due to a fix[1][2]. Instead of the error, ConsoleError is raised. It would be better not to ignore the error and to fail to start a console for avoiding process leak. This patch removes a block for the exception which is never raised. [1]https://review.openstack.org/#/c/242319/ [2]https://review.openstack.org/#/c/244699/ Change-Id: Ia1226da652510c5655c9b8c270e6fc168efd935d
This commit is contained in:
parent
79439274bb
commit
4ae92b46f7
@ -27,7 +27,6 @@ import subprocess
|
|||||||
import time
|
import time
|
||||||
|
|
||||||
from ironic_lib import utils as ironic_utils
|
from ironic_lib import utils as ironic_utils
|
||||||
from oslo_concurrency import processutils
|
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
from oslo_service import loopingcall
|
from oslo_service import loopingcall
|
||||||
from oslo_utils import netutils
|
from oslo_utils import netutils
|
||||||
@ -151,7 +150,8 @@ def start_shellinabox_console(node_uuid, port, console_cmd):
|
|||||||
:param node_uuid: the uuid for the node.
|
:param node_uuid: the uuid for the node.
|
||||||
:param port: the terminal port for the node.
|
:param port: the terminal port for the node.
|
||||||
:param console_cmd: the shell command that gets the console.
|
:param console_cmd: the shell command that gets the console.
|
||||||
:raises: ConsoleError if the directory for the PID file cannot be created.
|
:raises: ConsoleError if the directory for the PID file cannot be created
|
||||||
|
or an old process cannot be stopped.
|
||||||
:raises: ConsoleSubprocessFailed when invoking the subprocess failed.
|
:raises: ConsoleSubprocessFailed when invoking the subprocess failed.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@ -161,11 +161,6 @@ def start_shellinabox_console(node_uuid, port, console_cmd):
|
|||||||
_stop_console(node_uuid)
|
_stop_console(node_uuid)
|
||||||
except exception.NoConsolePid:
|
except exception.NoConsolePid:
|
||||||
pass
|
pass
|
||||||
except processutils.ProcessExecutionError as exc:
|
|
||||||
LOG.warning(_LW("Failed to kill the old console process "
|
|
||||||
"before starting a new shellinabox console "
|
|
||||||
"for node %(node)s. Reason: %(err)s"),
|
|
||||||
{'node': node_uuid, 'err': exc})
|
|
||||||
|
|
||||||
_ensure_console_pid_dir_exists()
|
_ensure_console_pid_dir_exists()
|
||||||
pid_file = _get_console_pid_file(node_uuid)
|
pid_file = _get_console_pid_file(node_uuid)
|
||||||
|
Loading…
Reference in New Issue
Block a user