From 091587af88834776dc266e7583bdce344cb3c53e Mon Sep 17 00:00:00 2001 From: Seth Vidal Date: Fri, 28 Jun 2013 21:08:51 +0000 Subject: [PATCH] add dir perms fix file import notifications --- callback_plugins/logdetail.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/callback_plugins/logdetail.py b/callback_plugins/logdetail.py index 8198377972..718ed7a735 100644 --- a/callback_plugins/logdetail.py +++ b/callback_plugins/logdetail.py @@ -36,7 +36,7 @@ class LogMech(object): self.logpath = LOG_PATH if not os.path.exists(self.logpath): try: - os.makedirs(self.logpath) + os.makedirs(self.logpath, mode=750) except OSError, e: if e.errno != 17: raise @@ -159,7 +159,8 @@ class CallbackModule(object): def runner_on_skipped(self, host, item=None): category = 'SKIPPED' task = getattr(self,'task', None) - res = {'item':item} + res = {} + res['item'] = item logmech.log(host, category, res, task, self._task_count) def runner_on_unreachable(self, host, res): @@ -206,11 +207,15 @@ class CallbackModule(object): def playbook_on_import_for_host(self, host, imported_file): task = getattr(self,'task', None) - logmech.log(host, 'IMPORTED', imported_file, task) + res = {} + res['imported_file'] = imported_file + logmech.log(host, 'IMPORTED', res, task) def playbook_on_not_import_for_host(self, host, missing_file): task = getattr(self,'task', None) - logmech.log(host, 'NOTIMPORTED', missing_file, task) + res = {} + res['missing_file'] = missing_file + logmech.log(host, 'NOTIMPORTED', res, task) def playbook_on_play_start(self, pattern): self._task_count = 0 @@ -251,6 +256,6 @@ class CallbackModule(object): results[host] = stats.summarize(host) logmech.log(host, 'STATS', results[host]) logmech.play_log(json.dumps({'stats': results}, indent=4)) - print ' logs written to: %s\n' % logmech.logpath_play + print 'logs written to: %s' % logmech.logpath_play