fexpect icon indicating copy to clipboard operation
fexpect copied to clipboard

Fexpect breaks fabric

Open keshavagrawal89 opened this issue 11 years ago • 1 comments

I don't know if its happening only with me or anybody else is also facing the same issue.

The moment I import this package

from ilogue.fexpect import expect, expecting, run

in my fabfile the script stops running with the following error:

Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/fabric/main.py", line 743, in main *args, **kwargs File "/usr/local/lib/python2.7/dist-packages/fabric/tasks.py", line 368, in execute multiprocessing File "/usr/local/lib/python2.7/dist-packages/fabric/tasks.py", line 264, in _execute return task.run(*args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/fabric/tasks.py", line 171, in run return self.wrapped(*args, **kwargs) File "/etc/puppet/fabfile.py", line 165, in edit_sudoers run('echo "Current Permission of the file /etc/sudoers - "stat -c "%a %n" /etc/sudoers') File "/usr/local/lib/python2.7/dist-packages/ilogue/fexpect/api.py", line 15, in run wrappedCmd = wrapExpectations(cmd) File "/usr/local/lib/python2.7/dist-packages/ilogue/fexpect/internals.py", line 15, in wrapExpectations script = createScript(cmd) File "/usr/local/lib/python2.7/dist-packages/ilogue/fexpect/internals.py", line 39, in createScript for e in fabric.state.env.expectations: File "/usr/local/lib/python2.7/dist-packages/fabric/utils.py", line 184, in getattr raise AttributeError(key) AttributeError: expectations

Versions used: fexpect==0.2.post7 Fabric==1.8.0

keshavagrawal89 avatar Dec 02 '13 13:12 keshavagrawal89

That import statement overrides the regular fabric keywords such as run(). If you have not previously specified any expectations, the fexpect-wrapped run() cannot find them. You could change the import statement to something like:

from ilogue.fexpect import erun

This way the two versions do not get confused

JasperVanDenBosch avatar Mar 12 '14 23:03 JasperVanDenBosch