From: Zack Cerza Date: Mon, 18 Jul 2016 22:50:01 +0000 (-0600) Subject: If a YAML error is hit, log the raw object X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=1ae50644c0ddcedcb558ff0c67c0560f67d28ee7;p=ceph-cm-ansible.git If a YAML error is hit, log the raw object We are seeing: "RepresenterError: cannot represent an object: pcp" Signed-off-by: Zack Cerza --- diff --git a/callback_plugins/failure_log.py b/callback_plugins/failure_log.py index e0c62238..3bcdb395 100644 --- a/callback_plugins/failure_log.py +++ b/callback_plugins/failure_log.py @@ -40,7 +40,10 @@ def log_failure(host, result): failure[host] = result if ANSIBLE_MAJOR >= 2: failure = sanitize_dict(failure) - log.error(yaml.safe_dump(failure)) + try: + log.error(yaml.safe_dump(failure)) + except Exception: + log.exception("Failure object was: %s", str(failure)) def sanitize_dict(obj):