Fabric is giving me an EOFError when I try to chown a directory. It only happens if I run a subprocess from a python script that fabric runs immediately before.
From my fabfile:
...
with settings(warn_only=True):
run('python my_scripts/import_local.py')
sudo('chown www-data:www-data /opt/mm/my_project/uploads -R')
If I comment the lines below out of my_scripts/import_local.py
I get no error:
p = subprocess.Popen(command.split(), stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
result = p.communicate()[0].splitlines()
if result:
print result
With the subprocess lines left in I get this traceback (running with --show=debug):
[xx.xx.xxx.xxx] sudo: sudo -S -p 'sudo password:' /bin/bash -l -c "cd /opt/mm/my_project/current && source environment.sh && chown www-data:www-data /opt/mm/my_project/uploads -R"
Traceback (most recent call last):
File "/Users/jesse.aldridge/.virtualenvs/my_project/lib/python2.6/site-packages/fabric/main.py", line 682, in main
*args, **kwargs
File "/Users/jesse.aldridge/.virtualenvs/my_project/lib/python2.6/site-packages/fabric/tasks.py", line 232, in execute
task.run(*args, **new_kwargs)
File "/Users/jesse.aldridge/.virtualenvs/my_project/lib/python2.6/site-packages/fabric/tasks.py", line 105, in run
return self.wrapped(*args, **kwargs)
File "/Users/jesse.aldridge/Dropbox/my_code/my_project/fabfile.py", line 162, in do_reimport
sudo('chown www-data:www-data /opt/mm/my_project/uploads -R')
File "/Users/jesse.aldridge/.virtualenvs/my_project/lib/python2.6/site-packages/fabric/network.py", line 343, in host_prompting_wrapper
return func(*args, **kwargs)
File "/Users/jesse.aldridge/.virtualenvs/my_project/lib/python2.6/site-packages/fabric/operations.py", line 976, in sudo
user=user)
File "/Users/jesse.aldridge/.virtualenvs/my_project/lib/python2.6/site-packages/fabric/operations.py", line 867, in _run_command
combine_stderr)
File "/Users/jesse.aldridge/.virtualenvs/my_project/lib/python2.6/site-packages/fabric/operations.py", line 753, in _execute
channel.get_pty(width=cols, height=rows)
File "/Users/jesse.aldridge/.virtualenvs/my_project/lib/python2.6/site-packages/ssh/channel.py", line 158, in get_pty
self._wait_for_event()
File "/Users/jesse.aldridge/.virtualenvs/my_project/lib/python2.6/site-packages/ssh/channel.py", line 1084, in _wait_for_event
raise e
EOFError
Disconnecting from xx.xx.xxx.xxx... done.
time.sleep
in between the lines of your fabfile - Jasper van den Bosch 2012-04-22 18:08
What happens when you run:
$ ssh xx.xx.xxx.xxx -t'sudo -S -p "sudo password:" /bin/bash -l -c "cd /opt/mm/my_project/current && source environment.sh && chown www-data:www-data /opt/mm/my_project/uploads -R"'