Commit Graph

117 Commits (b0e1efbd62b683cd4ab9620372660ab11f139ce6)

Author SHA1 Message Date
Peter Oliver 95cfceda98 Catch DistributionNotFound when pycrypto is absent (#15731)
* Catch DistributionNotFound when pycrypto is absent

On Solaris 11, module `pkg_resources` throws `DistributionNotFound` on import if `cryptography` is installed but `pycrypto` is not.  This change causes that situation to be handled gracefully.

I'm not using Paramiko or Vault, so I my understanding is that I don't
need `pycrpto`.  I could install `pycrypto` to make the error go away, but:
- The latest released version of `pycrypto` doesn't build cleanly on Solaris (https://github.com/dlitz/pycrypto/issues/184).
- Solaris includes an old version of GMP that triggers warnings every time Ansible runs (https://github.com/ansible/ansible/issues/6941).  I notice that I can silence these warnings with `system_warnings` in `ansible.cfg`, but not installing `pycrypto` seems like a safer solution.

* Ignore only `pkg_resources.DistributionNotFound`, not other exceptions.
2016-05-19 11:39:34 -07:00
Brian Coca e0573d3099 make vi the default editor if no EDITOR
fixes #15577
2016-05-03 09:39:19 -04:00
Toshio Kuratomi b8a988e922 bytes when passing to os.path.* and opening the file, text at other times
Fixes #15644
2016-04-29 22:20:22 -07:00
Toshio Kuratomi e386a51cf8 Trnasform file name to bytes before opening it to avoid unicode errors if python tries to encode it implicitly 2016-04-19 08:33:01 -07:00
Brian Coca 5940d3d45b fixes to vault/copy
rm _del_ as it might leak memory
renamed to tmp file cleanup
added exception handling when traversing file list, even if one fails try rest
added cleanup to finally to ensure removal in most cases
2016-04-14 14:12:48 -04:00
Cambell cdf6e3e4bf feature/copy-vault-dataloader: Add method get_real_file(file_path) to dataloader
- get_real_file will decrypt vault encrypted files and return a path to
  a temporary file.

- cleanup_real_file will remove a temporary file created previously with
  get_real_file
2016-04-14 14:12:48 -04:00
James Cammarata f2713f764c Take previous jinja2 blocks into account in splitter when we see quotes
Previously, split_args() was not taking print/block/comment depth into account
when splitting things, meaning that if there was a quote character inside an
un-quoted variable (ie. {{ foo | some_filter(' ') }}), it was incorrectly
splitting on the quotes instead of continuing to append to the previous param.

Fixes #13630
2016-03-28 15:43:43 -04:00
Konstantin Suvorov 1c922135a0 show error context in args splitter exception 2016-03-24 16:50:21 +03:00
Toshio Kuratomi 2ba4428424 Catch ValueError as well because of El Capitan provoking a bug in python2's subprocess
Fixes #14895
2016-03-18 05:52:53 -07:00
Matt Clay 5b79ed77e7 Use to_bytes on filenames in filesystem calls. 2016-03-04 09:08:41 -08:00
Brian Coca e762095497 better task parsing errors
fixes #14790
2016-03-03 19:51:15 -05:00
Brian Coca cc3cb0f65e fix issues with older yaml lib versions
also added missing json import and removed unused ones
2016-03-03 18:13:36 -05:00
Brian Coca ea5e089056 restore initial json parsing attempt to loader
fixes issues with extra vars json strings not being parsed correctly by the yaml parser
2016-03-03 13:26:50 -05:00
Toshio Kuratomi 4657be4eab Transform pathnames to bytes before passing on to os.path functions 2016-03-03 09:03:28 -08:00
James Cammarata 7c049c3200 Fixing up jsonify and adding unit tests 2016-02-29 14:51:23 -05:00
Toshio Kuratomi 1f2595306a normalize path components to unicode before combining or operating on them
Note that this will break if we deal with non-utf8 paths.  Fixing this
way because converting everythig to byte strings instead is a very
invasive task so it should be done as a specific feature to provide
support for non-utf8 paths at some point in the future (if needed).
2016-02-26 10:29:37 -08:00
Toshio Kuratomi ef8bec18bf Use a unicode format string so that we don't convert to byte strings
Fixes #14349
2016-02-26 10:29:37 -08:00
Matt Martz 38b663471d Merge pull request #14311 from sivel/unsafe-yaml-constructor
Add new 'unsafe' YAML constructor
2016-02-23 11:29:53 -06:00
Brian Coca 0f73fb0d6f better error messages when failing to decrypt 2016-02-18 08:57:28 -08:00
Jonathan Davila b220051c14 Added more info to the no action detected error
Error fix
2016-02-08 16:51:10 -05:00
Matt Martz 8bc2d3be9c Add new 'unsafe' YAML constructor 2016-02-04 10:08:42 -06:00
Brian Coca db375c22af load now does not modify the incomming data
also removed json loader as yaml loader can do both
2016-01-28 19:43:17 -05:00
Brian Coca c063803a91 raise AnsibleError as an 'expected' exception
fixes #14065
2016-01-25 22:20:55 -05:00
Brian Coca f26adcc7da avoid shredding empty files, also x/0
also cleaned up unused import and exception var
2016-01-21 10:54:56 -05:00
James Cammarata 46e515131e Allow module args as k=v pairs when using the module: option with local_action
This task format is valid in 1.x, but was broken in 2.x:
  - local_action:
     module: shell echo "hello world"
2016-01-18 14:32:44 -05:00
Toshio Kuratomi 4958180333 use integer division instead of floating point division.
Fixes #13855
2016-01-13 12:35:28 -08:00
Eric Feliksik 11ce08b9dd cleaner implementation and random chunk length. 2016-01-05 18:04:38 +01:00
Eric Feliksik 151e09d129 use unix shred if possible, otherwise fast custom impl; do not shred encrypted file 2016-01-05 01:43:42 +01:00
Eric Feliksik 1e911375e8 add docs, remove unnecessary int() cast 2016-01-04 18:13:59 +01:00
Eric Feliksik 7193d27acc add os.fsync() so that the shredding data (hopefully) hits the drive 2016-01-04 17:22:18 +01:00
Eric Feliksik 946b82bef7 shred ansible-vault tmp_file. Also when editor is interruped. 2015-12-30 18:21:34 +01:00
Brian Coca 75e94e0cba allow for non standard hostnames
* Changed parse_addresses to throw exceptions instead of passing None
* Switched callers to trap and pass through the original values.
* Added very verbose notice
* Look at deprecating this and possibly validate at plugin instead
fixes #13608
2015-12-21 13:42:34 -05:00
James Cammarata 8716bf8021 All variables in complex args again
Also updates the CHANGELOG to note the slight change, where bare variables
in args are no longer allowed to be bare variables

Fixes #13518
2015-12-16 16:39:08 -05:00
James Cammarata 2b36343451 Missed one place we were appending the incorrectly escaped item to raw params 2015-12-09 17:58:44 -05:00
James Cammarata 1799de8528 Preserve original token when appending to _raw_params in parse_kv
Fixes #13311
2015-12-08 15:06:36 -05:00
Toshio Kuratomi a8e015cc22 Add representers so we can output yaml for all the types we read in from yaml 2015-12-06 22:17:47 -08:00
Monty Taylor d20e67d708 Put in trap for args being None
_normalize_old_style_args can return None. If it does, the loop
"for args in args" blows up.
2015-11-28 13:38:11 -05:00
Yannig Perré 2fc7c8b460 More restrictive test against variable name to allow setting variable starting with _. 2015-11-28 10:35:06 +01:00
Yannig Perré 2c54fb1339 Switch parameters validation after parsing in order to be more consistent between old and new style. 2015-11-26 13:33:58 +01:00
Matteo Acerbi 0127d32652 Fix DataLoader's docstring
DataLoader.__init__ doesn't take an argument named vault_password
2015-11-18 11:20:34 +01:00
Abhijit Menon-Sen 7caefa5cd9 Fix typo 2015-11-03 10:57:48 +05:30
Brian Coca 00bc74404a vault noe preserves permissions on edit and rekey and sets a restricitve default umask for all other cases 2015-10-31 14:13:03 -04:00
Toshio Kuratomi e3e2db1119 Improve the warning message about duplicate yaml dict keys 2015-10-27 14:20:36 -07:00
Toshio Kuratomi 4203850d1a Break apart a looped dependency to show a warning when parsing playbooks
Display a warning when a dict key is overwritten by pyyaml
Fixes #12888
2015-10-27 12:39:42 -07:00
James Cammarata 86de1429e5 Cleaning up FIXMEs 2015-10-22 16:03:50 -04:00
James Cammarata 0bbe9d5bd0 Make hostvars json/yaml serializable in filters
Fixes #12615
2015-10-18 10:09:05 -04:00
Toshio Kuratomi b23a083776 Make vault use a mapping of cipher name to classes instead of formatting the name for safety. 2015-10-16 10:05:27 -07:00
Toshio Kuratomi baa309309d Bundle a new version of python-six for compatibility along with some code to make it easy for distributions to override the bunndled copy if they have a new enough version. 2015-10-16 08:21:28 -07:00
Marius Gedminas 98958ec990 Simplify join expression 2015-10-16 17:39:27 +03:00
Marius Gedminas 56184a3d8c Python 3: avoid %-formatting of byte strings
This is needed for Python 3.4 compatibility; Python 3.5 can use
`b'%s\n' bytestring` again.
2015-10-16 17:18:35 +03:00