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
4d853a5d
Commit
4d853a5d
authored
Aug 11, 2015
by
Brian Coca
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implemented for v2, missing --tree option for adhoc
parent
79a1bca0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
69 additions
and
1 deletions
+69
-1
lib/ansible/cli/adhoc.py
+4
-1
lib/ansible/constants.py
+1
-0
lib/ansible/plugins/callback/tree.py
+64
-0
No files found.
lib/ansible/cli/adhoc.py
View file @
4d853a5d
...
...
@@ -139,6 +139,10 @@ class AdHocCLI(CLI):
else
:
cb
=
'minimal'
if
self
.
options
.
tree
:
C
.
DEFAULT_CALLBACK_WHITELIST
.
append
(
'tree'
)
C
.
TREE_DIR
=
self
.
options
.
tree
# now create a task queue manager to execute the play
self
.
_tqm
=
None
try
:
...
...
@@ -168,4 +172,3 @@ class AdHocCLI(CLI):
poller
.
wait
(
self
.
options
.
seconds
,
self
.
options
.
poll_interval
)
return
poller
.
results
lib/ansible/constants.py
View file @
4d853a5d
...
...
@@ -241,3 +241,4 @@ DEFAULT_SU_PASS = None
VAULT_VERSION_MIN
=
1.0
VAULT_VERSION_MAX
=
1.0
MAX_FILE_SIZE_FOR_DIFF
=
1
*
1024
*
1024
TREE_DIR
=
None
lib/ansible/plugins/callback/tree.py
0 → 100644
View file @
4d853a5d
# (c) 2012-2014, Ansible, Inc
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
from
__future__
import
(
absolute_import
,
division
,
print_function
)
__metaclass__
=
type
import
os
from
ansible.plugins.callback
import
CallbackBase
from
ansible.utils.path
import
makedirs_safe
from
ansible.constants
import
TREE_DIR
class
CallbackModule
(
CallbackBase
):
'''
This callback puts results into a host specific file in a directory in json format.
'''
CALLBACK_VERSION
=
2.0
CALLBACK_TYPE
=
'aggregate'
CALLBACK_NAME
=
'tree'
def
write_tree_file
(
self
,
tree
,
hostname
,
buf
):
''' write something into treedir/hostname '''
makedirs_safe
(
tree
)
try
:
path
=
os
.
path
.
join
(
tree
,
hostname
)
fd
=
open
(
path
,
"a+"
)
fd
.
write
(
buf
)
fd
.
close
()
except
(
OSError
,
IOError
)
as
e
:
self
.
_display
.
warnings
(
"Unable to write to
%
s's file:
%
s"
%
(
hostname
,
str
(
e
)))
def
result_to_tree
(
self
,
result
):
tree
=
TREE_DIR
if
tree
:
self
.
write_tree_file
(
tree
,
result
.
_host
.
get_name
(),
self
.
_dump_results
(
result
.
_result
))
else
:
self
.
_display
.
warnings
(
"Invalid directory provided to tree option:
%
s"
%
tree
)
def
v2_runner_on_ok
(
self
,
result
):
self
.
result_to_tree
(
result
)
def
v2_runner_on_failed
(
self
,
result
):
self
.
result_to_tree
(
result
)
def
v2_runner_on_unreachable
(
self
,
result
):
self
.
result_to_tree
(
result
)
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