New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError for remote_name when using Windows AD account with the form 'DOMAIN\username' #344

Closed
atoom opened this Issue Aug 16, 2018 · 2 comments

Comments

Projects
None yet
2 participants
@atoom

atoom commented Aug 16, 2018

Hi,

First of all - thanks for a great project!

We are running a mixed environment with both Linux and Windows and the user management is centralized in the Windows AD. In the production environment we have to include the domain together with the username for the authentication to work properly, for example:

ssh 'DOMAIN\user'@host

OR

ssh user@DOMAIN@host

However this results in the following exception when running Ansible together with Mitogen:

The full traceback is:
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/ansible/executor/task_executor.py", line 138, in run
    res = self._execute()
  File "/usr/lib/python2.7/site-packages/ansible/executor/task_executor.py", line 576, in _execute
    result = self._handler.run(task_vars=variables)
  File "/usr/lib/python2.7/site-packages/ansible_mitogen/mixins.py", line 115, in run
    return super(ActionModuleMixin, self).run(tmp, task_vars)
  File "/usr/lib/python2.7/site-packages/ansible/plugins/action/shell.py", line 27, in run
    result = command_action.run(task_vars=task_vars)
  File "/usr/lib/python2.7/site-packages/ansible_mitogen/mixins.py", line 115, in run
    return super(ActionModuleMixin, self).run(tmp, task_vars)
  File "/usr/lib/python2.7/site-packages/ansible/plugins/action/command.py", line 24, in run
    results = merge_hash(results, self._execute_module(task_vars=task_vars, wrap_async=wrap_async))
  File "/usr/lib/python2.7/site-packages/ansible_mitogen/mixins.py", line 334, in _execute_module
    self._connection._connect()
  File "/usr/lib/python2.7/site-packages/ansible_mitogen/connection.py", line 527, in _connect
    stack=mitogen.utils.cast(list(stack)),
  File "/usr/lib/python2.7/site-packages/mitogen/core.py", line 1126, in call_service
    return recv.get().unpickle()
  File "/usr/lib/python2.7/site-packages/mitogen/core.py", line 487, in unpickle
    raise obj
CallError: exceptions.ValueError: remote_name= cannot contain slashes
  File "<stdin>", line 2049, in _dispatch_calls
  File "<stdin>", line 2041, in _dispatch_one
  File "master:/usr/lib/python2.7/site-packages/ansible_mitogen/target.py", line 233, in init_child
    _fork_parent = econtext.router.fork()
  File "master:/usr/lib/python2.7/site-packages/mitogen/parent.py", line 1280, in fork
    return self.connect(u'fork', **kwargs)
  File "master:/usr/lib/python2.7/site-packages/mitogen/parent.py", line 1256, in connect
    return self._connect(klass, name=name, **kwargs)
  File "master:/usr/lib/python2.7/site-packages/mitogen/parent.py", line 1235, in _connect
    stream = klass(self, context_id, **kwargs)
  File "master:/usr/lib/python2.7/site-packages/mitogen/parent.py", line 750, in __init__
    super(Stream, self).__init__(*args, **kwargs)
  File "<stdin>", line 951, in __init__
  File "master:/usr/lib/python2.7/site-packages/mitogen/fork.py", line 107, in construct
    unidirectional=False)
  File "master:/usr/lib/python2.7/site-packages/mitogen/parent.py", line 771, in construct
    raise ValueError('remote_name= cannot contain slashes')

Running Ansible without Mitogen works as expected.

Ansible version: 2.6.1
Mitogen version: 0.2.2
Host OS: CentOS 7.5
Host Python: 2.7.5
Target OS: RHEL 7.5
Target Pyton: 2.7.5

dw added a commit that referenced this issue Aug 17, 2018

parent: don't generate illegal default remote names.
getpass.getuser() output may contain slashes, which must be avoided as
they break virtualenv when present in argv[0].

Closes #344.
@dw

This comment has been minimized.

Owner

dw commented Aug 17, 2018

Hi there,

A fix for this is on dmw branch and will reach master hopefully over the coming weekend. For now, please feel free to install from https://github.com/dw/mitogen/archive/dmw.zip. Thanks for reporting this!

@atoom

This comment has been minimized.

atoom commented Aug 17, 2018

Hi,

I have tested the code in the dmw branch and can confirm that it is working - thanks for the quick fix!

@atoom atoom closed this Aug 17, 2018

dw added a commit that referenced this issue Aug 18, 2018

parent: don't generate illegal default remote names.
getpass.getuser() output may contain slashes, which must be avoided as
they break virtualenv when present in argv[0].

Closes #344.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment