Commit graph

7704 commits

Author SHA1 Message Date
Toshio Kuratomi
8af8eec789 Merge pull request #17590 from abadger/vault-fixes
Vault fixes
2016-09-15 18:39:34 -07:00
Toshio Kuratomi
e70066a6f7 Many Cleanups to vault
* Make is_encrypted_file handle both files opened in text and binary mode
  On python3, by default files are opened in text mode.  Since we know
  the encoding of vault files (and especially the header which is the
  first set of bytes) we can decide whether the file is an encrypted
  vault file in either case.
* Fix is_encrypted_file not resetting the file position
* Update is_encrypted_file to check that all the data in the file is ascii
* For is_encrypted_file(), add start_pos and count parameters
  This allows callers to specify reading vaulttext from the middle of
  a file if necessary.
* Combine VaultLib.encrypt() and VaultLib.encrypt_bytestring()
* Change vault's is_encrypted() to take either text or byte strings and to return False if any part of the data is non-ascii.
* Remove unnecessary use of six.b
* Vault Cipher: mark a few methods as private.
* VaultAES256._is_equal throws a TypeError if given non byte strings
* Make VaultAES256 methods that don't need self staticmethods and classmethods
* Mark VaultAES and is_encrypted as deprecated
* Get rid of VaultFile (unused and feature implemented in a different way)
* Normalize variable and parameter names on plaintext, ciphertext, vaulttext
* Normalize variable and parameter names on "b_" prefix when dealing with bytes
* Test changes:
  * Remove redundant tests( both checking the same byte string)
  * Fix use of format string without format operator
  * Enable vault editor tests on python3
  * Initialize the vault_cipher for VaultAES256 testing in setUp()
  * Make assertTrue and assertFalse take the actual method calls for
    better error messages.
  * Test that non-ascii byte strings compare correctly.
  * Test that unicode strings and ints raise TypeError

* Test-specific:
  * Removed test_methods_exist().  We only have one VaultLib so the
    implementation is the assurance that the methods exist. (Can use an abc for
    this if it changes).
  * Add tests for both byte string and text string input where the API takes either.
  * Convert "assert" to unittest assert functions or add a custom message where
    that will make failures easier to debug.
  * Move instantiating the VaultLib into setUp().
2016-09-15 15:22:06 -07:00
jctanner
b93de25204 During initial argument evaluation, cast args to string. (#17595)
Later in the stack, further code will check and inform the user that var names must start with a letter
or underscore, so this fix only allows us to get to that previously existing policy.

Fixes #16008
2016-09-15 16:41:11 -04:00
Adrian Likins
2c54a8471f Improve inventory script error messages. (#17589)
When an inventory file looks executable (with a #!) but
isn't, the error message could be confusing. Especially
if the inventory file was named something like 'inventory'
or 'hosts'. Add some context and quote the filename.

This is based on https://github.com/ansible/ansible/pull/15758
2016-09-15 15:42:57 -04:00
Matt Davis
f497d771c8 win_shell/win_command changes + tests (#17557) 2016-09-15 11:25:56 -07:00
Senthil Kumar Ganesan
81072fcba1 Added support OS9 facts (#17591) 2016-09-15 19:22:23 +01:00
Toshio Kuratomi
ebc4d577de Update submodule refs 2016-09-15 09:58:59 -07:00
Brian Coca
cb071e043c updated subrefs 2016-09-15 11:43:50 -04:00
Monty Taylor
cd6e01349e Ensure parent tempdir's existence (#17585)
While doing evil things with action plugins, I hit a code path in which
the mkdir here was failing due to lack of parent dir. Changing this to
makedirs made everything happy. Now, I'd obviously like to understand
why the parent dir exists in some places and not others - but I could
not find anywhere that C.DEFAULT_LOCAL_TMP is ensured to be created.
2016-09-15 09:57:15 -04:00
Toshio Kuratomi
70e63ddf6c Fix cow mode to work with unicode task and play names (#17576)
Fixes #17560
2016-09-14 20:02:35 -07:00
Matt Clay
6787fc70a6 Update submodule refs. 2016-09-14 13:28:34 -07:00
Senthil Kumar Ganesan
68f1705d18 Add action plugin for dnos6_config module (#17553) 2016-09-14 20:55:45 +01:00
Senthil Kumar Ganesan
7d9b07382b Add action pluging for dnos9_template module (#17549) 2016-09-14 20:40:55 +01:00
Senthil Kumar Ganesan
564e02c3c3 Add action plugin for dnos6_template module (#17554) 2016-09-14 20:37:56 +01:00
Senthil Kumar Ganesan
daba7fa057 Moved the dnos10_template.py action plugin to the correct directory (#17550) 2016-09-14 20:28:01 +01:00
Toshio Kuratomi
f4cd1c6321 Fix galaxy's parsing of the command line. (#17569)
Also make the parsing of the action in both galaxy and vault more
robust.

Fixes #17534
May Fix #17563
2016-09-14 11:49:54 -07:00
Adrian Likins
8438da2a34 Make jsonfile cache plugin errors less vague. (#17568) 2016-09-14 14:10:12 -04:00
Adrian Likins
c633022fca [wip] Let jsonfile and memcached cache plugins understand fact_caching_timeout=0 (#17565)
* Add support for no-expiration to jsonfile cache

* Let memcached cache use fact_caching_timeout=0

If fact_cache=memcached and fact_caching_timeout=0
memcached would hit a NameError on _expire_keys
2016-09-14 13:27:42 -04:00
Ryan S. Brown
0bda419f66 Allow AWSRetry class to be created without boto3/botocore installed 2016-09-14 11:34:10 -04:00
Brian Coca
4656b6a846 added msg info to unreachable for oneline callback
fixes #17367
2016-09-14 11:33:01 -04:00
Adam Reznechek
23930d799f Fix cpu facts for hosts missing fields in cpuinfo (16533) (#16535)
Change linux fact gathering to correctly gather ansible_processor_count
and ansible_processor_vcpus on systems without vendor_id/model_name in
/proc/cpuinfo (for ex, ppc64/POWER)
2016-09-13 17:19:33 -04:00
Allen Sanabria
b510abce17 CloudRetry/AWSRetry backoff decorator with unit tests (#17039)
* Added aws_retry decorator function with unit tests

* Restructured the code to be used with a base class.

This base class CloudRetry can be reused by any other cloud provider.
This decorator should be used in situations, where you need to implement
a backoff algorithm and want to retry based on the status code from the
exception.

* updated documentation

* fixed tabs

* added botocore and boto3 to requirements.txt

* removed cloud.py from py24 tests, as it depends on boto3

* fix relative imports

* updated test to be 2.6 compat

* updated method name from retry to backoff

* readded lxd

* Updated default backoff from 2 seconds to 1.1s.

This will be about a total of 48 seconds in 10 tries. This is
configurable.
2016-09-13 16:46:59 -04:00
Brian Coca
60706cc12e doas update (#16997)
hopefully fixes #15597
2016-09-13 16:17:24 -04:00
Peter Sprygada
760fff8564 Merge pull request #17546 from skg-net/dnos9_config
Added support for dnos9_config module
2016-09-13 15:01:10 -04:00
Brian Coca
db8c952ee3 added new ksu method to man page
removed runas refrences, because it was never implemented
2016-09-13 14:40:41 -04:00
Nathaniel Case
5331dd482c Cleanup eos (#17548) 2016-09-13 14:29:06 -04:00
Senthil Kumar Ganesan
c6acf44a7c Added support for dnos9_config module 2016-09-13 10:42:12 -07:00
Nathaniel Case
8b3ae1e806 Cleanup netcfg.py (#17531)
Closes #17412
2016-09-13 13:40:32 -04:00
Brian Coca
7450629733 better display for free strategy (#17355) 2016-09-13 12:59:32 -04:00
John R Barker
e326da28ff eos: cmd should be item (#17540)
Was changed during
7fe64ef9b8
however not all look variables were updated.
2016-09-13 17:17:35 +01:00
Abhijit Menon-Sen
07756a4265 Remove extraneous . from VALID_FILE_EXTENSIONS
Otherwise if you «include_vars: vars.json», you get this error:

    "message": "/path/to/vars.json does not have a valid extension: yaml, yml, .json"
2016-09-13 19:41:26 +05:30
Toshio Kuratomi
b0d81a43d7 Update submodule refs 2016-09-13 07:07:12 -07:00
Brian Coca
8ebd8ca259 updated solaris virtualization detection (#17464)
avoid prtdiag since it seems to hang and require service restarts
hopefully fixes #4583
2016-09-13 09:03:05 -04:00
Nathaniel Case
036650cb09 Cleanup junos (#17530)
Closes #17411
2016-09-12 17:42:26 -04:00
Peter Sprygada
076a821821 Merge pull request #17468 from skg-net/dnos9_command
dnos9_command (new module)
2016-09-12 17:04:17 -04:00
Nathaniel Case
bfe341177b Cleanup netcli (#17529)
This honestly mostly amounts to Python 3 fixes.
2016-09-12 16:08:21 -04:00
Toshio Kuratomi
bf29961947 Fixes to the controller text model (#17527)
* Fixes to the controller text model

* Change command line args to text type
* Make display replace undecodable bytes with replacement chars.  This
  is only a problem on pyhton3 where surrogates can enter into the msg
  but sys.stdout doesn't know how to handle them.
* Remove a deprecated playbook syntax in unicode.yml

* Fix up run_cmd to change its parameters to byte string at appropriate times.
2016-09-12 12:57:41 -07:00
Toshio Kuratomi
9868117d1f Update submodule ref for core to fix broken service module 2016-09-12 11:55:39 -07:00
Toshio Kuratomi
499b13d649 Update submodule refs 2016-09-12 11:32:08 -07:00
Senthil Kumar Ganesan
1c7c3cc878 Addressed review comments from @gundalow 2016-09-12 11:26:22 -07:00
Senthil Kumar Ganesan
3e18676af4 Addded support for dnos9_command module 2016-09-12 11:26:22 -07:00
Nathaniel Case
060ed665f6 Cleanup nxos
closes #17414
2016-09-12 14:20:50 -04:00
Peter Sprygada
5aa83041bf Merge pull request #17474 from skg-net/dnos6_command
Add module_utils/dnos6.py
2016-09-12 13:40:56 -04:00
Peter Sprygada
cc45506006 Merge pull request #17521 from privateip/fix-4797
raise exception when src file is not found in net_config
2016-09-12 13:40:01 -04:00
Nathaniel Case
fcd4be28ee Cleanup openswitch
Also bump get_config in vyos, to pick up the addition of **kwargs

Closes #17415
2016-09-12 13:35:57 -04:00
Senthil Kumar Ganesan
05e016e4aa Addressed @gundalow review comments 2016-09-12 10:08:10 -07:00
Senthil Kumar Ganesan
94df740ca3 Added support for dnos6_command module 2016-09-12 10:08:10 -07:00
Toshio Kuratomi
6117e1946e Check controlpersist (#17443)
* Add a new config option to cache the check for controlpersist on the
control machine.

Fixes #15844

* Remove the option and make the behavior the default

* Make the check for controlpersist cache its status per-ssh executable
2016-09-12 08:27:39 -07:00
Nathaniel Case
2077e32ddd Vyos cleanup
Addresses #17416
2016-09-12 11:19:09 -04:00
Peter Sprygada
16d6274276 raise exception when src file is not found in net_config
This will now raise an exception if the file path specified in src is not
found and the module will gracefully error.

ref #4797
2016-09-12 10:00:35 -04:00