From 000d3832cc044cf243bc8568cf9e889698d7687e Mon Sep 17 00:00:00 2001 From: Daniel Hokka Zakrisson Date: Thu, 1 Nov 2012 20:55:18 +0100 Subject: [PATCH] Make ansible.utils a package --- lib/ansible/{utils.py => utils/__init__.py} | 18 +----------------- lib/ansible/{ => utils}/template.py | 0 setup.py | 1 + 3 files changed, 2 insertions(+), 17 deletions(-) rename lib/ansible/{utils.py => utils/__init__.py} (95%) rename lib/ansible/{ => utils}/template.py (100%) diff --git a/lib/ansible/utils.py b/lib/ansible/utils/__init__.py similarity index 95% rename from lib/ansible/utils.py rename to lib/ansible/utils/__init__.py index 0b18444afa..d3a32d0ada 100644 --- a/lib/ansible/utils.py +++ b/lib/ansible/utils/__init__.py @@ -23,7 +23,7 @@ import optparse import operator from ansible import errors from ansible import __version__ -from ansible import template as ans_template +from ansible.utils.template import * import ansible.constants as C import time import StringIO @@ -216,22 +216,6 @@ def parse_json(raw_data): return { "failed" : True, "parsed" : False, "msg" : orig_data } return results -def varReplace(raw, vars, depth=0, expand_lists=False): - ''' Perform variable replacement of $variables in string raw using vars dictionary ''' - return ans_template.varReplace(raw, vars, depth=depth, expand_lists=expand_lists) - -def varReplaceWithItems(basedir, varname, vars): - ''' helper function used by with_items ''' - return ans_template.varReplaceWithItems(basedir, varname, vars) - -def template(basedir, text, vars, expand_lists=False): - ''' run a text buffer through the templating engine until it no longer changes ''' - return ans_template.template(basedir, text, vars, expand_lists=expand_lists) - -def template_from_file(basedir, path, vars): - ''' run a file through the templating engine ''' - return ans_template.template_from_file(basedir, path, vars) - def parse_yaml(data): ''' convert a yaml string to a data structure ''' return yaml.load(data) diff --git a/lib/ansible/template.py b/lib/ansible/utils/template.py similarity index 100% rename from lib/ansible/template.py rename to lib/ansible/utils/template.py diff --git a/setup.py b/setup.py index f1aac5c3c2..d6baeb1f7b 100644 --- a/setup.py +++ b/setup.py @@ -25,6 +25,7 @@ setup(name='ansible', package_dir={ 'ansible': 'lib/ansible' }, packages=[ 'ansible', + 'ansible.utils', 'ansible.inventory', 'ansible.inventory.vars_plugins', 'ansible.playbook',