Commit Graph

662 Commits (fac3bac72e524aee36728a7dd026d3429710be61)

Author SHA1 Message Date
Toshio Kuratomi 5ed7a55990 Restore json import for redis as well. Switch preference to simplejson for speed 2014-12-23 13:14:14 -08:00
Nathan Cahill 6d785ca081 support variables with dashes - fixes #9786 2014-12-16 20:58:38 -07:00
Nicolas Rémond 3cf0c09ce9 Variables lookup in a template should handle properly the undefined case 2014-12-12 12:11:17 +01:00
Brian Coca 97408fe5b2 Revert "Make listify respect the global setting for undefined variables."
This 'mostly' reverts commit 2769098fe7.

Conflicts:
	lib/ansible/utils/__init__.py
	test/units/TestUtils.py
2014-12-04 09:14:53 -05:00
Brian Coca e938f554b7 better exception handling for unexpected exceptions 2014-12-04 08:01:38 -05:00
Brian Coca f2b853f7a0 changed plugin load priority to be path based, not suffix based. 2014-12-01 17:36:57 -05:00
Brian Coca 9a5cbf747a fine tuned lookup/templating errors 2014-11-26 22:06:37 -05:00
Brian Coca db145a368d now only flattened ignores failonundefined cause of it's special need 2014-11-25 16:12:15 -05:00
Brian Coca e3feb104c3 fixes issues with listyfing failing too often 2014-11-25 15:55:53 -05:00
Brian Coca 7d2937b1cc minor fixes to template function
- make sure it calls itself correctly, now passes same params as it recieves
- vars is reserved, changed for templatevars to avoid confustion
- forcing mustaches again since the removal broke 'listification' as per #9622
- fixes incorrectly successful tests using undefined var, now it is defined
- now returns empty list if items is None to avoid errors
2014-11-25 12:59:13 -05:00
Toshio Kuratomi c4c3cc315d Transform both values of a task name into a byte str prior to comparing
Fixes #9571
2014-11-19 11:50:02 -08:00
Toshio Kuratomi 25607e5cf4 When run in FIPS mode, allow vault to fail only when using legacy format 2014-11-17 16:38:56 -08:00
Brian Coca 395952329a Merge pull request #9529 from sivel/env-nested-modules
Support nested modules with ANSIBLE_LIBRARY env var
2014-11-12 10:59:18 -05:00
Toshio Kuratomi 9a7eb57718 Some changes to FIPS compat since SLES implements it differently 2014-11-11 20:23:03 -08:00
Toshio Kuratomi 6a85f3ebc7 Add comments/docstrings not to use md5 unless forced to by forces outside our control. 2014-11-10 12:01:44 -08:00
Matt Martz 4c2d06d2fe Support nested modules with ANSIBLE_LIBRARY env var 2014-11-10 10:52:23 -06:00
Toshio Kuratomi f1267c0b05 Move from md5 to sha1 to work on fips-140 enabled systems 2014-11-06 21:28:04 -08:00
Brian Coca b3b356480d added the ability to keep aliased and deprecated modules prefixed with
'_', they will be loaded after non prefixed modules are checked they can
be full modules or symlinks to existing ones (alias)

also updated ansible doc to ignore these, will eventually add selective
display
2014-10-27 15:54:41 -07:00
James Cammarata 9ee3cd14ee Fix typo in vault edit helper code
Fixes #9399
2014-10-22 11:08:01 -05:00
Toshio Kuratomi 3d135f98d1 Small python3 compat in vault to keep code in sync with v2 2014-10-21 10:32:25 -04:00
Toshio Kuratomi da9d87b1d4 Make vault file creation use a tempfile 2014-10-21 00:32:08 -04:00
James Cammarata b61a78532c Catch template syntax errors specifically when templating strings
Fixes #9333
2014-10-20 13:11:20 -05:00
Toshio Kuratomi 48a308a87c Allow both old-style and new-style role dependencies to be valid.
Fixes #9173
2014-10-09 02:48:47 -04:00
Toshio Kuratomi c75aeca435 Merge removal of complex_args_hack 2014-10-08 15:03:43 -04:00
Toshio Kuratomi a10d10f647 Workaround more python-2.6 shlex not being able to handle unicode strings 2014-10-08 14:30:36 -04:00
Chris Church 8fb88be41b Simpler fix for module suffixes than c02e8d8c8. 2014-10-08 11:53:06 -04:00
Rob Howard 2769098fe7 Make listify respect the global setting for undefined variables.
(Fixes #9008.)

With credit to jimi-c for the initial pass in this commit:
b18bd6b98e
2014-10-08 13:47:11 +11:00
James Cammarata 05644686de Fix bug in plugin path caching
Fixes #9263
2014-10-04 21:47:38 -05:00
Toshio Kuratomi cef2a8795f Make dynamic inventory return byte str, not unicode 2014-10-02 20:27:06 -04:00
James Cammarata d99e4f15c8 Merge pull request #9220 from jlaska/devel
Resolve issue where repo_path contains multiple '.git' strings
2014-10-01 14:23:23 -05:00
Toshio Kuratomi 0af750e3e5 Merge pull request #9182 from bbasleeper/feature_sudo_exe_from_inventory
Add a new inventory parameter (ansible_sudo_exe) to specify sudo command...
2014-09-30 14:55:46 -04:00
James Cammarata 05994cd900 Don't clear paths when adding a new directory path in PluginLoader 2014-09-30 09:43:40 -05:00
James Laska 684352926b Resolve issue where repo_path contains multiple '.git' strings
If the repo_path contained multiple '.git' strings, the _git_repo_info()
call resulted in a traceback.  This change removes the trailing '.git'
and resolves the traceback.
2014-09-30 10:33:42 -04:00
Michael DeHaan c02e8d8c80 Don't search powershell modules unless using the winrm connection. 2014-09-28 12:17:03 -04:00
Michael DeHaan 3908d50b03 Tolerate no module search path. 2014-09-28 12:10:36 -04:00
Michael DeHaan 1d17881960 Add module search path to --version output. 2014-09-28 11:39:04 -04:00
Michael DeHaan 21c3784a43 If submodules are not found, don't error out. 2014-09-28 11:25:04 -04:00
Will Thames 952a36920c Cater for uninitialized submodules
Output a useful message if `git submodule update --init --recursive` not
yet performed

```
$ ansible --version
ansible 1.8 (submodule_ansible_version 59ae596484) last updated 2014/09/28 13:20:51 (GMT +1000)
  lib/ansible/modules/core: (detached HEAD 617a52b20d) last updated 2014/09/28 13:15:25 (GMT +1000)
  lib/ansible/modules/extras:  not found - use git submodule update --init lib/ansible/modules/extras
```
2014-09-28 11:25:04 -04:00
Will Thames d1476aeb01 Updated version info to include submodule information
`ansible --version` etc. now include information about submodules

```
ansible 1.8 (submodule_ansible_version ffee9a8fe0) last updated 2014/09/28 11:03:14 (GMT +1000)
  lib/ansible/modules/core: (ec2_snapshot_remove 3a77c31ecb) last updated 2014/09/27 18:23:31 (GMT +1000)
  lib/ansible/modules/extras: (detached HEAD 110250d344) last updated 2014/09/27 14:33:42 (GMT +1000)
```

Also improved handling of detached HEAD when printing out version
information.
2014-09-28 11:25:04 -04:00
Bruno BAILLUET a25da4af05 Add a new inventory parameter (ansible_sudo_exe) to specify sudo command path. 2014-09-27 17:39:49 +02:00
Michael DeHaan e5116d2f9b changes for package loading of modules 2014-09-26 11:25:56 -04:00
Michael DeHaan 25cc79e2db Modules is a package. 2014-09-26 10:55:00 -04:00
James Cammarata 128c10b311 Don't template 'vars' dictionary during templating
Fixes #9132
2014-09-25 14:46:16 -05:00
James Cammarata 889dfc4374 Merge pull request #8959 from willthames/galaxy_ssh_clone
Allow fairly common ssh repo clone path to work
2014-09-23 14:58:29 -05:00
James Cammarata 9d45f3a65e Before decrypting check if vault password is set or error early
Fixes #8926
2014-09-19 15:10:30 -05:00
James Cammarata b376e208c7 Adding "follow" param for file/copy options
Also modifies the template action plugin to use this new param
when executing the file/copy modules for templating so that links
are preserved correctly.

Fixes #8998
2014-09-16 12:05:55 -05:00
Michael DeHaan d6e6d2a6ca Remove regex related to baby-JSON parsing only. 2014-09-11 13:30:10 -04:00
Michael DeHaan 26cdddaebf Tracebacks are now catchable with ignore_errors and have streamlined output. Also removes 'baby-JSON' for bash modules. 2014-09-11 12:27:21 -04:00
Will Thames d6a725659e Allow github style ssh repo names 2014-09-10 21:55:27 +10:00
Will Thames 537472f42c Make ansible-galaxy work as expected
This change fixes hg galaxy roles
Roles also get installed if roles path is missing, which
the tests currently require (fixes #8950)
2014-09-10 09:16:30 +10:00
Niko Felger fa74a5c806 Fixing issue with symlinked vaults 2014-09-08 16:10:18 +02:00
James Cammarata 8cc3543918 Re-allow templating of complex_args, but count params to prevent injection
Fixes #8810
2014-09-05 14:24:05 -05:00
James Cammarata 04da466c7b Fixing up serialize_args utility function 2014-08-27 10:20:07 -05:00
James Cammarata e99db078b4 Additional fixes for the new omit parameter variable 2014-08-27 10:06:55 -05:00
Victor Lin 559c04f324 Implement omit for module args, also add tests for it 2014-08-27 10:04:47 -05:00
Victor Lin 0b4d7f1574 Implement default omit filter 2014-08-27 10:03:07 -05:00
James Cammarata 811ff49f78 Updating CHANGELOG for new symbolic mode feature and updating file docs 2014-08-25 23:47:41 -05:00
y_nk affdadda25 handling case of space in path (given would start with single quote) 2014-08-25 21:26:47 +05:30
Michael DeHaan 8a0045baad Update tests for ansible-galaxy CLI additions. 2014-08-22 14:01:15 -04:00
Michael DeHaan d87830e1cc Merge branch 'galaxy_github_archive' of git://github.com/willthames/ansible into devel
Conflicts:
	lib/ansible/utils/__init__.py
2014-08-22 13:58:50 -04:00
James Cammarata d01188033f Checking for localized versions of the su password prompt
Fixes #8681
2014-08-22 09:59:40 -05:00
Michael DeHaan 0286c31e85 Assume master branch for downloads if not specified. 2014-08-22 10:01:13 -04:00
Michael DeHaan 0cd40fc372 Remove debug 2014-08-22 09:58:27 -04:00
Will Thames 850963790d Allow roles to be installed from archives on github
Ensure that the automated scm determination for github.com
repos still copes with .tar.gz archive files.

Handling .zip archives is left as an exercise for the interested reader
2014-08-22 10:06:21 +10:00
Michael DeHaan bcb44276fe Assume github.com URLs are git protocol if not specified. 2014-08-21 17:15:23 -04:00
Michael DeHaan 68e21aa4b0 Add comments about what these new functions do. 2014-08-21 17:15:23 -04:00
Will Thames 6e9abefc11 Corrected bug where role_path was wrong for roles in subdirectories
Fixed role name for
    - { role: 'lives/in/a/subdirectory' }
Should be 'lives/in/a/subdirectory', not just 'subdirectory'
2014-08-21 17:15:23 -04:00
Will Thames ada9074276 Allow installation of roles from yaml roles file
Added docs
Added more tests
Improved how roles are returned from the parsers
2014-08-21 17:15:23 -04:00
Will Thames 46b59b02ed Friendly Role Names and roles from URLs
* Roles can now be given a friendly name as third field in role spec csv
* Roles can be installed from URL (not just from archived SCMs)
* Integration tests to demonstrate this
* Unit tests to ensure that role spec parsing works as expected
2014-08-21 17:15:23 -04:00
Will Thames 4803e923ff Improved handling of role_version in repo_url_to_role_name 2014-08-21 17:15:23 -04:00
Will Thames c2fe33f9f4 Tidied up a little, added tests
Moved repo_url_to_role_name to common method in ansible.utils
Added unit test for repo_url_to_role_name
Added integration tests for galaxy
2014-08-21 17:15:23 -04:00
James Cammarata bae73e5793 Merge branch 'alozovskoy-alozovskoy-debug-ascii-patch' into devel 2014-08-21 15:57:43 -05:00
James Cammarata 4fafd3baa8 Add error checking around json.dumps when not forcing ascii mode 2014-08-21 15:52:36 -05:00
James Cammarata b81e77cfec Tweak error language in dict validation 2014-08-21 13:24:53 -05:00
Serge van Ginderachter b8d057296a variable merging: detect if both vars are really dicts when combining/merging dicts 2014-08-21 18:06:02 +02:00
James Cammarata 8a1fbed5d6 Correct variable blending from vars_files with hostvars in them
Fixes #8638
2014-08-20 15:49:01 -05:00
James Cammarata 379e31883c Fix check mode issues with copy module
Fixes #8639
2014-08-18 16:02:45 -05:00
Michael DeHaan 99c39b1ff3 By popular request, make the no_log attribute also censor tasks from callbacks. 2014-08-12 13:36:05 -04:00
Jakub Paweł Głazik 99a339fa7b Fix comments and error message 2014-08-11 16:02:10 -04:00
Jakub Paweł Głazik 58feee0f45 ansible-vault view - new command 2014-08-11 16:02:10 -04:00
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
Alexander Lozovskoy 5165dfa2df Issue with printing unicode non-english characters #8425 patch 2014-08-06 12:38:14 +04: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
James Cammarata 1e672a0fec Fixes for su on freebsd
Addresses multiple issues when using su on freebsd including
* su prompt differs between platforms, so turned that check into a
  regex comparison instead of a simple string comparison
* not using '-c' after su causes problems, so added that for all
  platforms
* fixed quoting issues due to multiple uses of '-c' introduced by
  the above fix

Fixes #7503
Fixes #7507
2014-05-23 10:06:09 -05:00
James Cammarata 7faecd54b0 Merge pull request #7388 from jimi-c/issue_7384_vars_files_include
Pass vars_files on to included playbooks too
2014-05-14 14:52:33 -05:00
James Cammarata a9311a5dcb Merge branch 'file_new_dirs_perms' of https://github.com/bcoca/ansible into bcoca-file_new_dirs_perms 2014-05-14 13:53:08 -05:00
James Cammarata 85bd6810bb Pass vars_files on to included playbooks too
Fixes #7384
2014-05-14 08:37:47 -05:00
Brian Coca 8a84b22d76 bumped to 1.7 2014-05-06 23:43:07 -04:00
Christian Berendt 6676720ce5 fixed typos found by RETF rules in PY files
rules are avaialble at https://en.wikipedia.org/wiki/Wikipedia:AutoWikiBrowser/Typos
2014-05-03 18:40:05 +02:00
James Cammarata 8e45fa9b63 Moving display-related functions to new module in utils 2014-04-30 15:33:46 -05:00
James Cammarata 6069ff6e9e Adding a new system_warnings config option to supress warnings 2014-04-30 14:44:10 -05:00
James Cammarata 4cadcccc48 Catch pycrypto warning about gmp and show a nice warning on stderr 2014-04-29 14:28:14 -05:00
James Cammarata 1576e8d611 Adding missing options to the file documentation fragment 2014-04-28 15:31:24 -05:00
Brian Coca c5d5481ebb added doc noting the change in behaviour 2014-04-27 09:37:44 -04:00
James Cammarata b9d8b3b911 Merge pull request #7132 from jimi-c/issue_6601_hide_vault_yaml
Hide YAML content on syntax errors when a vault password is specified
2014-04-24 00:28:12 -05:00
James Cammarata 460794d697 Merge pull request #7140 from jimi-c/issue_6962_traceback_callbacks_unicode
Fix handling of non-JSON lines in responses
2014-04-23 19:53:42 -05:00
James Cammarata 5e598c5337 Fix handling of non-JSON lines in responses
Garbage lines with ' = ' in them were causing parsing errors,
where key=val lines should not have spaces around the equals.

Fixes #6962
2014-04-23 15:17:31 -05:00
James Cammarata 93b5769d94 Hide YAML content on syntax errors when a vault password is specified
Fixes #6601
2014-04-23 09:23:07 -05:00
James Cammarata 75e0b7a5cf Make sure umask is set restrictively before creating any vault files 2014-04-18 13:38:59 -05:00
James Cammarata 2cc4ac2e75 Catch traceback caused by permissions errors during a local md5 sum
Fixes #6948
2014-04-14 12:41:21 -05:00
willthames 509561f658 Moved AWS modules over to common module fragments
Created common module doc fragment, and applied to all
modules that use ec2_connect or connect_to_aws as
they definitely share the common doc fragments
2014-04-09 21:19:12 +10:00
James Tanner 2d33cd1b5d Fixes #6894 add missing file and remove debug line 2014-04-08 13:22:23 -04:00
James Tanner 68cd7258b6 Fixes #6894 create docs fragment for files 2014-04-08 13:20:15 -04:00
Serge van Ginderachter d240e2b9fb Introduce an ansible_version dict as runner variable
Given the version:
    "1.6 (ansible_version_var 14499e8bf3) last updated 2014/03/21 17:07:50 (GMT +200)"

  We get the special variable:
    "ansible_version": {
        "full": "1.6",
        "major": 1,
        "minor": 6,
        "revision": 0,
        "string": "1.6 (ansible_version_var 14499e8bf3) last updated 2014/03/21 17:07:50 (GMT +200)"
       }

	modified:   lib/ansible/playbook/__init__.py
	modified:   lib/ansible/runner/__init__.py
	modified:   lib/ansible/utils/__init__.py
2014-04-08 17:14:42 +02:00
James Tanner 5a65dc3b6a Fixes #6820 fix erroneous missing vault password error when using the template module 2014-04-04 13:06:35 -04:00
Michael DeHaan 1fa19e29e8 Use common file argument system previously implemented by @sivel for rax modules on the file modules as well (copy/file/template).
Application to other cloud providers would make very good sense.
2014-04-03 16:52:39 -04:00
Matt Martz 7b5f89ec7c Use PluginLoader for module docs fragments 2014-04-03 16:52:39 -04:00
Matt Martz bb6f7a267a Add support for shared module documentation fragments 2014-04-03 16:52:39 -04:00
James Cammarata ee0a0b492b Allow isprintable() util function to work with unicode
Fixes #6842
2014-04-03 15:29:51 -05:00
James Cammarata 6f34a6336f Differentiate decryption failures from empty data files in ansible-vault
Fixes #6822
2014-04-02 15:52:08 -05:00
James Cammarata a4df906fc9 Fixes to safe_eval 2014-04-01 16:23:22 -05:00
Cristian Ciupitu 1eaf85b89f Micro-optimization: replace s.find(x)!=-1 with x in s
timeit shows a speedup of ~3x on Python 2.7.5 x86_64.
It also makes the code a bit shorter.
2014-03-27 20:35:20 +02:00
James Tanner 2a976ac313 Fixes #5059 Ignore lookup failures when templating a task name 2014-03-26 11:28:43 -04:00
Serge van Ginderachter b0ff1ea425 performance optimisation in hash merge logic
rewrite deepcopy in util.merge_hash and just iterate
on an inventory with 500 groups and 800 hosts this brings back the
inventory initialisation from 13s to 3s (with hash_behaviour=merge)
2014-03-26 11:37:31 +01:00
Serge van Ginderachter d4634983f0 Move group/host_vars parsing into core inventory
modified:   lib/ansible/inventory/__init__.py
	deleted:    lib/ansible/inventory/vars_plugins/group_vars.py
	modified:   lib/ansible/utils/__init__.py
2014-03-26 11:37:26 +01:00
jctanner 7b8d1c0ffd Merge pull request #6580 from ramondelafuente/fix-vault-editor-call
Changed call to EDITOR to allow for parameters
2014-03-25 15:48:59 -04:00
Ramon de la Fuente c79c001bfb Changed call to EDITOR to allow for parameters
The EDITOR environment variable is used to create and edit files in the vault.
But if the EDITOR variable contains parameters, subprocess.call() breaks.

This fixes the EDITOR environment variable to be safely split into a list.
It adds a dependency on shlex.
2014-03-25 20:29:03 +01:00
James Cammarata 8c7828d469 Tweaking error message resulting from undefined template variables
Fixes #5114
2014-03-25 11:56:55 -05:00
Michael DeHaan c42dbf80a2 Merge pull request #6586 from sivel/probline-logic-fix
Fix logic in process_common_errors for unbalanced quotes
2014-03-19 17:45:49 -04:00
James Tanner b8f627d1d5 Prevent rewriting the encrypted file if decryption fails 2014-03-19 16:31:03 -04:00
James Tanner e71857fbdf Addresses #6579 Only strip vault passwords if given 2014-03-19 16:08:35 -04:00
James Tanner 8c2e1e2baa Addresses #6579 Disallow vault passwords with newline characters by stripping them in utils 2014-03-19 15:56:14 -04:00
James Cammarata a9000e7f3a Making the error messages for bad key/dir permissions more understandable
Fixes #6254
2014-03-19 14:09:03 -05:00
Matt Martz 2aaecc5afa Fix logic in process_common_errors for unbalanced quotes 2014-03-19 13:49:31 -05:00
Michael DeHaan 94e3350b38 Catch a unquoted line error. Fixes #6532 2014-03-17 17:15:42 -04:00
James Tanner ad70e9bcd6 Fixes #6227 skip non-unicode strings and catch decode errors silently in template_from_string 2014-03-17 16:54:25 -04:00
James Tanner b14c658532 Fix concatenation for with_file 2014-03-17 10:38:22 -04:00
Michael DeHaan fd0ff6f174 Merge pull request #5711 from sivel/plugin-realpath
Use realpath for plugin directories instead of abspath
2014-03-16 15:42:47 -05:00
Cristian Ciupitu 0749112286 Micro-optimization: replace s.find(x)!=-1 with x in s
timeit shows a speedup of ~3x on Python 2.7.5 x86_64.
It also makes the code a bit shorter.
2014-03-16 13:10:28 -04:00
Michael DeHaan d1753046e0 Revert "Correctly catch template errors without returning invalid data"
This reverts commit 3cd7d47b7e.
2014-03-13 07:46:19 -04:00
James Tanner 0e38f5dfdc Check for hash availability during vault operations 2014-03-12 09:38:29 -04:00
James Tanner 6740a1f342 Wrap crypto.hash imports with try/except 2014-03-10 19:44:08 -04:00
Michael DeHaan 2fa6110961 Update the message about pycrypto to include that python-devel must be installed. 2014-03-10 17:23:37 -04:00
James Tanner 0d6f6ad282 Implement new default cipher class AES256 2014-03-10 16:15:44 -05:00
Matt Martz 4b400ca5e9 Only used stripped data for testing if the file is json, but used unstripped when actually parsing. Fixes #6348 2014-03-10 13:43:34 -05:00
James Cammarata 3cd7d47b7e Correctly catch template errors without returning invalid data
Fixes #6329
2014-03-07 14:36:54 -06:00
Michael DeHaan e486dbab04 Use the loaded variable since we have it assigned, not just for error detection. 2014-03-06 22:15:21 -05:00
Michael DeHaan 3f07ec3d73 Fixup JSON error reporting in previous commits. 2014-03-06 22:07:35 -05:00
Michael DeHaan 79799f6819 Allow any file that can be in YAML to also be in JSON. This is primarily done to support non-visual editors better. 2014-03-06 21:42:51 -05:00
Michael DeHaan 94a7fb60fe Allow escaped comments in inventory files. 2014-03-05 20:10:25 -05:00
Richard C Isaacson b41d8106ff Revert "Merge pull request #6287 from risaacson/fix_hash_in_var"
This reverts commit a808287451, reversing
changes made to 6129ea7566.
2014-03-05 14:49:30 -06:00
Richard C Isaacson 38abd5e20e Break this out into a reusable function and document regex shortcomings. 2014-03-05 10:50:58 -06:00
Michael DeHaan 46ec8759d5 Remove the legacy templating code, which was guarded by deprecation warnings in the previous two releases, and undocumented for a long time. use {{ foo }} to access variables instead of ${foo} or $foo. 2014-02-28 18:38:45 -05:00
Richard C Isaacson 9c8bbe2904 column must always be less than len(probline)
Fixes related to GH-5773.
2014-02-26 16:28:34 -06:00
Richard C Isaacson 585766201d When looking for double colon len(line) is longer then 1.
Addresses GH-5116.

It comes up that when parsing json that if you are missing the last double quote on the last variable and the next line is just '}' we will get an out of range error. In this instance we will also then make sure that the line is long enough to have two colons.
2014-02-26 14:25:56 -06:00
James Tanner baed7a0ed9 Fixes #6187 Add unit tests for VaultLib 2014-02-26 12:10:09 -05:00
James Tanner 35def422a3 Addresses #6188 Add --vault-password-file to bin/ansible and bin/ansible-playbook 2014-02-26 11:01:03 -05:00
James Tanner 9c9f15acb7 Fix decryption error 2014-02-24 13:20:27 -05:00
James Tanner 52a8efefba Vault rewrite, pass 1 2014-02-24 13:09:36 -05:00
Michael DeHaan 9686695170 Assume empty files are unencrypted. 2014-02-21 21:06:04 -05:00
James Tanner bee089d5e1 Remove entropy comment 2014-02-19 13:36:20 -05:00
James Tanner 86b9f84fb9 Change entropy message for vault 2014-02-19 13:31:01 -05:00
James Tanner 3a965a1392 Remove intermediate string on decrypt 2014-02-19 11:35:00 -05:00
James Tanner 286ca505bd Remove breakpoint 2014-02-19 11:08:02 -05:00
James Tanner 84467a8f12 Change retype to confirm 2014-02-19 11:06:53 -05:00
James Tanner aa46ab1d86 Fix function name 2014-02-19 11:05:08 -05:00
James Tanner 3fc87e011b Fix all other calls to yaml 2014-02-19 11:01:21 -05:00
James Tanner 427b8dc78d Ansible vault: a framework for encrypting any playbook or var file. 2014-02-18 15:35:12 -05:00
James Cammarata b8646991db Filter out messages that match the pattern username:password@host
This filtering is done in both the module invocation logging and in
the regular verbose() logging output.

Fixes #4087
2014-02-13 14:23:49 -06:00
James Cammarata bbda98a3ee Merge branch 'issue_4812' into devel 2014-02-10 13:35:53 -06:00
James Cammarata bb79b16d59 Specify mode in the makedirs call for fireball/accelerate keys 2014-02-10 13:27:43 -06:00
xyrix 20d97416e5 fixed thinkoes 2014-02-06 13:02:11 +00:00
xyrix 0af40374ed fixed file perms checking 2014-02-06 12:48:34 +00:00
xyrix 1de45bf687 made accelerate keys directory configurable, and permissions for the file and dir configurable, and gave them a safe default 2014-02-06 08:53:43 +00:00
James Cammarata a72dc2ec34 Use finalize method in jinja2 to convert None values to empty strings
Fixes #4812
2014-02-06 00:43:31 -06:00
James Cammarata 959a156195 Properly count newlines appearing at the end of templates after rendering
Fixes #4633
2014-02-05 15:14:19 -06:00
jctanner 6c25ea1b91 Merge pull request #5527 from sergevanginderachter/basedirdwim
path_dwim: fix when basedir not set
2014-01-30 10:54:19 -08:00
James Cammarata 3fddd78ec5 Fixing traceback caused by incorrect argument passing to json.dumps
Fixes #5756
2014-01-27 11:28:07 -06:00
Matt Martz 5ba6739603 Use realpath for plugin directories instead of abspath 2014-01-21 12:41:58 -06:00
Paul Durivage f72f5a20df Revert "Revert "Merge pull request #5325 from angstwad/add-su-support""
This reverts commit c17d0e0357.

Conflicts:
	lib/ansible/runner/connection_plugins/paramiko_ssh.py
2014-01-20 19:19:03 -06:00
James Tanner c17d0e0357 Revert "Merge pull request #5325 from angstwad/add-su-support"
This reverts commit 6f4bfa2cff, reversing
changes made to c91ba3a7c7.
2014-01-20 16:10:11 -05:00
Paul Durivage 4088243deb Proposing fix for Issue #4324; adding support for su in connection plugins ssh, ssh_alt
Fixes for ssh_alt support, adding in references to in_data where appropriate
2014-01-20 11:25:10 -06:00
James Tanner d7c8cf6ca7 Fixes #4958 Truncate printed stdout if it contains non-printable characters 2014-01-10 15:08:45 -05:00
James Tanner 78ec7c736f Fixes #3973 Second Revision of live ansible-pull output 2014-01-10 11:18:02 -05:00
Serge van Ginderachter 836fb4143c path_dwim: fix when basedir not set 2014-01-08 02:21:10 +01:00
James Tanner d6b78e9dd6 Fixes #5238 Improve error messaging about unquoted variable references in playbooks 2014-01-06 16:47:19 -05:00
Michael DeHaan c41a23a35a Complete removal/refactoring of conditional deprecations. 2014-01-03 19:23:19 -05:00
Michael DeHaan 8e5b7d3095 Remove code underlying when_* and only_if, which are deprecated features slated for removal in the 1.5 release. 2014-01-03 19:13:21 -05:00
Michael DeHaan 28b9fd4e30 We have had only_if, when_foo, etc, deprecated for a while and said they would be removed in 1.5. Now they are, with friendly error messages still.
Users of these features should use "when:" as documented at docs.ansible.com.

Similarly, include + with_items has been removed.  The solution is to loop
inside the task files, see with_nested / with_together, etc.
2014-01-03 13:47:54 -05:00
James Tanner 21fdb2bbc7 Fixes #5200 Handle template contents with unicode strings better 2014-01-03 11:18:20 -05:00
Michael DeHaan de2ffc1276 Don't need to document these guys. 2014-01-02 17:55:59 -05:00
Janez Nemanic 8752ae6909 Fix for issue #4730 - stacktrace when deferenencing a non-existent group 2013-12-02 18:25:43 +01:00
James Cammarata 9101c2af98 Fix traceback in template error detection code
Fixes #5081
2013-11-29 08:47:54 -06:00
James Cammarata 1f80aa768a Fix bug in error detection code, where a zero-length string was causing a traceback
Fixes #5064
2013-11-27 11:57:15 -06:00
Antonio Zanardo 8dbd91b5ad fix typo in deprecation warning 2013-11-23 19:15:51 -02:00
Michael DeHaan fc909b453f Make the legacy template detection system not hit a false positive when
replacing a \$ with $.
2013-11-18 17:51:57 -05:00
jctanner 8e8c8efc8f Merge pull request #4769 from alanfairless/more-password-entropy-revised
Revised patch for more password entropy
2013-11-07 13:39:05 -08:00
jctanner 8d9b53b445 Merge pull request #4733 from sivel/4323-sudo-pass
Add ansible_sudo_pass hostvar support. Fixes #4323
2013-11-05 15:01:19 -08:00
Michael DeHaan eab6737209 Clarify a warning message. 2013-11-03 12:47:07 -05:00
Alan Fairless 0824f004d9 Revised patch for more password entropy 2013-11-01 09:51:35 -05:00
Michael DeHaan bbf212a268 Simplify the way the debug: var=varname plugin works. 2013-10-31 19:35:50 -04:00
Michael DeHaan 8b2cd6413b When inside an apt or yum task account for multiple conditionals. Fixes 4745. 2013-10-31 17:19:58 -04:00
Michael DeHaan 90cce35919 This allows variable references in playbooks in a different way. 2013-10-30 21:26:16 -04:00
Matt Martz ea2ec6237a Add ansible_sudo_pass hostvar support 2013-10-30 13:18:35 -05:00
James Tanner d154bf8781 Revert templating enhancements from 73dbab70 e6c28658 d409352c 9858b1f2 4587528b 9b1fe455 214b0b05 8d3db803 7f9504d1 5031104c 35cb9dc2 2bd8cb57 1e85c754 2013-10-30 10:50:16 -04:00
Michael DeHaan 73dbab702f Don't run lookup plugins while trying to simplify the input datastructure. 2013-10-28 09:08:53 -04:00
Michael DeHaan 4587528b99 Fix typo in comment. 2013-10-26 19:32:07 -04:00
Michael DeHaan d409352c85 Remove some interior imports in the code. Not really needed but nice to have them gone. 2013-10-26 19:26:43 -04:00
Michael DeHaan e6c28658b4 Add in some code to pre-template datastructures prior to template usage. This prevents a certain class of error
where filter evaluations can happen too early due to the template engine recursion being a bit limited.

Addresses #4662
2013-10-26 19:11:13 -04:00
Michael DeHaan 9858b1f2f3 Enable imports to work on a snippet based system, allowing for instance a library of common EC2 functions
to be reused between modules.  See library/system/service and library/system/ping for initial examples.  Can
work the old way to just import 'basic', or can import the new way to import multiple pieces of code from
module_utils/.
2013-10-26 11:09:30 -04:00
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