fabric

Sharing a fabfile across multiple projects

Fabric has become my deployment tool of choice both for deploying Django projects and for initially configuring Ubuntu slices. However, my current workflow with Fabric isn't very DRY, as I find myself: copying the fabfile.py from one Django project to another and modifying the fabfile.py as needed for each project (e.g., changing the w...

fabric and svn password

Assuming that I cannot run something like this with Fabric: run("svn update --password 'password' .") how's the proper way to pass to Fabric the password for the remote interactive command line? The problem is that the repo is checked out as svn+ssh and I don't have a http/https/svn option ...

Activate a python virtual environment using activate_this.py in a fabfile on Windows

I have a Fabric task that needs to access the settings of my Django project. On Windows, I'm unable to install Fabric into the project's virtualenv (issues with Paramiko + pycrypto deps). However, I am able to install Fabric in my system-wide site-packages, no problem. I have installed Django into the project's virtualenv and I am able...

Python Fabric: How to handle arbitrary remote shell prompt for input?

This is related to this question here, but with a slight twist: instead of just passing 'yes' or 'no', I need Fabric to pass an arbitrary string to the remote shell. For instance, if the remote shell prompts for 'what is your name?' then I need to feed it 'first,last'. Clarification: I know I said arbitrary input, but I was really tryi...

Python Fabric error

I'm running fabric (Django deployment to apache) and everything seems to work fine until I get to the task for installing the site: def install_site(): "Add the virtualhost file to apache" require('release', provided_by=[deploy, setup]) sudo('cd %(path)/releases/%(release)/%(release); cp %(project_name)/%(virtualhost_path)/%...

How do I create a postgresql user with fabric

I want to create a database user for my setup fabric script but createuser has interactive password entering and seams not to like fabric. ...

Why does Fabric display the disconnect from server message for almost 2 minutes?

Fabric displays Disconnecting from username@server... done. for almost 2 minutes prior to showing a new command prompt whenever I issue a fab command. This problem exists when using Fabric commands issued to both an internal server and a Rackspace cloud server. Below I've included the auth.log from the server, and I didn't see anything ...

Where to store deployment scripts

Assuming that I have the following directory structure for a Python project: config/ scripts/ src/ where should a fabric deployment script should go? I assume that it should be in scripts, obviously, but for me it seems more appropriate to store in scripts, the actual code that fires up the project. ...

Fabfile with support for sqlalchemy-migrate deployments?

I have database migrations (with sqlalchemy-migrate) working well in my dev environment. However, I'm a little stumped about how to integrate this into my deployment process. I'd like to use fabric to execute the manage.py file on the remote server but I'm not sure what to use for the repository value in this file. Referring to both 'ap...

The anatomy of a Python web project: development, packaging, deployment

Hi, I'm new to Python (from Java+Ant) and was wondering if someone could detail how to best use Fabric+Pip+Virtualenv to set up a Python web application package skeleton. The end goal is to be able to do any of the following with a single command: Set up a development environment on a fresh dev box (installing all deps) Run all tests...

deployment public keys

How do you guys deploy your code on your servers? I am using Fabric and Python and I would like a more automated way of pulling code from the repository through the use of public keys, but without any ops or manual intervention to set up the public keys. Are you storing them in the code as text or in a database and generate the pk file ...

Fabfiles With Command Line Arguments

Is there a clean way to have your fabfile take command line arguments? I'm writing an installation script for a tool that I want to be able to specify an optional target directory via the command line. I wrote some code to test what would happen if I passed in some command line arguments: # fabfile.py import sys def install(): _g...

fabric deploy problem

Hi, I'm trying to deploy a django app with fabric and get the following error: Alexs-MacBook:fabric alex$ fab config:instance=peergw deploy -H <ip> - u <username> -p <password> [192.168.2.93] run: cat /etc/issue Traceback (most recent call last): File "build/bdist.macosx-10.6-universal/egg/fabric/main.py", line 419, in mai...

How to clone a mercurial repository over an ssh connection initiated by fabric when http authorization is required?

I'm attempting to use fabric for the first time and I really like it so far, but at a certain point in my deployment script I want to clone a mercurial repository. When I get to that point I get an error: err: abort: http authorization required My repository requires http authorization and fabric doesn't prompt me for the user and ...

ImportError: cannot import name output

iam using fabric 0.9.1 version on windows to do some deployment related stuff. But the moment iam about to run "fab hello" iam facing the following error D:\pythonscripts>fab hello Traceback (most recent call last): File "C:\Python26\Scripts\fab-script.py", line 8, in <module> load_entry_point('fabric==0.9.1', 'console_scripts',...

Python's Fabric: Connect to a host listed .ssh/config

I'm having trouble with Fabric not recognizing hosts that I have in .ssh/config. My fabfile.py is as follows: from fabric.api import * env.hosts = ['lulu'] def whoami(): run('whoami') Running $ fab whoami gives: [lulu] run: whoami Fatal error: Name lookup failed for lulu The name lulu is in my ~/.ssh/config, like t...

Change Unix password from command line over Python/Fabric

I would like a way to update my password on a remote Ubuntu 10.4 box with fabric. I would expect my fabfile.py would look something like this: def update_password(old_pw, new_pw): # Connects over ssh with a public key authentication run("some_passwd_cmd --old %s --new %s" % (old_pw, new_pd)) Unfortunately the only command I k...

How to discover current role in Python Fabric

Hi This is a very Fabric specific question, but more experienced python hackers might be able to answer this, even if they don't know Fabric. I am trying to specify different behaviour in a command depending on which role it is running for, i.e.: def restart(): if (SERVERTYPE == "APACHE"): sudo("apache2ctl graceful",pty=Tr...

Command is getting hanged on execution via fabric

When i am running the below command on one of the remote machine via fabric it is getting hanged. def execute_lmo_scripts(): print "preparing to execute lmo scripts................" output = run("sudo suwww ; ") # or this command sudo("suwww",shell=False) If i manually run the command on the remote server it is being exe...

Emulate SSH sever for testing purposes

I have to write test for deployment script which uploads files through SSH, but I'd like to have it not depending on external servers configuration. This is how i see it: Create 2 SSH daemons without authenication on different ports of loopback interface. Run the deployment script on these two ports The only question is how to run th...