Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
configuration
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
configuration
Commits
767a13cc
Commit
767a13cc
authored
Nov 12, 2013
by
John Jarvis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
search_string changed to search_regex
parent
022c37ba
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
9 deletions
+9
-9
playbooks/edx-east/edx_provision.yml
+1
-1
playbooks/library/wait_for
+8
-8
No files found.
playbooks/edx-east/edx_provision.yml
View file @
767a13cc
...
...
@@ -25,7 +25,7 @@
wait_for
:
>
path=/var/log/cloud-init.log
timeout=15
search_
string=final-message
search_
regex="final-message"
roles
:
# rerun common to set the hostname
-
common
...
...
playbooks/library/wait_for
View file @
767a13cc
...
...
@@ -75,7 +75,7 @@ EXAMPLES = '''
- wait_for: path=/tmp/foo state=present
# wait until the string "completed" is in the file /tmp/foo before continuing
- wait_for: path=/tmp/foo search_
string
=completed state=present
- wait_for: path=/tmp/foo search_
regex
=completed state=present
'''
...
...
@@ -89,7 +89,7 @@ def main():
delay
=
dict
(
default
=
0
),
port
=
dict
(
default
=
None
),
path
=
dict
(
default
=
None
),
search_
string
=
dict
(
default
=
None
),
search_
regex
=
dict
(
default
=
None
),
state
=
dict
(
default
=
'started'
,
choices
=
[
'started'
,
'stopped'
,
'present'
]),
),
)
...
...
@@ -106,7 +106,7 @@ def main():
port
=
None
state
=
params
[
'state'
]
path
=
params
[
'path'
]
search_
string
=
params
[
'search_string
'
]
search_
regex
=
params
[
'search_regex
'
]
if
port
and
path
:
module
.
fail_json
(
msg
=
"port and path parameter can not both be passed to wait_for"
)
...
...
@@ -143,8 +143,8 @@ def main():
if
path
:
try
:
with
open
(
path
)
as
f
:
if
search_
string
:
if
search_string
in
f
.
read
(
):
if
search_
regex
:
if
re
.
search
(
search_regex
,
f
.
read
(),
re
.
MULTILINE
):
break
else
:
time
.
sleep
(
1
)
...
...
@@ -169,14 +169,14 @@ def main():
if
port
:
module
.
fail_json
(
msg
=
"Timeout when waiting for
%
s:
%
s"
%
(
host
,
port
),
elapsed
=
elapsed
.
seconds
)
elif
path
:
if
search_
string
:
module
.
fail_json
(
msg
=
"Timeout when waiting for search string
%
s in
%
s"
%
(
search_
string
,
path
),
elapsed
=
elapsed
.
seconds
)
if
search_
regex
:
module
.
fail_json
(
msg
=
"Timeout when waiting for search string
%
s in
%
s"
%
(
search_
regex
,
path
),
elapsed
=
elapsed
.
seconds
)
else
:
module
.
fail_json
(
msg
=
"Timeout when waiting for file
%
s"
%
(
path
),
elapsed
=
elapsed
.
seconds
)
elapsed
=
datetime
.
datetime
.
now
()
-
start
module
.
exit_json
(
state
=
state
,
port
=
port
,
search_
string
=
search_string
,
path
=
path
,
elapsed
=
elapsed
.
seconds
)
module
.
exit_json
(
state
=
state
,
port
=
port
,
search_
regex
=
search_regex
,
path
=
path
,
elapsed
=
elapsed
.
seconds
)
# this is magic, see lib/ansible/module_common.py
#<<INCLUDE_ANSIBLE_MODULE_COMMON>>
...
...
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