Send terminal erase sequence on tripleo deploy
We're seeing some escape sequences being dropped when we run the deployment via the undercloud. This causes a user to have to run a reset after the undercloud installation in order to be able to use their shell command line again. We can avoid this if we send an terminal erase line sequence to trim the rest of the line at the end of the deploy. Change-Id: Ibb74bfebfaab2cd122abe1bc3cd5bbd2562ccfc5 Closes-Bug: #1833302
This commit is contained in:
parent
189281993b
commit
e1a051d6ac
@ -887,6 +887,7 @@ class TestDeployUndercloud(TestPluginV1):
|
||||
env
|
||||
)
|
||||
|
||||
@mock.patch('tripleoclient.utils.send_cmdline_erase_sequence')
|
||||
@mock.patch('tripleoclient.v1.tripleo_deploy.Deploy.'
|
||||
'_download_stack_outputs')
|
||||
@mock.patch('tripleo_common.actions.ansible.'
|
||||
@ -939,7 +940,8 @@ class TestDeployUndercloud(TestPluginV1):
|
||||
mock_cleanupdirs, mock_launchansible,
|
||||
mock_tarball, mock_templates_dir,
|
||||
mock_open, mock_os, mock_user, mock_cc,
|
||||
mock_chmod, mock_ac, mock_outputs):
|
||||
mock_chmod, mock_ac, mock_outputs,
|
||||
mock_cmdline):
|
||||
mock_slink.side_effect = 'fake-cmd'
|
||||
parsed_args = self.check_parser(self.cmd,
|
||||
['--local-ip', '127.0.0.1',
|
||||
@ -972,9 +974,11 @@ class TestDeployUndercloud(TestPluginV1):
|
||||
mock_tarball.assert_called_once()
|
||||
mock_cleanupdirs.assert_called_once()
|
||||
self.assertEqual(mock_killheat.call_count, 2)
|
||||
mock_cmdline.assert_called_once()
|
||||
|
||||
@mock.patch('tripleoclient.utils.send_cmdline_erase_sequence')
|
||||
@mock.patch('tripleoclient.utils.ansible_symlink')
|
||||
def test_take_action(self, mock_slink):
|
||||
def test_take_action(self, mock_slink, mock_cmdline):
|
||||
mock_slink.side_effect = 'fake-cmd'
|
||||
parsed_args = self.check_parser(self.cmd,
|
||||
['--local-ip', '127.0.0.1',
|
||||
@ -983,11 +987,13 @@ class TestDeployUndercloud(TestPluginV1):
|
||||
'--output-dir', '/my'], [])
|
||||
self.assertRaises(exceptions.DeploymentError,
|
||||
self.cmd.take_action, parsed_args)
|
||||
mock_cmdline.assert_called_once()
|
||||
|
||||
@mock.patch('tripleoclient.utils.send_cmdline_erase_sequence')
|
||||
@mock.patch('tripleoclient.v1.tripleo_deploy.Deploy._standalone_deploy',
|
||||
return_value=1)
|
||||
@mock.patch('tripleoclient.utils.ansible_symlink')
|
||||
def test_take_action_failure(self, mock_slink, mock_deploy):
|
||||
def test_take_action_failure(self, mock_slink, mock_deploy, mock_cmdline):
|
||||
mock_slink.side_effect = 'fake-cmd'
|
||||
parsed_args = self.check_parser(self.cmd,
|
||||
['--local-ip', '127.0.0.1',
|
||||
@ -997,6 +1003,7 @@ class TestDeployUndercloud(TestPluginV1):
|
||||
'--standalone'], [])
|
||||
self.assertRaises(exceptions.DeploymentError,
|
||||
self.cmd.take_action, parsed_args)
|
||||
mock_cmdline.assert_called_once()
|
||||
|
||||
@mock.patch('os.path.isfile', return_value=False)
|
||||
def test_set_stack_action_default_create(self, mock_isfile):
|
||||
|
@ -1924,3 +1924,10 @@ def check_file_for_enabled_service(env_file):
|
||||
def check_deprecated_service_is_enabled(environment_files):
|
||||
for env_file in environment_files:
|
||||
check_file_for_enabled_service(env_file)
|
||||
|
||||
|
||||
def send_cmdline_erase_sequence():
|
||||
# Send's an erase in line sequence to the output
|
||||
# https://www.vt100.net/docs/vt100-ug/chapter3.html#EL
|
||||
sys.stdout.write(u'\u001b[0K')
|
||||
sys.stdout.flush()
|
||||
|
@ -1400,12 +1400,17 @@ class Deploy(command.Command):
|
||||
raise exceptions.UndercloudUpgradeNotConfirmed("(ctrl-d) %s" %
|
||||
unconf_msg)
|
||||
|
||||
if parsed_args.standalone:
|
||||
if self._standalone_deploy(parsed_args) != 0:
|
||||
msg = _('Deployment failed.')
|
||||
try:
|
||||
if parsed_args.standalone:
|
||||
if self._standalone_deploy(parsed_args) != 0:
|
||||
msg = _('Deployment failed.')
|
||||
self.log.error(msg)
|
||||
raise exceptions.DeploymentError(msg)
|
||||
else:
|
||||
msg = _('Non-standalone is currently not supported')
|
||||
self.log.error(msg)
|
||||
raise exceptions.DeploymentError(msg)
|
||||
else:
|
||||
msg = _('Non-standalone is currently not supported')
|
||||
self.log.error(msg)
|
||||
raise exceptions.DeploymentError(msg)
|
||||
finally:
|
||||
# send erase sequence to reset the cmdline if paunch/ansible
|
||||
# mangled some escape sequences
|
||||
utils.send_cmdline_erase_sequence()
|
||||
|
Loading…
Reference in New Issue
Block a user