fab-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Fab-user] Defining global functions available outside project scope


From: Nick Sergeant
Subject: Re: [Fab-user] Defining global functions available outside project scope?
Date: Thu, 6 Nov 2008 11:55:24 -0500

Actually, looks like I spoke too soon.  The functions in my global definitions are included fine, but do not inherit the fab-specific methods, such as 'local', 'run', etc.  Here's what my file structure looks like:

~/fabric-global/fabric_global.py

(~/fabric-global is on PYTHONPATH)

fabric_global.py:

def hello():
"Print hello"
local("echo hello")

My fabfile.py:

from fabric_global import *

set(fab_user = 'admin')
...

Though when running 'fab hello', I get:

NameError: global name 'local' is not defined.

Sorry for the noob problem!

Nick Sergeant
(315) 719-2047

On Nov 6, 2008, at 11:49 AM, Nick Sergeant wrote:

Never mind, all set.  Not being a Python expert, had to keep poking around.  My solution was to simply create a Python module defining my base functions, and simply import the module in my fabfile.

Nick Sergeant
(315) 719-2047

On Nov 6, 2008, at 11:18 AM, Nick Sergeant wrote:

We have a lot of projects that we'd like to integrate with fab, specifically for deploying the project with SVN and dumping the production database into our workstations.

This would require us to create fabfiles for each project.  However, we would like to specify default functions for deploying and database dumping in a separate, project-agnostic location, and specify only project settings such as mysql connection credentials in each project's fabfile.

What's the best way to do this?

Nick Sergeant
(315) 719-2047

_______________________________________________
Fab-user mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/fab-user

_______________________________________________
Fab-user mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/fab-user


reply via email to

[Prev in Thread] Current Thread [Next in Thread]