Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
fee3d900
Commit
fee3d900
authored
May 18, 2013
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2934 from j2sol/git-update
Add an update option to the git module
parents
223e4e23
f645d27f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
1 deletions
+20
-1
library/source_control/git
+20
-1
No files found.
library/source_control/git
View file @
fee3d900
...
...
@@ -64,11 +64,22 @@ options:
- Create a shallow clone with a history truncated to the specified
number or revisions. The minimum possible value is C(1), otherwise
ignored.
examples:
update:
required: false
default: "yes"
choices: [ "yes", "no" ]
version_added: "1.2"
description:
- If C(yes), repository will be updated using the supplied
remote. Otherwise the repo will be left untouched.
Prior to 1.2, this was always 'yes' and could not be disabled.
examples:
- code: "git: repo=git://foosball.example.org/path/to/repo.git dest=/srv/checkout version=release-0.22"
description: Example git checkout from Ansible Playbooks
- code: "git: repo=ssh://git@github.com/mylogin/hello.git dest=/home/mylogin/hello"
description: Example read-write git checkout from github
- code: "git: repo=git://foosball.example.org/path/to/repo.git dest=/srv/checkout update=no"
description: Example just ensuring the repo checkout exists
'''
import
re
...
...
@@ -264,6 +275,7 @@ def main():
remote
=
dict
(
default
=
'origin'
),
force
=
dict
(
default
=
'yes'
,
type
=
'bool'
),
depth
=
dict
(
default
=
None
,
type
=
'int'
),
update
=
dict
(
default
=
'yes'
,
type
=
'bool'
),
),
supports_check_mode
=
True
)
...
...
@@ -274,6 +286,7 @@ def main():
remote
=
module
.
params
[
'remote'
]
force
=
module
.
params
[
'force'
]
depth
=
module
.
params
[
'depth'
]
update
=
module
.
params
[
'update'
]
gitconfig
=
os
.
path
.
join
(
dest
,
'.git'
,
'config'
)
...
...
@@ -287,6 +300,12 @@ def main():
if
module
.
check_mode
:
module
.
exit_json
(
changed
=
True
)
(
rc
,
out
,
err
)
=
clone
(
module
,
repo
,
dest
,
remote
,
depth
)
elif
not
update
:
# Just return having found a repo already in the dest path
# this does no checking that the repo is the actual repo
# requested.
before
=
get_version
(
dest
)
module
.
exit_json
(
changed
=
False
,
before
=
before
,
after
=
before
)
else
:
# else do a pull
local_mods
=
has_local_mods
(
dest
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment