mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Pass the "password" param to git module functions
This commit is contained in:
parent
7871065d32
commit
91eafddda6
1 changed files with 149 additions and 38 deletions
|
@ -105,7 +105,7 @@ def _get_branch_opts(branch, local_branch, all_local_branches,
|
|||
return ret
|
||||
|
||||
|
||||
def _get_local_rev_and_branch(target, user):
|
||||
def _get_local_rev_and_branch(target, user, password):
|
||||
'''
|
||||
Return the local revision for before/after comparisons
|
||||
'''
|
||||
|
@ -113,6 +113,7 @@ def _get_local_rev_and_branch(target, user):
|
|||
try:
|
||||
local_rev = __salt__['git.revision'](target,
|
||||
user=user,
|
||||
password=password,
|
||||
ignore_retcode=True)
|
||||
except CommandExecutionError:
|
||||
log.info('No local revision for {0}'.format(target))
|
||||
|
@ -122,6 +123,7 @@ def _get_local_rev_and_branch(target, user):
|
|||
try:
|
||||
local_branch = __salt__['git.current_branch'](target,
|
||||
user=user,
|
||||
password=password,
|
||||
ignore_retcode=True)
|
||||
except CommandExecutionError:
|
||||
log.info('No local branch for {0}'.format(target))
|
||||
|
@ -205,6 +207,7 @@ def latest(name,
|
|||
target=None,
|
||||
branch=None,
|
||||
user=None,
|
||||
password=None,
|
||||
update_head=True,
|
||||
force_checkout=False,
|
||||
force_clone=False,
|
||||
|
@ -262,6 +265,12 @@ def latest(name,
|
|||
|
||||
.. versionadded:: 0.17.0
|
||||
|
||||
password
|
||||
Windows only. Required when specifying ``user``. This parameter will be
|
||||
ignored on non-Windows platforms.
|
||||
|
||||
.. versionadded:: 2016.3.4
|
||||
|
||||
update_head : True
|
||||
If set to ``False``, then the remote repository will be fetched (if
|
||||
necessary) to ensure that the commit to which ``rev`` points exists in
|
||||
|
@ -503,6 +512,8 @@ def latest(name,
|
|||
branch = str(branch)
|
||||
if user is not None and not isinstance(user, six.string_types):
|
||||
user = str(user)
|
||||
if password is not None and not isinstance(password, six.string_types):
|
||||
password = str(password)
|
||||
if remote is not None and not isinstance(remote, six.string_types):
|
||||
remote = str(remote)
|
||||
if identity is not None:
|
||||
|
@ -564,7 +575,7 @@ def latest(name,
|
|||
return _fail(ret, ('\'rev\' is not compatible with the \'mirror\' and '
|
||||
'\'bare\' arguments'))
|
||||
|
||||
run_check_cmd_kwargs = {'runas': user}
|
||||
run_check_cmd_kwargs = {'runas': user, 'password': password}
|
||||
if 'shell' in __grains__:
|
||||
run_check_cmd_kwargs['shell'] = __grains__['shell']
|
||||
|
||||
|
@ -588,6 +599,7 @@ def latest(name,
|
|||
heads=False,
|
||||
tags=False,
|
||||
user=user,
|
||||
password=password,
|
||||
identity=identity,
|
||||
https_user=https_user,
|
||||
https_pass=https_pass,
|
||||
|
@ -682,13 +694,18 @@ def latest(name,
|
|||
check = 'refs' if bare else '.git'
|
||||
gitdir = os.path.join(target, check)
|
||||
comments = []
|
||||
if os.path.isdir(gitdir) or __salt__['git.is_worktree'](target):
|
||||
if os.path.isdir(gitdir) or __salt__['git.is_worktree'](target,
|
||||
user=user,
|
||||
password=password):
|
||||
# Target directory is a git repository or git worktree
|
||||
try:
|
||||
all_local_branches = __salt__['git.list_branches'](
|
||||
target, user=user)
|
||||
all_local_tags = __salt__['git.list_tags'](target, user=user)
|
||||
local_rev, local_branch = _get_local_rev_and_branch(target, user)
|
||||
target, user=user, password=password)
|
||||
all_local_tags = __salt__['git.list_tags'](target,
|
||||
user=user,
|
||||
password=password)
|
||||
local_rev, local_branch = \
|
||||
_get_local_rev_and_branch(target, user, password)
|
||||
|
||||
if not bare and remote_rev is None and local_rev is not None:
|
||||
return _fail(
|
||||
|
@ -723,6 +740,7 @@ def latest(name,
|
|||
target,
|
||||
branch + '^{commit}',
|
||||
user=user,
|
||||
password=password,
|
||||
ignore_retcode=True)
|
||||
except CommandExecutionError as exc:
|
||||
return _fail(
|
||||
|
@ -734,12 +752,16 @@ def latest(name,
|
|||
|
||||
remotes = __salt__['git.remotes'](target,
|
||||
user=user,
|
||||
password=password,
|
||||
redact_auth=False)
|
||||
|
||||
revs_match = _revs_equal(local_rev, remote_rev, remote_rev_type)
|
||||
try:
|
||||
local_changes = bool(
|
||||
__salt__['git.diff'](target, 'HEAD', user=user)
|
||||
__salt__['git.diff'](target,
|
||||
'HEAD',
|
||||
user=user,
|
||||
password=password)
|
||||
)
|
||||
except CommandExecutionError:
|
||||
# No need to capture the error and log it, the _git_run()
|
||||
|
@ -767,6 +789,8 @@ def latest(name,
|
|||
__salt__['git.rev_parse'](
|
||||
target,
|
||||
remote_rev + '^{commit}',
|
||||
user=user,
|
||||
password=password,
|
||||
ignore_retcode=True)
|
||||
except CommandExecutionError:
|
||||
# Local checkout doesn't have the remote_rev
|
||||
|
@ -787,6 +811,7 @@ def latest(name,
|
|||
target,
|
||||
desired_upstream,
|
||||
user=user,
|
||||
password=password,
|
||||
ignore_retcode=True)
|
||||
except CommandExecutionError:
|
||||
pass
|
||||
|
@ -806,6 +831,7 @@ def latest(name,
|
|||
target,
|
||||
rev + '^{commit}',
|
||||
user=user,
|
||||
password=password,
|
||||
ignore_retcode=True)
|
||||
except CommandExecutionError:
|
||||
# Shouldn't happen if the tag exists
|
||||
|
@ -875,6 +901,7 @@ def latest(name,
|
|||
refs=[base_rev, remote_rev],
|
||||
is_ancestor=True,
|
||||
user=user,
|
||||
password=password,
|
||||
ignore_retcode=True)
|
||||
|
||||
if fast_forward is False:
|
||||
|
@ -903,6 +930,7 @@ def latest(name,
|
|||
base_branch + '@{upstream}',
|
||||
opts=['--abbrev-ref'],
|
||||
user=user,
|
||||
password=password,
|
||||
ignore_retcode=True)
|
||||
except CommandExecutionError:
|
||||
# There is a local branch but the rev-parse command
|
||||
|
@ -970,6 +998,7 @@ def latest(name,
|
|||
url=name,
|
||||
remote=remote,
|
||||
user=user,
|
||||
password=password,
|
||||
https_user=https_user,
|
||||
https_pass=https_pass)
|
||||
comments.append(
|
||||
|
@ -1121,6 +1150,7 @@ def latest(name,
|
|||
force=force_fetch,
|
||||
refspecs=refspecs,
|
||||
user=user,
|
||||
password=password,
|
||||
identity=identity,
|
||||
saltenv=__env__)
|
||||
except CommandExecutionError as exc:
|
||||
|
@ -1136,6 +1166,8 @@ def latest(name,
|
|||
__salt__['git.rev_parse'](
|
||||
target,
|
||||
remote_rev + '^{commit}',
|
||||
user=user,
|
||||
password=password,
|
||||
ignore_retcode=True)
|
||||
except CommandExecutionError as exc:
|
||||
return _fail(
|
||||
|
@ -1167,7 +1199,8 @@ def latest(name,
|
|||
target,
|
||||
refs=[base_rev, remote_rev],
|
||||
is_ancestor=True,
|
||||
user=user)
|
||||
user=user,
|
||||
password=password)
|
||||
|
||||
if fast_forward is False and not force_reset:
|
||||
return _not_fast_forward(
|
||||
|
@ -1207,7 +1240,8 @@ def latest(name,
|
|||
checkout_rev,
|
||||
force=force_checkout,
|
||||
opts=checkout_opts,
|
||||
user=user)
|
||||
user=user,
|
||||
password=password)
|
||||
if '-b' in checkout_opts:
|
||||
comments.append(
|
||||
'New branch \'{0}\' was checked out, with {1} '
|
||||
|
@ -1228,7 +1262,8 @@ def latest(name,
|
|||
__salt__['git.reset'](
|
||||
target,
|
||||
opts=['--hard', remote_rev],
|
||||
user=user
|
||||
user=user,
|
||||
password=password,
|
||||
)
|
||||
ret['changes']['forced update'] = True
|
||||
comments.append(
|
||||
|
@ -1239,7 +1274,8 @@ def latest(name,
|
|||
__salt__['git.branch'](
|
||||
target,
|
||||
opts=branch_opts,
|
||||
user=user)
|
||||
user=user,
|
||||
password=password)
|
||||
comments.append(upstream_action)
|
||||
|
||||
# Fast-forward to the desired revision
|
||||
|
@ -1255,6 +1291,8 @@ def latest(name,
|
|||
if __salt__['git.symbolic_ref'](target,
|
||||
'HEAD',
|
||||
opts=['--quiet'],
|
||||
user=user,
|
||||
password=password,
|
||||
ignore_retcode=True):
|
||||
merge_rev = remote_rev if rev == 'HEAD' \
|
||||
else desired_upstream
|
||||
|
@ -1276,8 +1314,8 @@ def latest(name,
|
|||
target,
|
||||
rev=merge_rev,
|
||||
opts=merge_opts,
|
||||
user=user
|
||||
)
|
||||
user=user,
|
||||
password=password)
|
||||
comments.append(
|
||||
'Repository was fast-forwarded to {0}'
|
||||
.format(remote_loc)
|
||||
|
@ -1295,8 +1333,8 @@ def latest(name,
|
|||
target,
|
||||
opts=['--hard',
|
||||
remote_rev if rev == 'HEAD' else rev],
|
||||
user=user
|
||||
)
|
||||
user=user,
|
||||
password=password)
|
||||
comments.append(
|
||||
'Repository was reset to {0} (fast-forward)'
|
||||
.format(rev)
|
||||
|
@ -1311,6 +1349,7 @@ def latest(name,
|
|||
'update',
|
||||
opts=['--init', '--recursive'],
|
||||
user=user,
|
||||
password=password,
|
||||
identity=identity,
|
||||
saltenv=__env__)
|
||||
except CommandExecutionError as exc:
|
||||
|
@ -1332,6 +1371,7 @@ def latest(name,
|
|||
force=force_fetch,
|
||||
refspecs=refspecs,
|
||||
user=user,
|
||||
password=password,
|
||||
identity=identity,
|
||||
saltenv=__env__)
|
||||
except CommandExecutionError as exc:
|
||||
|
@ -1349,6 +1389,7 @@ def latest(name,
|
|||
new_rev = __salt__['git.revision'](
|
||||
cwd=target,
|
||||
user=user,
|
||||
password=password,
|
||||
ignore_retcode=True)
|
||||
except CommandExecutionError:
|
||||
new_rev = None
|
||||
|
@ -1447,6 +1488,7 @@ def latest(name,
|
|||
__salt__['git.clone'](target,
|
||||
name,
|
||||
user=user,
|
||||
password=password,
|
||||
opts=clone_opts,
|
||||
identity=identity,
|
||||
https_user=https_user,
|
||||
|
@ -1483,7 +1525,7 @@ def latest(name,
|
|||
else:
|
||||
if remote_rev_type == 'tag' \
|
||||
and rev not in __salt__['git.list_tags'](
|
||||
target, user=user):
|
||||
target, user=user, password=password):
|
||||
return _fail(
|
||||
ret,
|
||||
'Revision \'{0}\' does not exist in clone'
|
||||
|
@ -1493,8 +1535,10 @@ def latest(name,
|
|||
|
||||
if branch is not None:
|
||||
if branch not in \
|
||||
__salt__['git.list_branches'](target,
|
||||
user=user):
|
||||
__salt__['git.list_branches'](
|
||||
target,
|
||||
user=user,
|
||||
password=password):
|
||||
if rev == 'HEAD':
|
||||
checkout_rev = remote_rev
|
||||
else:
|
||||
|
@ -1504,7 +1548,8 @@ def latest(name,
|
|||
__salt__['git.checkout'](target,
|
||||
checkout_rev,
|
||||
opts=['-b', branch],
|
||||
user=user)
|
||||
user=user,
|
||||
password=password)
|
||||
comments.append(
|
||||
'Branch \'{0}\' checked out, with {1} '
|
||||
'as a starting point'.format(
|
||||
|
@ -1514,14 +1559,14 @@ def latest(name,
|
|||
)
|
||||
|
||||
local_rev, local_branch = \
|
||||
_get_local_rev_and_branch(target, user)
|
||||
_get_local_rev_and_branch(target, user, password)
|
||||
|
||||
if not _revs_equal(local_rev, remote_rev, remote_rev_type):
|
||||
__salt__['git.reset'](
|
||||
target,
|
||||
opts=['--hard', remote_rev],
|
||||
user=user
|
||||
)
|
||||
user=user,
|
||||
password=password)
|
||||
comments.append(
|
||||
'Repository was reset to {0}'.format(remote_loc)
|
||||
)
|
||||
|
@ -1532,6 +1577,7 @@ def latest(name,
|
|||
local_branch + '@{upstream}',
|
||||
opts=['--abbrev-ref'],
|
||||
user=user,
|
||||
password=password,
|
||||
ignore_retcode=True)
|
||||
except CommandExecutionError:
|
||||
upstream = False
|
||||
|
@ -1545,7 +1591,9 @@ def latest(name,
|
|||
branch_opts = _get_branch_opts(
|
||||
branch,
|
||||
local_branch,
|
||||
__salt__['git.list_branches'](target, user=user),
|
||||
__salt__['git.list_branches'](target,
|
||||
user=user,
|
||||
password=password),
|
||||
desired_upstream,
|
||||
git_ver)
|
||||
elif upstream and desired_upstream is False:
|
||||
|
@ -1568,7 +1616,9 @@ def latest(name,
|
|||
branch_opts = _get_branch_opts(
|
||||
branch,
|
||||
local_branch,
|
||||
__salt__['git.list_branches'](target, user=user),
|
||||
__salt__['git.list_branches'](target,
|
||||
user=user,
|
||||
password=password),
|
||||
desired_upstream,
|
||||
git_ver)
|
||||
else:
|
||||
|
@ -1578,7 +1628,8 @@ def latest(name,
|
|||
__salt__['git.branch'](
|
||||
target,
|
||||
opts=branch_opts,
|
||||
user=user)
|
||||
user=user,
|
||||
password=password)
|
||||
comments.append(upstream_action)
|
||||
|
||||
if submodules and remote_rev:
|
||||
|
@ -1587,6 +1638,7 @@ def latest(name,
|
|||
'update',
|
||||
opts=['--init', '--recursive'],
|
||||
user=user,
|
||||
password=password,
|
||||
identity=identity)
|
||||
except CommandExecutionError as exc:
|
||||
return _failed_submodule_update(ret, exc, comments)
|
||||
|
@ -1595,6 +1647,7 @@ def latest(name,
|
|||
new_rev = __salt__['git.revision'](
|
||||
cwd=target,
|
||||
user=user,
|
||||
password=password,
|
||||
ignore_retcode=True)
|
||||
except CommandExecutionError:
|
||||
new_rev = None
|
||||
|
@ -1624,7 +1677,8 @@ def present(name,
|
|||
template=None,
|
||||
separate_git_dir=None,
|
||||
shared=None,
|
||||
user=None):
|
||||
user=None,
|
||||
password=None):
|
||||
'''
|
||||
Ensure that a repository exists in the given directory
|
||||
|
||||
|
@ -1678,6 +1732,12 @@ def present(name,
|
|||
|
||||
.. versionadded:: 0.17.0
|
||||
|
||||
password
|
||||
Windows only. Required when specifying ``user``. This parameter will be
|
||||
ignored on non-Windows platforms.
|
||||
|
||||
.. versionadded:: 2016.3.4
|
||||
|
||||
.. _`git-init(1)`: http://git-scm.com/docs/git-init
|
||||
.. _`worktree`: http://git-scm.com/docs/git-worktree
|
||||
'''
|
||||
|
@ -1689,7 +1749,7 @@ def present(name,
|
|||
return ret
|
||||
elif not bare and \
|
||||
(os.path.isdir(os.path.join(name, '.git')) or
|
||||
__salt__['git.is_worktree'](name)):
|
||||
__salt__['git.is_worktree'](name, user=user, password=password)):
|
||||
return ret
|
||||
# Directory exists and is not a git repo, if force is set destroy the
|
||||
# directory and recreate, otherwise throw an error
|
||||
|
@ -1747,7 +1807,8 @@ def present(name,
|
|||
template=template,
|
||||
separate_git_dir=separate_git_dir,
|
||||
shared=shared,
|
||||
user=user)
|
||||
user=user,
|
||||
password=password)
|
||||
|
||||
actions = [
|
||||
'Initialized {0}repository in {1}'.format(
|
||||
|
@ -1773,6 +1834,7 @@ def detached(name,
|
|||
target=None,
|
||||
remote='origin',
|
||||
user=None,
|
||||
password=None,
|
||||
force_clone=False,
|
||||
force_checkout=False,
|
||||
fetch_remote=True,
|
||||
|
@ -1811,6 +1873,12 @@ def detached(name,
|
|||
User under which to run git commands. By default, commands are run by
|
||||
the user under which the minion is running.
|
||||
|
||||
password
|
||||
Windows only. Required when specifying ``user``. This parameter will be
|
||||
ignored on non-Windows platforms.
|
||||
|
||||
.. versionadded:: 2016.3.4
|
||||
|
||||
force_clone : False
|
||||
If the ``target`` directory exists and is not a git repository, then
|
||||
this state will fail. Set this argument to ``True`` to remove the
|
||||
|
@ -1966,18 +2034,24 @@ def detached(name,
|
|||
local_commit_id = None
|
||||
|
||||
gitdir = os.path.join(target, '.git')
|
||||
if os.path.isdir(gitdir) or __salt__['git.is_worktree'](target):
|
||||
if os.path.isdir(gitdir) \
|
||||
or __salt__['git.is_worktree'](target, user=user, password=password):
|
||||
# Target directory is a git repository or git worktree
|
||||
|
||||
local_commit_id = _get_local_rev_and_branch(target, user)[0]
|
||||
local_commit_id = _get_local_rev_and_branch(target, user, password)[0]
|
||||
|
||||
if remote_ref_type is 'hash' and __salt__['git.describe'](target, ref):
|
||||
if remote_ref_type is 'hash' \
|
||||
and __salt__['git.describe'](target,
|
||||
ref,
|
||||
user=user,
|
||||
password=password):
|
||||
# The ref is a hash and it exists locally so skip to checkout
|
||||
hash_exists_locally = True
|
||||
else:
|
||||
# Check that remote is present and set to correct url
|
||||
remotes = __salt__['git.remotes'](target,
|
||||
user=user,
|
||||
password=password,
|
||||
redact_auth=False)
|
||||
|
||||
if remote in remotes and name in remotes[remote]['fetch']:
|
||||
|
@ -2002,6 +2076,7 @@ def detached(name,
|
|||
url=name,
|
||||
remote=remote,
|
||||
user=user,
|
||||
password=password,
|
||||
https_user=https_user,
|
||||
https_pass=https_pass)
|
||||
comments.append(
|
||||
|
@ -2073,6 +2148,7 @@ def detached(name,
|
|||
__salt__['git.clone'](target,
|
||||
name,
|
||||
user=user,
|
||||
password=password,
|
||||
opts=clone_opts,
|
||||
identity=identity,
|
||||
https_user=https_user,
|
||||
|
@ -2119,6 +2195,7 @@ def detached(name,
|
|||
force=True,
|
||||
refspecs=refspecs,
|
||||
user=user,
|
||||
password=password,
|
||||
identity=identity,
|
||||
saltenv=__env__)
|
||||
except CommandExecutionError as exc:
|
||||
|
@ -2135,7 +2212,7 @@ def detached(name,
|
|||
#get refs and checkout
|
||||
checkout_commit_id = ''
|
||||
if remote_ref_type is 'hash':
|
||||
if __salt__['git.describe'](target, ref):
|
||||
if __salt__['git.describe'](target, ref, user=user, password=password):
|
||||
checkout_commit_id = ref
|
||||
else:
|
||||
return _fail(
|
||||
|
@ -2147,6 +2224,7 @@ def detached(name,
|
|||
all_remote_refs = __salt__['git.remote_refs'](
|
||||
target,
|
||||
user=user,
|
||||
password=password,
|
||||
identity=identity,
|
||||
https_user=https_user,
|
||||
https_pass=https_pass,
|
||||
|
@ -2179,8 +2257,8 @@ def detached(name,
|
|||
__salt__['git.reset'](
|
||||
target,
|
||||
opts=['--hard', 'HEAD'],
|
||||
user=user
|
||||
)
|
||||
user=user,
|
||||
password=password)
|
||||
comments.append(
|
||||
'Repository was reset to HEAD before checking out ref'
|
||||
)
|
||||
|
@ -2202,7 +2280,8 @@ def detached(name,
|
|||
__salt__['git.checkout'](target,
|
||||
checkout_commit_id,
|
||||
force=force_checkout,
|
||||
user=user)
|
||||
user=user,
|
||||
password=password)
|
||||
comments.append(
|
||||
'Commit ID {0} was checked out at {1}'.format(
|
||||
checkout_commit_id,
|
||||
|
@ -2214,6 +2293,7 @@ def detached(name,
|
|||
new_rev = __salt__['git.revision'](
|
||||
cwd=target,
|
||||
user=user,
|
||||
password=password,
|
||||
ignore_retcode=True)
|
||||
except CommandExecutionError:
|
||||
new_rev = None
|
||||
|
@ -2223,6 +2303,7 @@ def detached(name,
|
|||
'update',
|
||||
opts=['--init', '--recursive'],
|
||||
user=user,
|
||||
password=password,
|
||||
identity=identity)
|
||||
comments.append(
|
||||
'Submodules were updated'
|
||||
|
@ -2244,6 +2325,7 @@ def config_unset(name,
|
|||
value_regex=None,
|
||||
repo=None,
|
||||
user=None,
|
||||
password=None,
|
||||
**kwargs):
|
||||
r'''
|
||||
.. versionadded:: 2015.8.0
|
||||
|
@ -2274,7 +2356,14 @@ def config_unset(name,
|
|||
set. Required unless ``global`` is set to ``True``.
|
||||
|
||||
user
|
||||
Optional name of a user as whom `git config` will be run
|
||||
User under which to run git commands. By default, commands are run by
|
||||
the user under which the minion is running.
|
||||
|
||||
password
|
||||
Windows only. Required when specifying ``user``. This parameter will be
|
||||
ignored on non-Windows platforms.
|
||||
|
||||
.. versionadded:: 2016.3.4
|
||||
|
||||
global : False
|
||||
If ``True``, this will set a global git config option
|
||||
|
@ -2349,6 +2438,7 @@ def config_unset(name,
|
|||
key=key,
|
||||
value_regex=value_regex,
|
||||
user=user,
|
||||
password=password,
|
||||
ignore_retcode=True,
|
||||
**{'global': global_}
|
||||
)
|
||||
|
@ -2397,6 +2487,7 @@ def config_unset(name,
|
|||
key=key,
|
||||
value_regex=None,
|
||||
user=user,
|
||||
password=password,
|
||||
ignore_retcode=True,
|
||||
**{'global': global_}
|
||||
)
|
||||
|
@ -2412,6 +2503,7 @@ def config_unset(name,
|
|||
value_regex=value_regex,
|
||||
all=all_,
|
||||
user=user,
|
||||
password=password,
|
||||
**{'global': global_}
|
||||
)
|
||||
except CommandExecutionError as exc:
|
||||
|
@ -2434,6 +2526,7 @@ def config_unset(name,
|
|||
key=key,
|
||||
value_regex=None,
|
||||
user=user,
|
||||
password=password,
|
||||
ignore_retcode=True,
|
||||
**{'global': global_}
|
||||
)
|
||||
|
@ -2453,6 +2546,7 @@ def config_unset(name,
|
|||
key=key,
|
||||
value_regex=value_regex,
|
||||
user=user,
|
||||
password=password,
|
||||
ignore_retcode=True,
|
||||
**{'global': global_}
|
||||
)
|
||||
|
@ -2474,6 +2568,7 @@ def config_set(name,
|
|||
multivar=None,
|
||||
repo=None,
|
||||
user=None,
|
||||
password=None,
|
||||
**kwargs):
|
||||
'''
|
||||
.. versionadded:: 2014.7.0
|
||||
|
@ -2504,7 +2599,14 @@ def config_set(name,
|
|||
set. Required unless ``global`` is set to ``True``.
|
||||
|
||||
user
|
||||
Optional name of a user as whom `git config` will be run
|
||||
User under which to run git commands. By default, the commands are run
|
||||
by the user under which the minion is running.
|
||||
|
||||
password
|
||||
Windows only. Required when specifying ``user``. This parameter will be
|
||||
ignored on non-Windows platforms.
|
||||
|
||||
.. versionadded:: 2016.3.4
|
||||
|
||||
global : False
|
||||
If ``True``, this will set a global git config option
|
||||
|
@ -2614,6 +2716,7 @@ def config_set(name,
|
|||
cwd=repo,
|
||||
key=name,
|
||||
user=user,
|
||||
password=password,
|
||||
ignore_retcode=True,
|
||||
**{'all': True, 'global': global_}
|
||||
)
|
||||
|
@ -2644,6 +2747,7 @@ def config_set(name,
|
|||
value=value,
|
||||
multivar=multivar,
|
||||
user=user,
|
||||
password=password,
|
||||
**{'global': global_}
|
||||
)
|
||||
except CommandExecutionError as exc:
|
||||
|
@ -2679,7 +2783,13 @@ def config_set(name,
|
|||
return ret
|
||||
|
||||
|
||||
def config(name, value=None, multivar=None, repo=None, user=None, **kwargs):
|
||||
def config(name,
|
||||
value=None,
|
||||
multivar=None,
|
||||
repo=None,
|
||||
user=None,
|
||||
password=None,
|
||||
**kwargs):
|
||||
'''
|
||||
Pass through to git.config_set and display a deprecation warning
|
||||
'''
|
||||
|
@ -2693,6 +2803,7 @@ def config(name, value=None, multivar=None, repo=None, user=None, **kwargs):
|
|||
multivar=multivar,
|
||||
repo=repo,
|
||||
user=user,
|
||||
password=password,
|
||||
**kwargs)
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue