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
71977bfe
Commit
71977bfe
authored
Mar 16, 2014
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5720 from mschurenko/devel
added random sleep option to ansible-pull
parents
69d26d50
1ef8f279
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
1 deletions
+16
-1
bin/ansible-pull
+16
-1
No files found.
bin/ansible-pull
View file @
71977bfe
...
...
@@ -44,6 +44,8 @@ import subprocess
import
sys
import
datetime
import
socket
import
random
import
time
from
ansible
import
utils
from
ansible.utils
import
cmd_functions
from
ansible
import
errors
...
...
@@ -102,6 +104,8 @@ def main(args):
help
=
'purge checkout after playbook run'
)
parser
.
add_option
(
'-o'
,
'--only-if-changed'
,
dest
=
'ifchanged'
,
default
=
False
,
action
=
'store_true'
,
help
=
'only run the playbook if the repository has been updated'
)
parser
.
add_option
(
'-s'
,
'--sleep'
,
dest
=
'sleep'
,
default
=
None
,
help
=
'sleep for random interval (between 0 and n number of seconds) before starting. this is a useful way to disperse git requests'
)
parser
.
add_option
(
'-f'
,
'--force'
,
dest
=
'force'
,
default
=
False
,
action
=
'store_true'
,
help
=
'run the playbook even if the repository could '
...
...
@@ -164,7 +168,18 @@ def main(args):
inv_opts
,
base_opts
,
options
.
module_name
,
repo_opts
)
# RUN THE CHECKOUT COMMAND
if
options
.
sleep
:
try
:
secs
=
random
.
randint
(
0
,
int
(
options
.
sleep
));
except
ValueError
:
parser
.
error
(
"
%
s is not a number."
%
options
.
sleep
)
return
1
print
>>
sys
.
stderr
,
"Sleeping for
%
d seconds..."
%
secs
time
.
sleep
(
secs
);
# RUN THe CHECKOUT COMMAND
rc
,
out
,
err
=
cmd_functions
.
run_cmd
(
cmd
,
live
=
True
)
if
rc
!=
0
:
...
...
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