Ignore hostname directives when using overrides
This commit is contained in:
parent
52da68876d
commit
9b0bd81661
@ -61,7 +61,7 @@ Additionally, you can pass config options on the command line:
|
||||
The :code:`--kitten` argument can be specified multiple times, with directives
|
||||
from :file:`ssh.conf`. These are merged with :file:`ssh.conf` as if they were
|
||||
appended to the end of that file. They apply only to the host being SSHed to
|
||||
by this invocation.
|
||||
by this invocation, so any :opt:`hostname` directives are ignored.
|
||||
|
||||
.. note::
|
||||
|
||||
|
||||
@ -552,7 +552,9 @@ def run_ssh(ssh_args: List[str], server_args: List[str], found_extra_args: Tuple
|
||||
pat = re.compile(r'^([a-zA-Z0-9_]+)[ \t]*=')
|
||||
for i, a in enumerate(found_extra_args):
|
||||
if i % 2 == 1:
|
||||
overrides.append(pat.sub(r'\1 ', a.lstrip()))
|
||||
aq = pat.sub(r'\1 ', a.lstrip())
|
||||
if aq.split(maxsplit=1)[0] != 'hostname':
|
||||
overrides.append(aq)
|
||||
if overrides:
|
||||
overrides.insert(0, f'hostname {uname}@{hostname_for_match}')
|
||||
so = init_config(overrides)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user