action/ce.py:clear configuration candidate when return to user-view. (#63513)
* clear configuration candidate when return to user-view.
* add a changelog fragment for the pr.
* Update 63513-ce_action_wait_prompt_trigger_time_out.yaml
* Update 63513-ce_action_wait_prompt_trigger_time_out.yaml
(cherry picked from commit 47c31c201b)
This commit is contained in:
committed by
Toshio Kuratomi
parent
0046d0be47
commit
30bbbdbe33
@ -0,0 +1,2 @@
|
||||
bugfixes:
|
||||
- action/ce - fix a bug, some new version os will not discard uncommitted configure with a return directly.(https://github.com/ansible/ansible/pull/63513).
|
||||
@ -93,10 +93,14 @@ class ActionModule(ActionNetworkModule):
|
||||
socket_path = self._connection.socket_path
|
||||
conn = Connection(socket_path)
|
||||
out = conn.get_prompt()
|
||||
while to_text(out, errors='surrogate_then_replace').strip().endswith(']'):
|
||||
prompt = to_text(out, errors='surrogate_then_replace').strip()
|
||||
while prompt.endswith(']'):
|
||||
display.vvvv('wrong context, sending exit to device', self._play_context.remote_addr)
|
||||
if prompt.startswith('[*'):
|
||||
conn.exec_command('clear configuration candidate')
|
||||
conn.exec_command('return')
|
||||
out = conn.get_prompt()
|
||||
prompt = to_text(out, errors='surrogate_then_replace').strip()
|
||||
|
||||
result = super(ActionModule, self).run(task_vars=task_vars)
|
||||
return result
|
||||
|
||||
Reference in New Issue
Block a user