Merge pull request #2651 from bclermont/fix-cwd-tar

add current working directory argument, to allow to extract tarball elsewhere than $HOME
This commit is contained in:
Thomas S Hatch 2012-11-21 09:08:18 -08:00
commit 2043c1c33f

View File

@ -15,7 +15,7 @@ def __virtual__():
return 'archive'
def tar(options, tarfile, *sources):
def tar(options, tarfile, cwd=None, *sources):
'''
Uses the tar command to pack, unpack, etc tar files
@ -25,7 +25,7 @@ def tar(options, tarfile, *sources):
'''
sourcefiles = ' '.join(sources)
cmd = 'tar -{0} {1} {2}'.format(options, tarfile, sourcefiles)
out = __salt__['cmd.run'](cmd).splitlines()
out = __salt__['cmd.run'](cmd, cwd).splitlines()
return out