Hi All,
I started trying out Fabric just recently and got stuck with Fabric's sed
command. The scenario goes like this: I create a django project in a remote
machine and I alter some setting in the settings.py file(remotely using
Fabric). In this regard I wanted to use Fabric's sed. Here goes the code
INSTANCE_PARENT_DIRECTORY = '/home/madhavbnk/webapps/django'
INSTANCE_FOLDER_NAME = 'myproject'
PROJECT_BOOTSTRAP_SCRIPT = INSTANCE_PARENT_DIRECTORY + '/' +
'lib/python2.5/django/bin/django-admin.py'
with cd(INSTANCE_PARENT_DIRECTORY):
run("%s startproject %s" % (PROJECT_BOOTSTRAP_SCRIPT,
INSTANCE_FOLDER_NAME))
with cd(INSTANCE_FOLDER_NAME):
from fabric.contrib.files import sed
sed("settings.py", '[email protected]', '[email protected]
',backup='.backup')
And the error which I get after running this command is:
*sed: can't read settings.py: No such file or directory*
*Warning: run() encountered an error (return code 2) while executing 'sed
-i.backup -r -e 's/[email protected]/[email protected]/g' settings.py'*
*
*
*Supposedly, the second "with cd()" should set the context of current
working directory and let sed handle the paths corrrectly(relative paths).
But its not doing it. It will work if I give the absolute path, which I want
to avoid in every step. And infact if I have a command like run("ls") inside
the "inner with cd()" , its still listing the settings.py file, still sed is
not able to find that.*
*
*
*Please let me know what I am missing and how do I fix this.
*
Note:This is my first post to the list. Please be kind if I am doing
anything wrong.
Regards,
Nandakishore
_______________________________________________
Fab-user mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/fab-user