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
b67cd6bb
Commit
b67cd6bb
authored
Apr 05, 2013
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'any-errors-fatal' of
git://github.com/junegunn/ansible
into devel
parents
8d99ef71
b874027b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
5 deletions
+16
-5
lib/ansible/playbook/__init__.py
+7
-1
lib/ansible/playbook/play.py
+4
-2
lib/ansible/playbook/task.py
+5
-2
No files found.
lib/ansible/playbook/__init__.py
View file @
b67cd6bb
...
@@ -63,7 +63,8 @@ class PlayBook(object):
...
@@ -63,7 +63,8 @@ class PlayBook(object):
subset
=
C
.
DEFAULT_SUBSET
,
subset
=
C
.
DEFAULT_SUBSET
,
inventory
=
None
,
inventory
=
None
,
check
=
False
,
check
=
False
,
diff
=
False
):
diff
=
False
,
any_errors_fatal
=
False
):
"""
"""
playbook: path to a playbook file
playbook: path to a playbook file
...
@@ -113,6 +114,7 @@ class PlayBook(object):
...
@@ -113,6 +114,7 @@ class PlayBook(object):
self
.
global_vars
=
{}
self
.
global_vars
=
{}
self
.
private_key_file
=
private_key_file
self
.
private_key_file
=
private_key_file
self
.
only_tags
=
only_tags
self
.
only_tags
=
only_tags
self
.
any_errors_fatal
=
any_errors_fatal
self
.
callbacks
.
playbook
=
self
self
.
callbacks
.
playbook
=
self
self
.
runner_callbacks
.
playbook
=
self
self
.
runner_callbacks
.
playbook
=
self
...
@@ -447,6 +449,7 @@ class PlayBook(object):
...
@@ -447,6 +449,7 @@ class PlayBook(object):
self
.
inventory
.
also_restrict_to
(
on_hosts
)
self
.
inventory
.
also_restrict_to
(
on_hosts
)
for
task
in
play
.
tasks
():
for
task
in
play
.
tasks
():
hosts_count
=
len
(
self
.
_list_available_hosts
(
play
.
hosts
))
# only run the task if the requested tags match
# only run the task if the requested tags match
should_run
=
False
should_run
=
False
...
@@ -464,6 +467,9 @@ class PlayBook(object):
...
@@ -464,6 +467,9 @@ class PlayBook(object):
host_list
=
self
.
_list_available_hosts
(
play
.
hosts
)
host_list
=
self
.
_list_available_hosts
(
play
.
hosts
)
if
task
.
any_errors_fatal
and
len
(
host_list
)
<
hosts_count
:
host_list
=
None
# if no hosts remain, drop out
# if no hosts remain, drop out
if
not
host_list
:
if
not
host_list
:
self
.
callbacks
.
on_no_hosts_remaining
()
self
.
callbacks
.
on_no_hosts_remaining
()
...
...
lib/ansible/playbook/play.py
View file @
b67cd6bb
...
@@ -30,7 +30,7 @@ class Play(object):
...
@@ -30,7 +30,7 @@ class Play(object):
'handlers'
,
'remote_user'
,
'remote_port'
,
'handlers'
,
'remote_user'
,
'remote_port'
,
'sudo'
,
'sudo_user'
,
'transport'
,
'playbook'
,
'sudo'
,
'sudo_user'
,
'transport'
,
'playbook'
,
'tags'
,
'gather_facts'
,
'serial'
,
'_ds'
,
'_handlers'
,
'_tasks'
,
'tags'
,
'gather_facts'
,
'serial'
,
'_ds'
,
'_handlers'
,
'_tasks'
,
'basedir'
'basedir'
,
'any_errors_fatal'
]
]
# to catch typos and so forth -- these are userland names
# to catch typos and so forth -- these are userland names
...
@@ -38,7 +38,8 @@ class Play(object):
...
@@ -38,7 +38,8 @@ class Play(object):
VALID_KEYS
=
[
VALID_KEYS
=
[
'hosts'
,
'name'
,
'vars'
,
'vars_prompt'
,
'vars_files'
,
'hosts'
,
'name'
,
'vars'
,
'vars_prompt'
,
'vars_files'
,
'tasks'
,
'handlers'
,
'user'
,
'port'
,
'include'
,
'tasks'
,
'handlers'
,
'user'
,
'port'
,
'include'
,
'sudo'
,
'sudo_user'
,
'connection'
,
'tags'
,
'gather_facts'
,
'serial'
'sudo'
,
'sudo_user'
,
'connection'
,
'tags'
,
'gather_facts'
,
'serial'
,
'any_errors_fatal'
]
]
# *************************************************
# *************************************************
...
@@ -77,6 +78,7 @@ class Play(object):
...
@@ -77,6 +78,7 @@ class Play(object):
self
.
gather_facts
=
ds
.
get
(
'gather_facts'
,
None
)
self
.
gather_facts
=
ds
.
get
(
'gather_facts'
,
None
)
self
.
serial
=
int
(
utils
.
template
(
basedir
,
ds
.
get
(
'serial'
,
0
),
self
.
vars
))
self
.
serial
=
int
(
utils
.
template
(
basedir
,
ds
.
get
(
'serial'
,
0
),
self
.
vars
))
self
.
remote_port
=
utils
.
template
(
basedir
,
self
.
remote_port
,
self
.
vars
)
self
.
remote_port
=
utils
.
template
(
basedir
,
self
.
remote_port
,
self
.
vars
)
self
.
any_errors_fatal
=
ds
.
get
(
'any_errors_fatal'
,
False
)
self
.
_update_vars_files_for_host
(
None
)
self
.
_update_vars_files_for_host
(
None
)
...
...
lib/ansible/playbook/task.py
View file @
b67cd6bb
...
@@ -27,7 +27,8 @@ class Task(object):
...
@@ -27,7 +27,8 @@ class Task(object):
'play'
,
'notified_by'
,
'tags'
,
'register'
,
'play'
,
'notified_by'
,
'tags'
,
'register'
,
'delegate_to'
,
'first_available_file'
,
'ignore_errors'
,
'delegate_to'
,
'first_available_file'
,
'ignore_errors'
,
'local_action'
,
'transport'
,
'sudo'
,
'sudo_user'
,
'sudo_pass'
,
'local_action'
,
'transport'
,
'sudo'
,
'sudo_user'
,
'sudo_pass'
,
'items_lookup_plugin'
,
'items_lookup_terms'
,
'environment'
,
'args'
'items_lookup_plugin'
,
'items_lookup_terms'
,
'environment'
,
'args'
,
'any_errors_fatal'
]
]
# to prevent typos and such
# to prevent typos and such
...
@@ -35,7 +36,8 @@ class Task(object):
...
@@ -35,7 +36,8 @@ class Task(object):
'name'
,
'action'
,
'only_if'
,
'async'
,
'poll'
,
'notify'
,
'name'
,
'action'
,
'only_if'
,
'async'
,
'poll'
,
'notify'
,
'first_available_file'
,
'include'
,
'tags'
,
'register'
,
'ignore_errors'
,
'first_available_file'
,
'include'
,
'tags'
,
'register'
,
'ignore_errors'
,
'delegate_to'
,
'local_action'
,
'transport'
,
'sudo'
,
'sudo_user'
,
'delegate_to'
,
'local_action'
,
'transport'
,
'sudo'
,
'sudo_user'
,
'sudo_pass'
,
'when'
,
'connection'
,
'environment'
,
'args'
'sudo_pass'
,
'when'
,
'connection'
,
'environment'
,
'args'
,
'any_errors_fatal'
]
]
def
__init__
(
self
,
play
,
ds
,
module_vars
=
None
,
additional_conditions
=
None
):
def
__init__
(
self
,
play
,
ds
,
module_vars
=
None
,
additional_conditions
=
None
):
...
@@ -151,6 +153,7 @@ class Task(object):
...
@@ -151,6 +153,7 @@ class Task(object):
self
.
ignore_errors
=
ds
.
get
(
'ignore_errors'
,
False
)
self
.
ignore_errors
=
ds
.
get
(
'ignore_errors'
,
False
)
self
.
any_errors_fatal
=
ds
.
get
(
'any_errors_fatal'
,
play
.
any_errors_fatal
)
# action should be a string
# action should be a string
if
not
isinstance
(
self
.
action
,
basestring
):
if
not
isinstance
(
self
.
action
,
basestring
):
...
...
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