I'm trying to run one command from another, which seems like a common need, but isn't working the way I expect.
I have one command "release", which I would like to run a few other commands in order, bailing out if any fails. For example, this command might take a version argument, back up a db, update some code and restart some servers:
def release(version):
"Update to a new release."
db_backup()
update(version)
upgrade()
restart()
update is defined like this:
@roles('code')
def update(milestone):
"Updates a milestone release on the servers."
run("cd %s; "
"cd releases/%s ; "
"svn update "
% (env.root_path, milestone))
While update runs fine from the command line, calling it from release causes fabric to ask for a host:
address@hidden server]$ fab -f bin/fabfile.py release:staging
No hosts found. Please specify (single) host string for connection:
Is there a way to call a command from another command that will pay attention to the already defined roles/hosts?
Thanks,
--
Aaron