Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Oct 25, 2023
1 parent e7dd539 commit 060d618
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
20 changes: 20 additions & 0 deletions docs/ansible.netcommon.network_cli_connection.rst
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,26 @@ Parameters
<div>The answer to reply with if the <code>terminal_initial_prompt</code> is matched. The value can be a single answer or a list of answers for multiple terminal_initial_prompt. In case the login menu has multiple prompts the sequence of the prompt and excepted answer should be in same order and the value of <em>terminal_prompt_checkall</em> should be set to <em>True</em> if all the values in <code>terminal_initial_prompt</code> are expected to be matched and set to <em>False</em> if any one login prompt is to be matched.</div>
</td>
</tr>
<tr>
<td colspan="1">
<div class="ansibleOptionAnchor" id="parameter-"></div>
<b>terminal_initial_newline</b>
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
<div style="font-size: small">
<span style="color: purple">boolean</span>
</div>
</td>
<td>
<b>Default:</b><br/><div style="color: blue">"no"</div>
</td>
<td>
<div>var: ansible_terminal_inital_newline</div>
</td>
<td>
<div>This boolean flag, that when set to <em>True</em> will send newline on initial connection establishment to the remote device.</div>
<div>This can be useful for equipment which does not send an initial header until it receives some input, like Serial-to-SSH multiplexer hardware.</div>
</td>
</tr>
<tr>
<td colspan="1">
<div class="ansibleOptionAnchor" id="parameter-"></div>
Expand Down
9 changes: 3 additions & 6 deletions plugins/connection/network_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,8 @@ def _connect(self):
)

terminal_initial_newline = (
self.get_option("terminal_initial_newline") or self._terminal.terminal_initial_newline
self.get_option("terminal_initial_newline")
or self._terminal.terminal_initial_newline
)

terminal_initial_prompt = (
Expand All @@ -683,11 +684,7 @@ def _connect(self):
check_all = self.get_option("terminal_initial_prompt_checkall") or False

if terminal_initial_newline:
self.send(
command=b"",
sendonly=True,
newline=True
)
self.send(command=b"", sendonly=True, newline=True)

self.receive(
prompts=terminal_initial_prompt,
Expand Down

0 comments on commit 060d618

Please sign in to comment.