5858LOG = logging .getLogger (__name__ )
5959
6060
61+ def get_remote_name (spec ):
62+ """
63+ Return the value to use for the "remote_name" parameter.
64+ """
65+ if spec .mitogen_mask_remote_name ():
66+ return 'ansible'
67+ return None
68+
69+
6170def optional_int (value ):
6271 """
6372 Convert `value` to an integer if it is not :data:`None`, otherwise return
@@ -135,6 +144,7 @@ def _connect_ssh(spec):
135144 'connect_timeout' : spec .ansible_ssh_timeout (),
136145 'ssh_args' : spec .ssh_args (),
137146 'ssh_debug_level' : spec .mitogen_ssh_debug_level (),
147+ 'remote_name' : get_remote_name (spec ),
138148 }
139149 }
140150
@@ -150,6 +160,7 @@ def _connect_docker(spec):
150160 'container' : spec .remote_addr (),
151161 'python_path' : spec .python_path (),
152162 'connect_timeout' : spec .ansible_ssh_timeout () or spec .timeout (),
163+ 'remote_name' : get_remote_name (spec ),
153164 }
154165 }
155166
@@ -166,6 +177,7 @@ def _connect_kubectl(spec):
166177 'connect_timeout' : spec .ansible_ssh_timeout () or spec .timeout (),
167178 'kubectl_path' : spec .mitogen_kubectl_path (),
168179 'kubectl_args' : spec .extra_args (),
180+ 'remote_name' : get_remote_name (spec ),
169181 }
170182 }
171183
@@ -181,6 +193,7 @@ def _connect_jail(spec):
181193 'container' : spec .remote_addr (),
182194 'python_path' : spec .python_path (),
183195 'connect_timeout' : spec .ansible_ssh_timeout () or spec .timeout (),
196+ 'remote_name' : get_remote_name (spec ),
184197 }
185198 }
186199
@@ -196,6 +209,7 @@ def _connect_lxc(spec):
196209 'python_path' : spec .python_path (),
197210 'lxc_attach_path' : spec .mitogen_lxc_attach_path (),
198211 'connect_timeout' : spec .ansible_ssh_timeout () or spec .timeout (),
212+ 'remote_name' : get_remote_name (spec ),
199213 }
200214 }
201215
@@ -211,6 +225,7 @@ def _connect_lxd(spec):
211225 'python_path' : spec .python_path (),
212226 'lxc_path' : spec .mitogen_lxc_path (),
213227 'connect_timeout' : spec .ansible_ssh_timeout () or spec .timeout (),
228+ 'remote_name' : get_remote_name (spec ),
214229 }
215230 }
216231
@@ -254,6 +269,7 @@ def _connect_su(spec):
254269 'python_path' : spec .python_path (),
255270 'su_path' : spec .become_exe (),
256271 'connect_timeout' : spec .timeout (),
272+ 'remote_name' : get_remote_name (spec ),
257273 }
258274 }
259275
@@ -272,6 +288,7 @@ def _connect_sudo(spec):
272288 'sudo_path' : spec .become_exe (),
273289 'connect_timeout' : spec .timeout (),
274290 'sudo_args' : spec .sudo_args (),
291+ 'remote_name' : get_remote_name (spec ),
275292 }
276293 }
277294
@@ -289,6 +306,7 @@ def _connect_doas(spec):
289306 'python_path' : spec .python_path (),
290307 'doas_path' : spec .become_exe (),
291308 'connect_timeout' : spec .timeout (),
309+ 'remote_name' : get_remote_name (spec ),
292310 }
293311 }
294312
@@ -305,6 +323,7 @@ def _connect_mitogen_su(spec):
305323 'python_path' : spec .python_path (),
306324 'su_path' : spec .become_exe (),
307325 'connect_timeout' : spec .timeout (),
326+ 'remote_name' : get_remote_name (spec ),
308327 }
309328 }
310329
@@ -322,6 +341,7 @@ def _connect_mitogen_sudo(spec):
322341 'sudo_path' : spec .become_exe (),
323342 'connect_timeout' : spec .timeout (),
324343 'sudo_args' : spec .sudo_args (),
344+ 'remote_name' : get_remote_name (spec ),
325345 }
326346 }
327347
@@ -338,6 +358,7 @@ def _connect_mitogen_doas(spec):
338358 'python_path' : spec .python_path (),
339359 'doas_path' : spec .become_exe (),
340360 'connect_timeout' : spec .timeout (),
361+ 'remote_name' : get_remote_name (spec ),
341362 }
342363 }
343364
0 commit comments