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
eae9a406
Commit
eae9a406
authored
Jan 20, 2015
by
James Cammarata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixing v2 code for test_yum and added capability to squash items
parent
5addbe79
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
10 deletions
+25
-10
v2/ansible/executor/process/result.py
+1
-2
v2/ansible/executor/task_executor.py
+20
-6
v2/ansible/executor/task_result.py
+2
-1
v2/bin/ansible-playbook
+2
-1
No files found.
v2/ansible/executor/process/result.py
View file @
eae9a406
...
@@ -33,7 +33,6 @@ try:
...
@@ -33,7 +33,6 @@ try:
except
ImportError
:
except
ImportError
:
HAS_ATFORK
=
False
HAS_ATFORK
=
False
from
ansible.executor.task_result
import
TaskResult
from
ansible.playbook.handler
import
Handler
from
ansible.playbook.handler
import
Handler
from
ansible.playbook.task
import
Task
from
ansible.playbook.task
import
Task
...
@@ -130,7 +129,7 @@ class ResultProcess(multiprocessing.Process):
...
@@ -130,7 +129,7 @@ class ResultProcess(multiprocessing.Process):
for
notify
in
result
.
_task
.
notify
:
for
notify
in
result
.
_task
.
notify
:
self
.
_send_result
((
'notify_handler'
,
result
.
_host
,
notify
))
self
.
_send_result
((
'notify_handler'
,
result
.
_host
,
notify
))
if
'results'
in
result
.
_result
:
if
result
.
_task
.
loop
:
# this task had a loop, and has more than one result, so
# this task had a loop, and has more than one result, so
# loop over all of them instead of a single result
# loop over all of them instead of a single result
result_items
=
result
.
_result
[
'results'
]
result_items
=
result
.
_result
[
'results'
]
...
...
v2/ansible/executor/task_executor.py
View file @
eae9a406
...
@@ -112,14 +112,12 @@ class TaskExecutor:
...
@@ -112,14 +112,12 @@ class TaskExecutor:
results
=
[]
results
=
[]
#
FIXME: squash items into a flat list here for those modules
#
make copies of the job vars and task so we can add the item to
#
which support it (yum, apt, etc.) but make it smarter
#
the variables and re-validate the task with the item variable
# than it is today?
task_vars
=
self
.
_job_vars
.
copy
()
items
=
self
.
_squash_items
(
items
,
task_vars
)
for
item
in
items
:
for
item
in
items
:
# make copies of the job vars and task so we can add the item to
# the variables and re-validate the task with the item variable
task_vars
=
self
.
_job_vars
.
copy
()
task_vars
[
'item'
]
=
item
task_vars
[
'item'
]
=
item
try
:
try
:
...
@@ -143,6 +141,22 @@ class TaskExecutor:
...
@@ -143,6 +141,22 @@ class TaskExecutor:
return
results
return
results
def
_squash_items
(
self
,
items
,
variables
):
'''
Squash items down to a comma-separated list for certain modules which support it
(typically package management modules).
'''
if
len
(
items
)
>
0
and
self
.
_task
.
action
in
(
'apt'
,
'yum'
,
'pkgng'
,
'zypper'
):
final_items
=
[]
for
item
in
items
:
variables
[
'item'
]
=
item
if
self
.
_task
.
evaluate_conditional
(
variables
):
final_items
.
append
(
item
)
return
[
","
.
join
(
final_items
)]
else
:
return
items
def
_execute
(
self
,
variables
=
None
):
def
_execute
(
self
,
variables
=
None
):
'''
'''
The primary workhorse of the executor system, this runs the task
The primary workhorse of the executor system, this runs the task
...
...
v2/ansible/executor/task_result.py
View file @
eae9a406
...
@@ -55,6 +55,7 @@ class TaskResult:
...
@@ -55,6 +55,7 @@ class TaskResult:
if
'results'
in
self
.
_result
:
if
'results'
in
self
.
_result
:
flag
=
False
flag
=
False
for
res
in
self
.
_result
.
get
(
'results'
,
[]):
for
res
in
self
.
_result
.
get
(
'results'
,
[]):
flag
|=
res
.
get
(
key
,
False
)
if
isinstance
(
res
,
dict
):
flag
|=
res
.
get
(
key
,
False
)
else
:
else
:
return
self
.
_result
.
get
(
key
,
False
)
return
self
.
_result
.
get
(
key
,
False
)
v2/bin/ansible-playbook
View file @
eae9a406
...
@@ -17,7 +17,8 @@ from ansible.utils.vars import combine_vars
...
@@ -17,7 +17,8 @@ from ansible.utils.vars import combine_vars
from
ansible.vars
import
VariableManager
from
ansible.vars
import
VariableManager
# Implement an ansible.utils.warning() function later
# Implement an ansible.utils.warning() function later
warning
=
print
import
__builtin__
warning
=
getattr
(
__builtin__
,
'print'
)
#---------------------------------------------------------------------------------------------------
#---------------------------------------------------------------------------------------------------
...
...
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