From 1ae50644c0ddcedcb558ff0c67c0560f67d28ee7 Mon Sep 17 00:00:00 2001 From: Zack Cerza Date: Mon, 18 Jul 2016 16:50:01 -0600 Subject: [PATCH] If a YAML error is hit, log the raw object We are seeing: "RepresenterError: cannot represent an object: pcp" Signed-off-by: Zack Cerza --- callback_plugins/failure_log.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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): -- 2.47.3