sebastien/cuisine — Issue #53: file_write broken because of file_attribs understanding of 'mode'?
Author: swaroopch
Created: 2012-02-14 21:09:28+00:00
State: open

I have this in my `fabfile.py`:

def locale():
## To prevent http://stackoverflow.com/a/2527192 error
cuisine.file_write("/etc/default/locale", content='''
LC_ALL="en_US.UTF-8"
LANG="en_US.UTF-8"
LANGUAGE="en_US.UTF-8"
'''.strip(), mode=cuisine.MODE_SUDO)

I ran `fab -H blah locale` and got this:

[blah] Executing task 'locale'
[blah] run: test -e "/etc/default/locale" && echo OK ; true
[blah] out: OK

[blah] run: sha256sum "/etc/default/locale" | cut -d" " -f1
[blah] out: b4e86a4b1f37b4dc73efc0dbef28656c8ebca5a503c41010c806b9cf997a53b7

[blah] run: sha256sum "/etc/default/locale" | cut -d" " -f1
[blah] out: b4e86a4b1f37b4dc73efc0dbef28656c8ebca5a503c41010c806b9cf997a53b7

[blah] run: chmod sudo "/etc/default/locale"
[blah] out: chmod: invalid mode: `sudo'
[blah] out: Try `chmod --help' for more information.

Fatal error: run() encountered an error (return code 1) while executing 'chmod sudo "/etc/default/locale"'
Aborting.
Disconnecting from blah... done.

I'm assuming this has to do with `file_write` calling `file_attribs()`?