Commit Graph

90 Commits (40574c19382cfbd321f5a4bf7afee154fa2a8d22)

Author SHA1 Message Date
James Tanner 9b1fe455c6 Fixes #4549 Do not call lookup plugins when templating a task's name 2013-10-25 10:27:38 -04:00
James Tanner 214b0b052c Fixes #4608 add lookup to template globals to make plugins work again 2013-10-22 12:00:54 -04:00
Michael DeHaan 2bd8cb5790 Make the deprecation detector in templates more accurate. Fixes #4514. 2013-10-19 14:14:16 -04:00
Michael DeHaan 7f9504d14d Fix a typo. 2013-10-19 13:52:48 -04:00
Michael DeHaan 8d3db80370 Some misc cleanup and removal of unused imports. 2013-10-19 13:50:14 -04:00
Michael DeHaan 5031104c3a Finishing touches on template cleanup. 2013-10-19 11:40:48 -04:00
Michael DeHaan 1e85c7544b Further WIP on template cleanup. 2013-10-19 11:39:52 -04:00
Michael DeHaan 35cb9dc22f Work in progress about cleaning up template code. 2013-10-19 11:39:52 -04:00
Tomaz Muraus 922f61899e Throw a more user-friendly exception during template rendering process. 2013-10-16 16:48:17 +02:00
Michael DeHaan add45d2ca9 Fixup legacy var detector. 2013-10-11 19:16:36 -04:00
Michael DeHaan a45494a896 Add warnings feature. 2013-10-11 19:04:26 -04:00
Michael DeHaan 9637f620d7 Deprecation warnings of several flavors, nice and purple and can be disabled
in ansible.cfg.
2013-10-11 18:37:39 -04:00
Michael DeHaan c69e19c6a6 Enhance references to logging functionality. Fixes #3431. 2013-10-08 08:26:40 -04:00
Matt Coddington 7f7116de3b commit 9db4f7a made a change that also needed to include this to retain correct legacy_playbook_variables behavior 2013-09-25 23:22:09 -04:00
Alek Storm 3569a2ffee Handle AnsibleUndefinedVariable's raised from lookup plugins like jinja2 UndefinedError's 2013-09-20 19:56:12 -05:00
James Cammarata 294451d002 Correctly handle variable issues when evaluating jinja2 when statements
Fixes #4025
2013-09-09 14:50:21 -05:00
Petr Svoboda fff4f1da33 Improve behavior with error_on_undefined_vars enabled
Pass fail_on_undefined flag to recursive calls to `template` function,
so more undefined variables are detected.

Works only for Jinja style variables. Undefined legacy variables are
never detected.
2013-08-20 00:40:49 -05:00
Brian Coca 581a0c9f59 now correctly 'types' value pairs that are passed as options to jinja
override
Signed-off-by: Brian Coca <briancoca+dev@gmail.com>
2013-08-01 21:08:23 -04:00
Stoned Elipot 2d88c70cd5 Introduce exception AnsibleFilterError and use it in Jinja filters. Ignore this exception when trying to find the name of a task for display (callback) purpose. 2013-07-07 19:18:32 +02:00
Michael DeHaan 5a504e3a3b Tweak error messages for undefined variables feature. 2013-06-18 13:30:02 -04:00
Michael DeHaan 637983cf31 cleanup example config file + Squashed commit of the following:
commit c36b66dc952dfff91043ecbca56cf3f1f8f00703
Merge: 240d7bf f4cf934
Author: Michael DeHaan <michael@ansibleworks.com>
Date:   Tue Jun 18 13:04:51 2013 -0400

    Merge branch 'unevaluated-vars' of git://github.com/lorin/ansible into lorin_undefined

    Conflicts:
    	lib/ansible/runner/__init__.py

commit f4cf93436767f73b62a16067ab5e628830045896
Merge: 2531440 07a1365
Author: Lorin Hochstein <lorin@nimbisservices.com>
Date:   Thu Jun 6 11:07:41 2013 -0400

    Merge branch 'devel' into unevaluated-vars

commit 253144045cbafd7d72836f1017c62ac4ba623186
Author: Lorin Hochstein <lorin@nimbisservices.com>
Date:   Thu Jun 6 11:06:37 2013 -0400

    Fail template from file on undefined vars

    If config option is set, raise an exception if templating from a
    file and a variable is undefined.

commit aecb71d8b75257f0f3e11a9b176fc3737aecef8d
Author: Lorin Hochstein <lorin@nimbisservices.com>
Date:   Wed Jun 5 17:12:12 2013 -0400

    Add fail_on_undefined flag

    Add a fail_on_undefined flag to the template and template_from_string methods.

    If this flag is true, then re-raise the ninja2.excpetions.UndefinedError instead of
    swallowing it.

commit cbb1808f0585f01536240aee05a1bfd06c4b4647
Merge: d4bbf49 41425fb
Author: Lorin Hochstein <lorin@nimbisservices.com>
Date:   Wed Jun 5 16:14:12 2013 -0400

    Merge branch 'devel' into unevaluated-vars

commit d4bbf492b0b63c789d66ab60d0ec634d100fca82
Author: Lorin Hochstein <lorin@nimbisservices.com>
Date:   Mon Jun 3 19:46:13 2013 -0400

    template: Raise UndefinedError exception

    In template_from_string, raise an undefined error if it occurs.

    Have the caller catch it and throw an AnsibleUndefinedVariable

commit c94780280515f1f3756fdc429b2b1e87b365e9b7
Merge: 8d919d6 be33bcf
Author: Lorin Hochstein <lorin@nimbisservices.com>
Date:   Mon Jun 3 10:09:43 2013 -0400

    Merge branch 'devel' into unevaluated-vars

commit 8d919d6c97b28a42f47ca7248c542695baf6175f
Merge: 0f68ad8 b8630d2
Author: Lorin Hochstein <lorin@nimbisservices.com>
Date:   Thu May 30 16:27:48 2013 -0400

    Merge branch 'devel' into unevaluated-vars

commit 0f68ad8193ac17488e339a258f8c63fdae399c26
Author: Lorin Hochstein <lorin@nimbisservices.com>
Date:   Thu May 30 14:32:03 2013 -0400

    Optionally fail task on undefined variables

    This patch introduces a new configuration option called
    error_on_undefined_vars, which defaults to false.

    If this option is set to true, then a task which has unevaluated
    variables in its arguments will fail instead of running. Output looks
    like this:

        TASK: [set rabbitmq password] *************************************************
        fatal: [10.20.0.7] => Undefined variables: rabbitmq_user, rabbitmq_password
2013-06-18 13:24:30 -04:00
Michael DeHaan 3d21dab705 Small fix so template plugins can see inject variables. 2013-06-10 14:23:48 -04:00
Michael DeHaan 3783dc42d4 normalize path 2013-06-03 09:57:02 -04:00
Michael DeHaan b8a66ce5bb Lookup plugins in included files now look in paths relative to their files, allowing role usage. 2013-06-01 18:15:38 -04:00
Michael DeHaan cd57d59913 If ansible is configured to use a log file but cannot write to it, exit, but don't traceback. 2013-05-19 20:05:04 -04:00
Michael DeHaan 496f06c3c9 Pass variables to lookup function for those that want to use them. 2013-05-19 19:26:30 -04:00
Michael DeHaan 9f47d13306 Misc identation. 2013-05-11 17:24:12 -04:00
Michael DeHaan 3fdf15fa8a template code fixes for 'make pep8' 2013-05-11 17:22:56 -04:00
Matt Coddington 542eeeb5d6 add option to ignore $legacy variable style substitution 2013-05-11 14:06:01 -04:00
Stoned Elipot df3c4849e9 Also load Jinja2 extensions when processing template from string 2013-04-28 20:52:01 -04:00
Michael DeHaan 224e20ca60 complex_arg templating should be smarter. Make it so! 2013-04-25 21:11:17 -04:00
Jeroen Hoekx ac7a632711 Remove leftover debug statement in template code. 2013-04-25 08:47:38 +02:00
Michael DeHaan 6fdfbb1a34 Improve variable smushing so it only has to be done in one place. This is related to shlex.split being called
on untemplated variables in some rare cases.
2013-04-24 22:00:40 -04:00
Michael DeHaan 6c778acd91 Smush the braces in various places (hey, that rhymes) to avoid undo key=value splitting surprises
in new template system.
2013-04-22 22:05:06 -04:00
Michael DeHaan 817b0cdc80 Instantiate filter plugins only once to save some efficiency. 2013-04-20 09:51:20 -04:00
Michael DeHaan c0f8af5202 Make more lookup plugins happy with newstyle variables. Not quite done, but this fixes up with_items/with_nested/file/fileglob. 2013-04-16 18:50:30 -04:00
Michael DeHaan 7a2d493e67 Teach lookup plugins that if they can't evaluate something they can wait and do it later. 2013-04-12 18:44:40 -04:00
Michael DeHaan 3f3b2a9448 Smush Jinja2 braces in playbooks so unresolved variables get parsed nicely 2013-04-12 18:38:48 -04:00
Michael DeHaan b8c5a58b7f Avoid running through the legacy template code if no dollar signs are in strings. 2013-04-12 10:33:55 -04:00
Michael DeHaan 4e79bd0872 Remove unneccessary construction of Jinja2 environment object. 2013-04-11 12:59:33 -04:00
Michael DeHaan 2f5c1d3788 Merge pull request #2629 from stoned/fix-jinja2-filters-init
Fix Jinja2 filter plugins initialization
2013-04-11 09:57:04 -07:00
Michael DeHaan 695acc2de0 Make lookup plugins accessible in templates 2013-04-10 19:19:01 -04:00
Michael DeHaan 5b2035edd9 Changes for 'make pep8' 2013-04-10 19:12:10 -04:00
Michael DeHaan 81a926547c Some continued work on new-style templates and associated test code changes. Legacy template functions
are marked with "legacy_" for possible future removal.
2013-04-10 19:09:57 -04:00
Michael DeHaan f0b21dcc0f allow references to names of variables in with_items without needing to surround them with Jinja2 '{{' delimeters 2013-04-10 18:42:54 -04:00
Michael DeHaan 9ac25bb8f6 Minor formatting 2013-04-10 18:19:31 -04:00
Michael DeHaan b09ef21ec9 Add code to flag legacy templating like $foo.{bar} as deprecated in favor of Jinja2 {{ foo.bar }} so we
can remove the legacy system at a later date.
2013-04-10 17:52:35 -04:00
Michael DeHaan 804056a563 Use Jinja2 strict undefined in string templating to allow the default filter to be used. 2013-04-10 16:45:53 -04:00
Michael DeHaan 998230a84a Allow $foo and {{ bar }} to be used on the same line in playbooks. 2013-04-10 16:40:49 -04:00
Stoned Elipot 154f58f82d Fix Jinja2 filter plugins initialization
_get_filter_plugins() checks FILTER_PLUGINS against None hence
the latter should be initialized to None.
2013-04-09 22:38:24 +02:00