From 825654a2fafeacfcb5d284e525c5f8ead49b7efb Mon Sep 17 00:00:00 2001 From: Cove Schneider Date: Mon, 16 Feb 2015 00:26:35 -0800 Subject: [PATCH] parse yaml using cparser if present --- lib/ansible/utils/__init__.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/ansible/utils/__init__.py b/lib/ansible/utils/__init__.py index 61cb5f4447..c9a999357a 100644 --- a/lib/ansible/utils/__init__.py +++ b/lib/ansible/utils/__init__.py @@ -70,6 +70,11 @@ try: except ImportError: import json +try: + from yaml import CSafeLoader as Loader +except ImportError: + from yaml import SafeLoader as Loader + PASSLIB_AVAILABLE = False try: import passlib.hash @@ -594,7 +599,7 @@ def parse_yaml(data, path_hint=None): raise errors.AnsibleError(str(ve)) else: # else this is pretty sure to be a YAML document - loaded = yaml.safe_load(data) + loaded = yaml.load(data, Loader=Loader) return loaded