Skip to content
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

Fetch fails with "AttributeError: 'ShellModule' object has no attribute 'tmpdir'" #716

Closed
ari75 opened this issue May 14, 2020 · 2 comments · Fixed by #717
Closed

Fetch fails with "AttributeError: 'ShellModule' object has no attribute 'tmpdir'" #716

ari75 opened this issue May 14, 2020 · 2 comments · Fixed by #717

Comments

@ari75
Copy link

ari75 commented May 14, 2020

Hello,

I get an error when running a simple fetch command using mitogen.

My environment is:

Cent OS 7
Ansible 2.4.2.0
Mitogen 0.2.9
Python (host and target) 2.7.5
Strategy mitogen_linear

The following snippet can be used to reproduce the issue:

- name: T00.00 Prepare file
  lineinfile:
    path: "/tmp/fileC"
    line: "test"
    create: yes

- name: T00.01 Fetch file
  fetch:
    src: "/tmp/fileC"
    dest: "/tmp/fileC"

My ansible configuration is:

[ssh_connection] 
# ssh_args = -o ControlMaster=no
ssh_args=-C -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s
# speedup running of playbook
pipelining = True

[defaults]
callback_whitelist = profile_tasks, profile_roles
# Keep it to allow switching strategy if needed
strategy_plugins = strategy_plugins/mitogen-0.2.9/ansible_mitogen/plugins/strategy
strategy = mitogen_linear
forks = 30

The error is:

ASK [test : T00.01 Fetch file] ********************************************************************************************************************************************************************************************************
Thursday 14 May 2020  16:52:35 +0000 (0:00:00.097)       0:00:01.494 ********** 
Thursday 14 May 2020  16:52:35 +0000 (0:00:00.097)       0:00:01.492 ********** 
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: AttributeError: 'ShellModule' object has no attribute 'tmpdir'
fatal: [d-instance-1.local]: FAILED! => {"msg": "Unexpected failure during module execution.", "stdout": ""}
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: AttributeError: 'ShellModule' object has no attribute 'tmpdir'
fatal: [d-instance-2.local]: FAILED! => {"msg": "Unexpected failure during module execution.", "stdout": ""}

Full logs with -vvv can be found here:
https://we.tl/t-rjfghK7Gpx

It seems to fail when attempting cleaning up after the copy (mitogen_fetch.py", line 160):

The full traceback is:
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/ansible/executor/task_executor.py", line 130, in run
    res = self._execute()
  File "/usr/lib/python2.7/site-packages/ansible/executor/task_executor.py", line 528, in _execute
    result = self._handler.run(task_vars=variables)
  File "/vagrant/src/main/configuration/strategy_plugins/mitogen-0.2.9/ansible_mitogen/mixins.py", line 121, in run
    return super(ActionModuleMixin, self).run(tmp, task_vars)
  File "/vagrant/src/main/configuration/strategy_plugins/mitogen-0.2.9/ansible_mitogen/plugins/action/mitogen_fetch.py", line 160, in run
    self._remove_tmp_path(self._connection._shell.tmpdir)
AttributeError: 'ShellModule' object has no attribute 'tmpdir'

fatal: [d-instance-2.local]: FAILED! => {
    "msg": "Unexpected failure during module execution.", 
    "stdout": ""
}

Thanks for your help!

@s1113950
Copy link
Collaborator

Thanks for the issue! Looks like it should be a relatively simple fix; I'll take a crack at it now

@ari75
Copy link
Author

ari75 commented May 17, 2020

Super, thanks a lot for the fix! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants