Commit Graph

381 Commits (533fb21586322c26fd9696213108d6a9e45ada64)

Author SHA1 Message Date
Josh Drake aa419044c4 WIP on the re-implementation of fact caching and various backends. 2014-08-11 12:23:05 -04:00
Michael DeHaan fb5a1403dd Merge 2014-08-11 12:22:55 -04:00
James Cammarata 25e9d1197e Merge branch 'optimise_utils_clean_data' of https://github.com/leth/ansible into leth-optimise_utils_clean_data 2014-08-11 10:21:02 -05:00
Marcus Cobden c47d1f5265 Pre-load whole string and use seek to alter tags 2014-08-11 09:10:06 +01:00
Marcus Cobden c8bfd157f8 Switch cStringIO to StringIO for unicode support
The performance difference isn't too bad
2014-08-11 08:48:37 +01:00
Marcus Cobden 84114e5c0b Fix copy/paste error 2014-08-11 08:43:40 +01:00
Marcus Cobden ef65d3dbf6 Optimise string handling in ansible.utils._clean_data 2014-08-09 23:47:08 +01:00
James Cammarata 63bf2f6d9a Preserve all line breaks in literal blocks
Fixes #8512
2014-08-08 12:11:15 -05:00
Michael DeHaan 8c4161d4a1 Merge branch 'retf_py' of git://github.com/berendt/ansible into devel
Conflicts:
	lib/ansible/inventory/vars_plugins/group_vars.py
	plugins/callbacks/mail.py
2014-08-08 12:17:37 -04:00
Michael DeHaan 48a0236ec6 Merge pull request #6619 from sergevanginderachter/ansible_version_var
Introduce an ansible_version dict as runner variable
2014-08-08 11:20:17 -04:00
James Cammarata a45c3b84f3 Avoid templating raw lookup strings 2014-08-06 13:25:14 -05:00
Michael DeHaan 1c6398dd3b Resolve option conflict differently. 2014-08-05 20:45:16 -04:00
Michael DeHaan b4b115cd13 File common arguments should not be used in all docs pages. 2014-08-05 20:45:16 -04:00
Michael DeHaan 4312391e0a (A) Fix a bug in the doc generator that was clobbering the force parameter for the copy module.
(B) This is a work in progress but the idea is to have text snippets where we can respond to tickets with a bit more helpful info.
Not active just yet.
2014-08-05 20:10:15 -04:00
James Cammarata 6d94ae64ec Remove unnecessary unicode conversions from parse_kv
Fixes #8425
2014-08-04 09:59:08 -05:00
Grzegorz Nosek 7f33580eba Fix exponential regex performance issue
filter_leading_non_json_lines effectively does

re.match(".*\w+=\w+.*", line)

for every line of output. This has abysmal performance in case of large
Base64-encoded data (which ultimately does not match the regex but does
match the .*\w+= part) as returned e.g. by the template module (diffs).

Replacing the match with

re.search("\w=\w", line)

drops the complexity back to linear, and actually usable with large
diffs from the template module (a 150 KB Base64 diff kept Ansible
spinning at 100% cpu for minutes).

Also, check the easy cases (line.startswith) first while we're here.

Closes: #8932
2014-08-01 14:46:00 +02:00
James Cammarata 189824dd76 Remove whitespace around args
Fixes #8343
2014-07-30 08:51:27 -05:00
James Cammarata e6fa50a306 Move splitter to module_utils so modules can use it and fix command arg splitting
Fixes #8338
2014-07-29 14:55:16 -05:00
James Cammarata a9f0f8e975 Revert "template.py: Handle purposely raised exceptions in lookup()"
This reverts commit 2fda9bc743.
2014-07-28 23:25:37 -05:00
James Cammarata aee940aaca Reworking _clean_data() to be smarter about replaces
Fixes #8228
2014-07-28 16:50:18 -05:00
James Cammarata 7344baeffa Make sure empty non-quoted tokens are not added to the arg params list 2014-07-25 15:23:10 -05:00
James Cammarata 3714c0742f Split args on single spaces only 2014-07-25 13:13:15 -05:00
James Cammarata 63bcbd0af2 Fix for unicode decoding error in new splitting code
Also adds a new unicode integration test
2014-07-25 09:10:50 -05:00
Michael DeHaan 8d42f5cbfa Smush ds removal 2014-07-24 20:38:02 -05:00
James Cammarata b8a4ba26f0 Refactoring split_args into sub-functions 2014-07-24 20:00:57 -05:00
Michael DeHaan 630f080cf0 Start of unit tests for split_args function, moved split_args to utils since not needed by modules (so far). 2014-07-24 20:15:04 -04:00
James Cammarata 43154e5101 Using custom splitting function for module param counting 2014-07-24 14:42:35 -05:00
James Cammarata 84759faa09 Security fixes:
* Strip lookup calls out of inventory variables and clean unsafe data
  returned from lookup plugins (CVE-2014-4966)
* Make sure vars don't insert extra parameters into module args and prevent
  duplicate params from superseding previous params (CVE-2014-4967)
2014-07-21 11:20:49 -05:00
James Cammarata 0e5b0a2e97 Revert "Set Jinja2's keep_trailing_newline=True in template_from_string."
This reverts commit 7a8eb0b670.
2014-07-17 09:07:04 -05:00
Jacob Leverich 7a8eb0b670 Set Jinja2's keep_trailing_newline=True in template_from_string.
Without this setting, the newline idempotence of scalar strings changes depending on whether
or not they contain any Jinja2 template blocks.
2014-07-14 13:36:17 -07:00
James Cammarata 4fc8d4b6fe Merge pull request #7649 from sivel/vault-password-script
Allow --vault-password-file to work with a script as well as a flat file
2014-07-14 10:57:16 -05:00
James Cammarata db96344966 Re-fixing ability to have empty json files after inventory refactoring 2014-07-11 13:20:00 -05:00
James Cammarata fe892fccb1 Merge remote-tracking branch 'svg/varsplugins_refactor' into svg_and_inventory_refactor 2014-07-07 14:16:37 -05:00
Henry Finucane de64bbdc5f Support a whitelisted subset of jinja2 template options 2014-07-02 21:14:26 -07:00
James Cammarata 8ed6350e65 When parsing json from untrusted sources, remove templating tags 2014-07-01 14:14:14 -05:00
James Cammarata eeb597360e Further safe_eval fixes 2014-07-01 14:14:14 -05:00
James Cammarata 35368e531b Additional fixes for safe_eval 2014-06-25 21:26:32 -05:00
James Cammarata 5429b85b9f Change safe_eval to a strict white list 2014-06-25 14:00:21 -05:00
Matt Martz 19f5ce2c9c Allow --vault-password-file to work with a script as well as a flat file 2014-06-24 15:02:24 -05:00
Paul Sokolovsky f8bf9cdeec Handle TemplateNotFound to render more helpful error message.
At the point the exception is handled, it is likely due to error loading
a sub-template included from main template. Besides file not found, it
can be caused also by include path failing Jinja2 checks. Now, when
rendering the exception from Jinja, it will include exception name. This
will give basic context or *what* the error is.

Fixes #7103
Fixes #7105
2014-06-23 15:02:58 -05:00
Chris Church 243cd877ae Add integration tests for fetch/slurp, make powershell fetch/slurp work as close as possible to existing fetch/slurp modules. 2014-06-19 14:25:28 -05:00
Matt Martz e7e95721b9 powershell modules will have a .ps1 extension 2014-06-19 14:24:13 -05:00
Chris Church 5dcaa30476 Add shell_plugins to abstract shell-specific functions out of runner, add winrm connection plugin, add initial Windows modules. 2014-06-19 14:24:12 -05:00
James Cammarata cb13b30362 Use file documentation fragement for the copy module 2014-06-16 15:36:15 -05:00
James Cammarata 0fa5100a2c Merge branch 'fix-7596' of https://github.com/kilburn/ansible into kilburn-fix-7596 2014-06-03 10:26:25 -05:00
Jack Neely 2fda9bc743 template.py: Handle purposely raised exceptions in lookup()
If a lookup plugin is run by the lookup() template method it should pass
along any AnsibleError (or child exception classes) rather than just eat
them.  These exceptions are purposely raised by the plugin.
2014-05-30 16:41:20 -04:00
Marc Pujol d0f82e94e8 Ensure there are no duplicates in the merged/intersected lists 2014-05-30 15:47:18 +02:00
Marc Pujol f892cc798c Merge and intersect lists without using sets.
Using sets for these operations is dangerous because sets cannot contain
certain object types (such as lists) and their iteration order is
undefined.

Fixes #7596
2014-05-30 09:07:57 +02:00
James Cammarata 92f16b3d6f Merge pull request #7539 from jimi-c/issue_7503_freebsd_su_fixes
Fixes for su on freebsd
2014-05-25 15:09:58 -05:00
Abhijit Menon-Sen f6792b724a Don't double (or triple) up common error messages
process_common_errors() was called thrice, each time appending to the
existing error message, and leading to confusing repetition in the
message that was finally displayed.

Fixes #7498
2014-05-23 21:05:42 +05:30