parent
fc79615e38
commit
c73f9d0492
1 changed files with 22 additions and 0 deletions
|
@ -140,6 +140,13 @@ options:
|
||||||
description:
|
description:
|
||||||
- if C(yes), repository will be created as a bare repo, otherwise
|
- if C(yes), repository will be created as a bare repo, otherwise
|
||||||
it will be a standard repo with a workspace.
|
it will be a standard repo with a workspace.
|
||||||
|
umask:
|
||||||
|
required: false
|
||||||
|
default: null
|
||||||
|
version_added: "2.2"
|
||||||
|
description:
|
||||||
|
- The umask to set before doing any checkouts, or any other
|
||||||
|
repository maintenance.
|
||||||
|
|
||||||
recursive:
|
recursive:
|
||||||
required: false
|
required: false
|
||||||
|
@ -209,6 +216,8 @@ import re
|
||||||
import tempfile
|
import tempfile
|
||||||
from distutils.version import LooseVersion
|
from distutils.version import LooseVersion
|
||||||
|
|
||||||
|
from ansible.module_utils.six import string_types
|
||||||
|
|
||||||
def head_splitter(headfile, remote, module=None, fail_on_error=False):
|
def head_splitter(headfile, remote, module=None, fail_on_error=False):
|
||||||
'''Extract the head reference'''
|
'''Extract the head reference'''
|
||||||
# https://github.com/ansible/ansible-modules-core/pull/907
|
# https://github.com/ansible/ansible-modules-core/pull/907
|
||||||
|
@ -813,6 +822,7 @@ def main():
|
||||||
bare=dict(default='no', type='bool'),
|
bare=dict(default='no', type='bool'),
|
||||||
recursive=dict(default='yes', type='bool'),
|
recursive=dict(default='yes', type='bool'),
|
||||||
track_submodules=dict(default='no', type='bool'),
|
track_submodules=dict(default='no', type='bool'),
|
||||||
|
umask=dict(default=None, type='raw'),
|
||||||
),
|
),
|
||||||
supports_check_mode=True
|
supports_check_mode=True
|
||||||
)
|
)
|
||||||
|
@ -832,9 +842,21 @@ def main():
|
||||||
git_path = module.params['executable'] or module.get_bin_path('git', True)
|
git_path = module.params['executable'] or module.get_bin_path('git', True)
|
||||||
key_file = module.params['key_file']
|
key_file = module.params['key_file']
|
||||||
ssh_opts = module.params['ssh_opts']
|
ssh_opts = module.params['ssh_opts']
|
||||||
|
umask = module.params['umask']
|
||||||
|
|
||||||
result = dict( warnings=list() )
|
result = dict( warnings=list() )
|
||||||
|
|
||||||
|
# evaluate and set the umask before doing anything else
|
||||||
|
if umask != None:
|
||||||
|
if not isinstance(umask, string_types):
|
||||||
|
module.fail_json(msg="umask must be defined as a quoted octal integer")
|
||||||
|
try:
|
||||||
|
umask = int(umask, 8)
|
||||||
|
except:
|
||||||
|
module.fail_json(msg="umask must be an octal integer",
|
||||||
|
details=str(sys.exc_info()[1]))
|
||||||
|
os.umask(umask)
|
||||||
|
|
||||||
# Certain features such as depth require a file:/// protocol for path based urls
|
# Certain features such as depth require a file:/// protocol for path based urls
|
||||||
# so force a protocal here ...
|
# so force a protocal here ...
|
||||||
if repo.startswith('/'):
|
if repo.startswith('/'):
|
||||||
|
|
Loading…
Reference in a new issue