I also tried to use 'upload_template()', but got errors as following. -- Code --- from fabric.api import * from fabric.contrib import * ... upload_template('put_test.txt', "%s/" % env.remote_app_dir, None, False, None, True) -- error ---- Traceback (most recent call last): File "C:\Python26\lib\site-packages\fabric-0.9.1-py2.6.egg\fabric\main.py", li ne 435, in main commands[name](*args, **kwargs) File "E:\pbi\fabric\test\fabfile.py", line 47, in deploy upload_template('put_test.txt', "%s/" % env.remote_app_dir, None, False, Non e, True) NameError: global name 'upload_template' is not defined If I used 'fabric.contrib.files.upload_template()', I got NameError on 'fabric' as below. Traceback (most recent call last): File "C:\Python26\lib\site-packages\fabric-0.9.1-py2.6.egg\fabric\main.py", li ne 435, in main commands[name](*args, **kwargs) File "E:\pbi\fabric\test\fabfile.py", line 47, in deploy fabric.contrib.files.upload_template('put_test.txt', "%s/" % env.remote_app_ dir, None, False, None, True) NameError: global name 'fabric' is not defined
Can you see what's wrong with the code? Thanks --- On Sun, 8/15/10, Jeff Forcier <j...@bitprophet.org> wrote: From: Jeff Forcier <j...@bitprophet.org> Subject: Re: [Fab-user] First Fabric connected but got 'Permission denied' error To: "Peter Bee" <yb...@yahoo.com> Cc: fab-user@nongnu.org Date: Sunday, August 15, 2010, 5:42 AM On Sun, Aug 15, 2010 at 12:48 AM, Peter Bee <yb...@yahoo.com> wrote: > > I used my account credentials in the fabric file. Using the credentials, I > can log on and do almost all the operations (wget, mkdir, create file, cp, > and so on) without 'sudo'. Try printing out env.host_string immediately before your put() call, and see what its value is. If your env.user isn't the same as your local account name, then you should see "<the value you put in env.user>@<the IP address in your hosts list>". If you only see the IP address, then it may be that it's connecting with your local user's username, which (if it exists on the remote end as a legit user) might not have the right permissions. This is a long shot but something to check anyways. > What special rights does 'put' require? Also, how can I use 'sudo' on the > remote system in the fabric file? For example, what's the code for 'put' with > a 'sudo'? Right now put() can't do sudo things, but there's a contrib method that can be used as a workaround until we upgrade put(): fabric.contrib.files.upload_template(). It has a "use_sudo" Boolean kwarg. Check the API docs for details. -Jeff > > --- On Sat, 8/14/10, Jeff Forcier <j...@bitprophet.org> wrote: > > From: Jeff Forcier <j...@bitprophet.org> > Subject: Re: [Fab-user] First Fabric connected but got 'Permission denied' > error > To: "Peter Bee" <yb...@yahoo.com> > Cc: fab-user@nongnu.org > Date: Saturday, August 14, 2010, 5:44 AM > > Hi Peter, > > On Sat, Aug 14, 2010 at 4:04 AM, Peter Bee <yb...@yahoo.com> wrote: > > > Underlying exception message: > > Permission denied > > This usually means exactly what it says: the user you're connecting as > does not have permission to write files to the destination directory > you specified. You'll want to double check that on the remote server > to see what's up. > > Best, > Jeff > > > -- > Jeff Forcier > Unix sysadmin; Python/Ruby developer > http://bitprophet.org > -- Jeff Forcier Unix sysadmin; Python/Ruby developer http://bitprophet.org
_______________________________________________ Fab-user mailing list Fab-user@nongnu.org http://lists.nongnu.org/mailman/listinfo/fab-user