1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

fixed typo in tree callback, added default dir

this would allow it to work with playbooks also
This commit is contained in:
Brian Coca 2015-12-08 11:59:04 -08:00
parent ec5827c22a
commit 795fac917e

View file

@ -41,7 +41,8 @@ class CallbackModule(CallbackBase):
self.tree = TREE_DIR self.tree = TREE_DIR
if not self.tree: if not self.tree:
self._display.warnings("Disabling tree callback, invalid directory provided to tree option: %s" % self.tree) self.tree = os.path.expanduser("~/.ansible/tree")
self._display.warning("Defaulting to ~/.ansible/tree, invalid directory provided to tree option: %s" % self.tree)
def write_tree_file(self, hostname, buf): def write_tree_file(self, hostname, buf):
''' write something into treedir/hostname ''' ''' write something into treedir/hostname '''
@ -53,7 +54,7 @@ class CallbackModule(CallbackBase):
with open(path, 'wb+') as fd: with open(path, 'wb+') as fd:
fd.write(buf) fd.write(buf)
except (OSError, IOError) as e: except (OSError, IOError) as e:
self._display.warnings("Unable to write to %s's file: %s" % (hostname, str(e))) self._display.warning("Unable to write to %s's file: %s" % (hostname, str(e)))
def result_to_tree(self, result): def result_to_tree(self, result):
if self.tree: if self.tree: