Commit Graph

1640 Commits (91a30e59e4606fde6cc9aece0e45b8f57b4bb7a3)

Author SHA1 Message Date
Tom Melendez 91a30e59e4 Changes to enable make gce to run. Added sys import so libcloud error is displayed; renamed credentials keys in template file so they work properly with gce_credentials.py. (#16607) 8 years ago
Toshio Kuratomi 8af8eec789 Merge pull request #17590 from abadger/vault-fixes
Vault fixes
8 years ago
Matt Clay 355b29573c Use default on undefined vars in tests. (#17601) 8 years ago
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().
8 years ago
Toshio Kuratomi 0139298786 Have unittests import mock from ansible.compat so they work on py3 without mock installed from pypi 8 years ago
Matt Clay 16baef1f72 Do not use bare vars in integration tests. (#17599) 8 years ago
Matt Davis f497d771c8 win_shell/win_command changes + tests (#17557) 8 years ago
Matt Clay 7b3cbafbe9 Add python 3 awareness to apt module tests. (#17574)
Also remove unnecessary dependency from ubuntu1604py3 Dockerfile.
8 years ago
Matt Clay bcb49fecb5 Add tool for downloading Shippable logs. 8 years ago
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
8 years ago
René Moser 28feba2fb3 jenkins_job: extend integration tests (#17558) 8 years ago
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.
8 years ago
Michael Scherer e9ffe2062f Add test for the pause in loop feature (#17336)
See https://github.com/ansible/ansible/pull/17289
8 years ago
René Moser 6a3e948a7c jenkins_job: add integration tests (#17499) 8 years ago
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.
8 years ago
nitzmahone 69880f1640 add win_user regression tests
Ensure https://github.com/ansible/ansible-modules-core/issues/4369 doesn't occur again, also adds tests for password set when expired.
8 years ago
Matt Clay c81fe70fbf Enable more integration tests for python 3. (#17473)
* Enable more integration tests for python 3.
* Split out python 3 integration tests.

Now that we're running more integration tests on python 3, the
tests are taking long enough that they warrant splitting out in
the same way the python 2 tests are split.
8 years ago
Matt Clay 784810a84c Add python 3 support to test_apt_repository. (#17472) 8 years ago
Matt Clay a1947401ba Enable more tests that pass on python 3. (#17471)
* Enable more tests that pass on python 3.
* Disable test_apt_repository for python 3.
8 years ago
Matt Clay eb26616b09 Add python3-apt to ubuntu1604py3 Dockerfile. 8 years ago
Toshio Kuratomi 4ed88512e4 Move uses of to_bytes, to_text, to_native to use the module_utils version (#17423)
We couldn't copy to_unicode, to_bytes, to_str into module_utils because
of licensing.  So once created it we had two sets of functions that did
the same things but had different implementations.  To remedy that, this
change removes the ansible.utils.unicode versions of those functions.
8 years ago
nitzmahone 7a9395b5e0 disable windows loop async test
Fails pretty regularly on Shippable/AWS, never locally- always seems to be on the last async task in the loop.
8 years ago
Matt Davis f239e1e61f windows async changes and tests (#17400) 8 years ago
Matt Clay 94a0d2afb4 Add partially backwards compatible version of _fixup_perms. (#17427)
Also added a deprecation notice for _fixup_perms.

Resolves issue #17352 (assumes custom actions use recursive=False).
8 years ago
jhawkesworth 9fe4308670 add very basic tests of win_package, based on existing win_msi tests. (#17383)
* add very basic tests of win_package, based on existing win_msi tests.
8 years ago
Toshio Kuratomi d6ebf9bdc6 Symink integration tests for fetch and stat 8 years ago
Michael Scherer 918d1e038e Do not hardcode python executable in test (#17380)
Based on https://github.com/ansible/ansible/pull/17376
8 years ago
Matt Clay 4ae59b2743 Use ansible_python for interpreter in test_uri. (#17376) 8 years ago
Matt Clay 7cd988f60c Enable more integration tests for python 3. (#17375)
The test_async test target was updated to accommodate changes in
output buffering behavior in python 3. This change in behavior
may need to be addressed in the future.
8 years ago
Toshio Kuratomi f7b22a5eaa Fix paramiko's exec_command() to return bytes on python3 (#17372)
* Fix paramiko's exec_command() to return bytes on python3

* Run test_connection for python3 now too

* Fix atomic_move for problem in shippable's testing

* Python-2.4 needs to use b()
8 years ago
Matt Clay 75cb27ffe3 Enable more python 3 tests that now pass. (#17359) 8 years ago
Will Thames d54f5277d5 Add ksu privilege escalation (#17340)
Allow ksu privilege escalation to be used
as a standard become_method

https://web.mit.edu/kerberos/krb5-1.12/doc/user/user_commands/ksu.html
8 years ago
Michael Scherer 529950680b Disable yum test on python 3 (#17327)
Since yum is not gonna be running on python3 ever, we have to filter it.
8 years ago
Tobias Wolf c23b11d212 [Inventory] Cache the result of enumerating groups and host names
for `VariableManager._get_magic_variables()`.

This saves a lot of time re-iterating the nearly always constant global
list of groups and their members.

Generate once and cache, and invalidate cache in case `add_host:` or
`group_by:` are used.
8 years ago
Toshio Kuratomi 28227546fa Various python3 updates for module_utils: (#17345)
* Port set_*_if_different functions to python3
* Add surrogate_or_strict and surrogate_or_replace error handlers for
  to_text, to_bytes, to_native
* Set default error handler to surrogate_or_replace
* Make use of the new error handlers in the already ported code
* Move the unittests for module_utils._text as they aren't in basic.py
* Cleanup around SEQUENCETYPE.  On python2.6+ SEQUENCETYPE includes
  strings so make sure code omits those explicitly if necessary
* Allow arg_spec aliases to be other sequence types
8 years ago
Matt Clay 2ffb136b3f Add support for testing module PRs with python3. (#17339) 8 years ago
Gennady Trafimenkov 2e857cfafd Add mention of integration tests in Docker containers (#16661)
It is quite convinient and easy to run integration tests in Docker containers.

I hope it can motivate more people to write integration tests.
8 years ago
Matt Clay 6e65ebda26 Put integration.sh pip reqs in separate file. (#17338) 8 years ago
Jonathan Mainguy a4cee11649 Add test for specific privlege grants on database.table (#17328)
For the mysql_user module
8 years ago
Jonathan Mainguy 2248d2464b add unit test for mysql_user (#17335)
this removes all blank users, and then does so again
to ensure changed the first time and ok the second time
8 years ago
James Cammarata b71957d6e6 Move queuing tasks to a background thread 8 years ago
Michael Scherer 878d0d5b87 Running the test with a locale other than English make that test fail
While tests are supposed to be run in docker, people might still
want to use them on their own boxes.
8 years ago
Allen Sanabria 03132041fb Include vars updated to work with directories (#17207)
* New features for include_vars

include_vars.py now allows you to include an entire directory and its nested directories of variable files.

Added Features..

* Ignore by default *.md, *.py, and *.pyc
* Ignore any list of files.
* Only include files nested by depth (default=unlimited)
* Match only files matching (valid regex)
* Sort files alphabetically and load in that order.
* Sort directories alphabetically and load in that order.

```
    - include_vars: 'vars/all.yml'

    - name: include all.yml
      include_vars:
        file: 'vars/all.yml'

    - name: include all yml files in vars/all and all nested directories
      include_vars:
        dir: 'vars/all'

    - name: include all yml files in vars/all and all nested directories and save the output in test.
      include_vars:
        dir: 'vars/all'
        name: test

    - name: include all yml files in vars/services
      include_vars:
        dir: 'vars/services'
        depth: 1

    - name: include only bastion.yml files
      include_vars:
        dir: 'vars'
        files_matching: 'bastion.yml'

    - name: include only all yml files exception bastion.yml
      include_vars:
        dir: 'vars'
        ignore_files: 'bastion.yml'
```

* Added whitelist for file extensisions (yaml, yml, json)

* Removed unit tests in favor of integration tests
8 years ago
René Moser 26118a51f8 exo_dns: new module utils and integration tests for exoscale DNS (#17230) 8 years ago
Michael Scherer d8f66defd0 Ignore difference on whitespace (#17302)
While trying to fix the test suite on python3, I noticed
this test fail due to to_json adding more whitespace in
python3 than in python2. So -w should ignored those
differences.
8 years ago
Matt Davis 1c33b5a9f0 fix remote shippable target failures (#17287)
cryptography upgrade caused fatal error when pycrypto was not installed
8 years ago
Toshio Kuratomi fa804125b5 Python3 fixes and porting (#17271)
* Fix to_native call in selinux_context and selinux_default_context to
  use the error handler correctly.
* Port set_mode_if_different to work on python3
* Port atomic_move to work on python3
* Fix check_password_prompt variable which wasn't renamed properly
8 years ago
Alexander Stock 238cccf166 Fix "Text file busy" exception in atomic_move (#9526) (#17204)
tempfile.NamedTemporaryFile keeps a file handle causing os.rename() to fail with windows based vboxfs: [Errno 26] Text file busy.
Changed NamedTemporaryFile to mkstemp() and added a finally block to unlink the temp file in each and every case.
8 years ago
Toshio Kuratomi 4a3a9c0f2d Fix for run_command on py3 and enable lineinfile test on py3 (#17257)
* run_command needed a bit of tweaking to its string handling of
  arguments.
* The run_command change fixes the last bit of lineinfile so we can
  enable its tests
8 years ago
Toshio Kuratomi bd68c324ce Get the ssh plugin working with python3 (#17234) 8 years ago