Skip to content

Instantly share code, notes, and snippets.

@jtaleric
Created December 15, 2015 22:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jtaleric/19dae1ac6513bbd54fe9 to your computer and use it in GitHub Desktop.
Save jtaleric/19dae1ac6513bbd54fe9 to your computer and use it in GitHub Desktop.
# This program 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.
#
# This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
FIELDS = ['stderr']
def human_log(res):
if type(res) == type(dict()):
for field in FIELDS:
if field in res.keys():
if res[field] != "" :
# use default encoding, check out sys.setdefaultencoding
print u'\n{0}:\n{1}'.format(field, res[field])
# or use specific encoding, e.g. utf-8
#print '\n{0}:\n{1}'.format(field, res[field].encode('utf-8'))
class CallbackModule(object):
def runner_on_failed(self, host, res, ignore_errors=False):
human_log(res)
def runner_on_ok(self, host, res):
human_log(res)
def runner_on_unreachable(self, host, res):
human_log(res)
def runner_on_async_poll(self, host, res, jid, clock):
human_log(res)
def runner_on_async_ok(self, host, res, jid):
human_log(res)
def runner_on_async_failed(self, host, res, jid):
human_log(res)
# def playbook_on_start(self):
# human_log(res)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment