add executable option to subversion module

reviewable/pr18780/r1
Skylar Saveland 11 years ago
parent bb4619e716
commit d7e5fcf30f

@ -63,6 +63,13 @@ options:
- --password parameter passed to svn. - --password parameter passed to svn.
required: false required: false
default: null default: null
executable:
required: false
default: null
version_added: "1.4"
description:
- Path to svn executable to use. If not supplied,
the normal mechanism for resolving binary paths will be used.
''' '''
EXAMPLES = ''' EXAMPLES = '''
@ -71,19 +78,27 @@ EXAMPLES = '''
''' '''
import re import re
import tempfile
class Subversion(object): class Subversion(object):
def __init__(self, module, dest, repo, revision, username, password): def __init__(
self, module, dest, repo, revision, username, password, svn_path):
self.module = module self.module = module
self.dest = dest self.dest = dest
self.repo = repo self.repo = repo
self.revision = revision self.revision = revision
self.username = username self.username = username
self.password = password self.password = password
self.svn_path = svn_path
def _exec(self, args): def _exec(self, args):
bits = ["svn --non-interactive --trust-server-cert --no-auth-cache", ] bits = [
self.svn_path,
'--non-interactive',
'--trust-server-cert',
'--no-auth-cache',
]
if self.username: if self.username:
bits.append("--username '%s'" % self.username) bits.append("--username '%s'" % self.username)
if self.password: if self.password:
@ -147,6 +162,7 @@ def main():
force=dict(default='yes', type='bool'), force=dict(default='yes', type='bool'),
username=dict(required=False), username=dict(required=False),
password=dict(required=False), password=dict(required=False),
executable=dict(default=None),
), ),
supports_check_mode=True supports_check_mode=True
) )
@ -157,8 +173,9 @@ def main():
force = module.params['force'] force = module.params['force']
username = module.params['username'] username = module.params['username']
password = module.params['password'] password = module.params['password']
svn_path = module.params['executable'] or module.get_bin_path('svn', True)
svn = Subversion(module, dest, repo, revision, username, password) svn = Subversion(module, dest, repo, revision, username, password, svn_path)
if not os.path.exists(dest): if not os.path.exists(dest):
before = None before = None

Loading…
Cancel
Save