[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Fab-user] setting variable value using local/subprocess
From: |
Shantanu Pavgi |
Subject: |
Re: [Fab-user] setting variable value using local/subprocess |
Date: |
Mon, 22 Aug 2011 14:39:29 -0500 |
On Aug 22, 2011, at 2:01 PM, Shantanu Pavgi wrote:
>
> I am writing a task where output of local wrapper needs to be assigned to a
> variable so that it can be used later in another command. Following is a task
> where commit_sha1 is obtained from git command and then used in tar command:
>
> {{{
> # Create project-commit-id.tar.gz for the project
> def make_tar():
> """Create tar.gz archive with latest commit id"""
> with lcd('%s/%s' %(env.builddir,env.projectrepo)):
> commit_sha1 = local('git log -1 --pretty=format:%H')
> with lcd('%s' %(env.builddir)):
> local('tar cvzf %s-%s.tar.gz %s'
> %(env.projectrepo,commit_sha1,env.projectrepo))
> }}}
>
> It seems like 'commit_sha1' variable is not getting set at all. I am using
> Fabric 1.2.0.
>
> Am I missing anything here? Any help?
>
>
It's working now with 'capture=True' option in local wrapper.
--
Shantanu.