summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMichael DeHaan <michael.dehaan@gmail.com>2014-09-28 11:24:32 -0400
committerMichael DeHaan <michael.dehaan@gmail.com>2014-09-28 11:25:04 -0400
commit21c3784a43baaece7582b67c86827da00acedc80 (patch)
treebdad06484a8751974abd13e1686e072b32de7ffb /lib
parent952a36920c745b94e3ef1d3ae41e81364456f296 (diff)
downloadansible-21c3784a43baaece7582b67c86827da00acedc80.tar.gz
If submodules are not found, don't error out.
Diffstat (limited to 'lib')
-rw-r--r--lib/ansible/utils/__init__.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/ansible/utils/__init__.py b/lib/ansible/utils/__init__.py
index ba65028f9f..811eb7eefc 100644
--- a/lib/ansible/utils/__init__.py
+++ b/lib/ansible/utils/__init__.py
@@ -833,7 +833,7 @@ def default(value, function):
return value
-def _gitrepoinfo(repo_path):
+def _git_repo_info(repo_path):
''' returns a string containing git branch, commit id and commit date '''
result = None
if os.path.exists(repo_path):
@@ -877,14 +877,16 @@ def _gitrepoinfo(repo_path):
def _gitinfo():
basedir = os.path.join(os.path.dirname(__file__), '..', '..', '..')
repo_path = os.path.join(basedir, '.git')
- result = _gitrepoinfo(repo_path)
+ result = _git_repo_info(repo_path)
submodules = os.path.join(basedir, '.gitmodules')
+ if not os.path.exists(submodules):
+ return result
f = open(submodules)
for line in f:
tokens = line.strip().split(' ')
if tokens[0] == 'path':
submodule_path = tokens[2]
- submodule_info =_gitrepoinfo(os.path.join(basedir, submodule_path, '.git'))
+ submodule_info =_git_repo_info(os.path.join(basedir, submodule_path, '.git'))
if not submodule_info:
submodule_info = ' not found - use git submodule update --init ' + submodule_path
result += "\n {0}: {1}".format(submodule_path, submodule_info)