Commit graph

553 commits

Author SHA1 Message Date
Will Thames
5bb759e7ab Elevate privileges when checking for file existence
Certain OSs default to home directories as 0700
Without elevating privileges, checking for file existence
fails.
2015-11-11 23:42:35 +10:00
James Cammarata
23ff08ee6b Merge pull request #13016 from dvarrazzo/pip-vcs-changed
Added tests to verify pip installation with VCS urls
2015-11-05 08:16:12 -05:00
Will Thames
91b6004149 Allow blank lines and comments/spaces in galaxy spec files
Fixes #10641 again. (Regression)
Added test to discourage future such regression.
2015-11-04 15:36:20 +10:00
Daniele Varrazzo
542a430e84 Added tests to verify pip installation with VCS urls
The test reproduces:
- bug ansible/ansible#1705
- bug ansible/ansible-modules-core#1645
2015-11-03 14:54:40 +00:00
Brian Coca
c267e1906e removed invocation from tests as it is only available on very very verbose mode 2015-10-31 13:00:53 -04:00
Chris Meyers
4b88cce6a1 update ansible_test_service checksum 2015-10-28 14:55:13 -04:00
James Cammarata
1910f23144 Merge pull request #12801 from chrismeyersfsu/fix-test_destructive_init
run correct init system tests
2015-10-27 15:58:19 -04:00
James Cammarata
9b22004540 Merge pull request #12795 from chrismeyersfsu/fix-test_destructive_mysql_user
remove module param quotes
2015-10-27 15:51:45 -04:00
Toshio Kuratomi
ce2b18174e Merge pull request #12878 from ansible/invocation-fix
Invocation fix
2015-10-22 16:17:40 -07:00
Toshio Kuratomi
2e87c1f74e Two fixes to action plugins
* Fix the task_vars parameter to not default to a mutable type (dict)
* Implement invocation in the base class's run() method have each action
  module call the run() method's implemention in the base class.
* Return values from the action plugins' run() method takes the return
  value from the base class run() method into account so that invocation
  makes its way to the output.

Fixes #12869
2015-10-22 16:07:26 -07:00
James Cammarata
86de1429e5 Cleaning up FIXMEs 2015-10-22 16:03:50 -04:00
Toshio Kuratomi
ed6aa75d63 Add parsing test to travis to catch that invocation is missing 2015-10-22 09:03:12 -07:00
Toshio Kuratomi
6b6d03290a Restore the automatic addition of invocation to the output
Revert "Remove auto-added invocation return value as it is not used by v2 and could leak sensitive data."

This reverts commit 6ce6b20268.

Remove the note that invocation was removed as we've now restored it.

Revert "keyword not in ubuntu 14.04"

This reverts commit 5c01622457.

Revert "remove invocation keyword check"

This reverts commit 5177cb3f74.
2015-10-22 08:53:37 -07:00
Will Thames
002972c6cf Allow meta/main.yml to include roles through spec file
ansible-playbook now works when run with a playbook
that includes a role that includes another role
specified using csv format

Updated one of the roles used in the tests to fix
broken tests - `make test_galaxy` now works

Fixes #11486. Also addresses the problem alluded to in #10620.
2015-10-22 13:30:42 +10:00
Chris Meyers
6c265cde49 invoke systemd test for ubuntu >= 15.04 else invoke upstart test 2015-10-21 09:15:27 -04:00
Chris Meyers
f864fa8727 run systemd tests for fedora 2015-10-19 13:21:34 -04:00
Brian Coca
c1a404e6ec Merge pull request #12799 from resmo/for-ansible
cloudstack: add tests for cs_loadbalancer_rule and _member
2015-10-19 11:15:12 -04:00
James Cammarata
2346a7f170 Merge pull request #12800 from chrismeyersfsu/fix-test_destructive_yum
remove invocation keyword check
2015-10-18 10:19:08 -04:00
James Cammarata
549bdb2503 Merge pull request #12804 from chrismeyersfsu/fix-test_non_destructive_makefile
allow env variable override of creds file
2015-10-18 10:18:22 -04:00
Chris Meyers
1b2d17b844 allow env variable override of creds file
This is important because there is an integration test, test_git, that
require an ssh key to clone a privileged github repo.
2015-10-17 12:45:29 -04:00
James Cammarata
8baea3cba8 Merge pull request #12796 from chrismeyersfsu/fix-test_destructive_mysql_variables
fix up mysql variable assertion logic
2015-10-17 10:14:08 -04:00
Chris Meyers
d6dfd9f502 run correct init system tests 2015-10-17 09:25:49 -04:00
Chris Meyers
5177cb3f74 remove invocation keyword check 2015-10-17 09:24:03 -04:00
Rene Moser
bb5dcc00b6 cloudstack: add tests for cs_loadbalancer_rule and _member 2015-10-17 14:01:02 +02:00
James Cammarata
450c8d45c6 Merge pull request #12787 from chrismeyersfsu/fix-test_destructive_apt
keyword not in ubuntu 14.04
2015-10-17 07:43:34 -04:00
Chris Meyers
75833c248e fix up mysql variable assertion logic 2015-10-16 18:42:03 -04:00
Chris Meyers
ce4e98a6d0 remove module param quotes 2015-10-16 18:39:02 -04:00
Toshio Kuratomi
eebd3cc336 Merge pull request #12788 from chrismeyersfsu/fix-test_destructive_state
remove non-existant state var
2015-10-16 12:43:40 -07:00
Chris Meyers
a0264983ad remove non-existant state var 2015-10-16 15:40:31 -04:00
Chris Meyers
5c01622457 keyword not in ubuntu 14.04 2015-10-16 15:37:39 -04:00
Marius Gedminas
04a7ef416e Python 3: print function in a shell oneliner in Makefile
Fixes

    File "<string>", line 1
      import string,random; print 'ansible-testing-' + ''.join(random.choice(string.ascii_letters + string.digits) for _ in xrange(8));
                                                   ^
  SyntaxError: invalid syntax

when running integration tests with

  . hacking/env-setup
  . .tox/py35/bin/activate
  make -C test/integration test_var_precedence
2015-10-16 17:41:01 +03:00
=
e141101314 integration tests for ansible modules core 2147 2015-10-13 06:34:18 +01:00
James Cammarata
9c9897805f More ansible-galaxy fixes for the old spec file format 2015-10-06 01:54:48 -04:00
Brian Coca
f73329401b galaxy updates
better error reporting on fetching errors
use scm if it exists over src
unified functions in requirements
simplified logic
added verbose to tests
cleanup code refs, unused options and dead code
moved get_opt to base class
fixes #11920
fixes #12612
fixes #10454
2015-10-05 11:43:08 -04:00
Brian Coca
5680a9fa32 removed redundant tests, adjusted makefile expected count 2015-10-02 22:37:19 -04:00
Brian Coca
e2ae3215f6 corrected no_log for items and skipped tasks
corrected output from default callback
added new tests for no_log loops
updated makefile test to check for both positive and negative occurrences of no_log
2015-10-02 14:35:33 -04:00
Brian Coca
5c39538a73 added no_log tests as per #12214 2015-10-02 09:11:41 -04:00
James Cammarata
775486c9d6 Merge pull request #12589 from jemmyw/consul-http-checks
Update consul integration test with http checks
2015-10-01 10:44:31 -04:00
Rene Moser
9514ac860d cloudstack: more integration tests 2015-09-22 16:17:21 +02:00
Chris Church
43b15ab9a4 Merge pull request #12385 from cchurch/winrm_put_empty_file
Enable winrm put_file to upload an empty file.
2015-09-16 16:46:01 -04:00
Chris Church
93af0b327f Merge pull request #12384 from cchurch/powershell_strict_mode
Add PowerShell exception handling and turn on strict mode.
2015-09-16 16:45:40 -04:00
Chris Church
1d15e8f37a Pass windows command as-is without splitting/rejoining parameters.
* Fixes extra spaces added between parameters from https://github.com/ansible/ansible-modules-core/issues/1929
* Correctly decode PowerShell command encoded as UTF-16-LE so that it displays correctly in debug messages, fixes the other issue from https://github.com/ansible/ansible-modules-core/issues/1929
* Add test to verify that script parameters are passed as-is, so $true is interpreted as a boolean, fixes https://github.com/ansible/ansible/issues/10947
2015-09-16 16:30:10 -04:00
Chris Church
87db5119ea Merge pull request #12049 from cchurch/win_group_tests
Add integration tests for win_group module.
2015-09-16 16:27:44 -04:00
Chris Church
b44e02143a Merge pull request #12050 from cchurch/test_win_msi_creates
Add tests for creates parameter to win_msi module.
2015-09-16 16:22:47 -04:00
James Cammarata
3f8e12d1f7 Merge pull request #12359 from cchurch/fetch_no_fail_on_missing
Fix fetch to not fail for missing file when fail_if_missing=False
2015-09-16 11:05:39 -04:00
Chris Church
6ab4cff7db Enable winrm put_file to upload an empty file. 2015-09-15 17:21:27 -04:00
Chris Church
5c65ee7f0c Add PowerShell exception handling and turn on strict mode.
* Add exception handling when running PowerShell modules to provide exception message and stack trace.
* Enable strict mode for all PowerShell modules and internal commands.
* Update common PowerShell code to fix strict mode errors.
* Fix an issue with Set-Attr where it would not replace an existing property if already set.
* Add tests for exception handling using modified win_ping modules.
2015-09-15 16:32:35 -04:00
Chris Church
15070e2af8 Merge pull request #11790 from brianlloyd/win_lineinfile
Integration tests for windows implementation of lineinfile
2015-09-15 13:00:36 -04:00
Chris Church
904b8ca27b Update win_msi tests to specify msi url and paths via variables. 2015-09-15 01:15:33 -04:00
Chris Church
0300294f6e Add tests for creates parameter to win_msi module. 2015-09-15 01:15:33 -04:00
Chris Church
260b9f648c Fix fetch action plugin to not fail if file is missing and fail_if_missing=False (the default). Add tests to test_fetch role to verify it works as expected. 2015-09-14 14:21:52 -04:00
Abhijit Menon-Sen
88a20e7a20 Fix broken integration test with unicode hostnames
1. The test did "name: '{{hostnames}}.{{item}}'" inside a with_sequence
   loop, which didn't do what was intended: it expanded hostnames into
   an array, appended ".1", and set name to the resulting string. This
   can be converted to a simple with_items loop.

2. Some of the entries in hostnames contained punctuation characters,
   which I see no reason to support in inventory hostnames anyway.

3. Once the add_host failures are fixed, the playbook later fails when
   the unicode hostnames are interpolated into debug output in ssh.py
   due to an encoding error. This is only one of the many places that
   may fail when using unicode inventory hostnames; we work around it
   by providing an ansible_ssh_host setting.
2015-09-11 21:47:19 +05:30
Rene Moser
f6382a160d cloudstack: new integration test role test_cs_user 2015-09-09 22:36:19 +02:00
Brian Coca
514fa73fcd galaxy fixes 2015-08-28 12:32:50 -04:00
Marius Gedminas
c846bab69b Fix assert statement syntax
`assert (condition, message)` gets parsed by Python as `assert
a_two_tuple`, and a 2-element tuple is never False.

Discovered by compileall on Python 3.4, which emits a SyntaxWarning for
this common mistake.
2015-08-27 22:15:57 +03:00
Marius Gedminas
727cb8a917 Support print() function in test/ 2015-08-27 22:15:57 +03:00
Marius Gedminas
9ae66a7f5c Use 'except ... as' syntax in contrib/ and test/ too 2015-08-27 22:15:57 +03:00
James Cammarata
601a1cc6d9 Multiple fixes for include statements and blocks in general
Fixes #11981
Fixes #11995
Fixes #12039
Fixes #12077
2015-08-26 02:23:22 -04:00
Toshio Kuratomi
9f9891df2c Add unicode characters to the data that we're testing that ansible-vault can decrypt 2015-08-25 15:14:43 -07:00
Brian Coca
3e13dfd7e8 used stdoutlines list to avoid string mismatches
added block environment test
2015-08-25 10:06:24 -04:00
Brian Coca
efa005c228 added names to assert tasks for easier debugging 2015-08-24 22:57:56 -04:00
Brian Coca
d6a1cbeefb corrected varname that started with number and broke templating 2015-08-24 22:44:12 -04:00
Brian Coca
104b8a9a7b avoid hostvars which is not a dict 2015-08-24 22:44:12 -04:00
Brian Coca
857d74a274 made diff ignore whitespace 2015-08-24 22:44:12 -04:00
Brian Coca
6da2587c36 Merge pull request #12058 from resmo/for-ansible
cloudstack: more integration tests and updates
2015-08-24 10:03:58 -04:00
James Cammarata
db65503778 Revert "Add PowerShell exception handling and turn on strict mode." 2015-08-23 21:09:16 -04:00
Rene Moser
69d5e62083 cloudstack: test_cs_account: account_state was renamed, fixes tests 2015-08-23 22:50:23 +02:00
Rene Moser
eb44f85dc8 cloudstack: test_cs_instance: make it more configurable 2015-08-23 22:49:45 +02:00
Rene Moser
15a7f818e1 cloudstack: add more integration tests 2015-08-23 22:48:32 +02:00
Chris Church
af9200c2de Add integration tests for win_group module. 2015-08-22 18:49:55 -04:00
Chris Church
4b2cdadc98 Add PowerShell exception handling and turn on strict mode.
* Add exception handling when running PowerShell modules to provide exception message and stack trace.
* Enable strict mode for all PowerShell modules and internal commands.
* Update common PowerShell code to fix strict mode errors.
* Fix an issue with Set-Attr where it would not replace an existing property if already set.
* Add tests for exception handling using modified win_ping modules.
2015-08-22 18:28:07 -04:00
Brian Coca
01708cc824 added test for environment directive 2015-08-21 00:37:17 -04:00
Feanil Patel
892e230514 Don't convert nulls to strings.
This change is similar to https://github.com/ansible/ansible/pull/10465

It extends the logic there to also support none types.  Right now if you have
a '!!null' in yaml, and that var gets passed around, it will get converted to
a string.

eg. defaults/main.yml
```
ENABLE_AWESOME_FEATURE: !!null # Yaml Null
OTHER_CONFIG:
  secret1: "so_secret"
  secret2: "even_more_secret"

CONFIG:
  hostname: "some_hostname"
  features:
    awesame_feature: "{{ ENABLE_AWESOME_FEATURE}}"
  secrets: "{{ OTHER_CONFIG }}"
```

If you output `CONFIG` to json or yaml, the feature flag would get represented in the output
as a string instead of as a null, but secrets would get represented as a dictionary.  This is
a mis-match in behaviour where some "types" are retained and others are not.  This change
should fix the issue.

I also updated the template test to test for this and made the changes to v2.

Added a changelog entry specifically for the change from empty string to null as the default.

Made the null representation configurable.

It still defaults to the python NoneType but can be overriden to be an emptystring by updating
the DEFAULT_NULL_REPRESENTATION config.
2015-08-19 18:35:07 -04:00
Rene Moser
9d3577a74a cloudstack: fix tests unhashable type: 'dict' 2015-08-19 21:39:58 +02:00
Rene Moser
8f3c181d90 cloudstack: tests: use resource_prefix 2015-08-19 21:37:54 +02:00
Jeremy Wells
9f9f476b6e Update consul integration test with http checks 2015-08-19 00:38:36 +02:00
Brian Coca
1acb29ff9b sequence will now run once for start=end, added test to suite
fixes #11979
2015-08-18 02:33:23 -04:00
Brian Coca
43cc27084d corrected on delete also 2015-08-13 09:58:30 -04:00
Brian Coca
089687140d corrected role path 2015-08-13 09:57:36 -04:00
Brian Coca
033c77a13b now creates/removes files/ dir 2015-08-13 09:54:06 -04:00
Brian Coca
464a436f8f fixed testplay host, included lookup path tests in all, added stage for easier debugging 2015-08-12 19:26:52 -04:00
Brian Coca
60803a1d3c added lookup paths testing 2015-08-12 19:26:52 -04:00
Yannig Perré
47db352725 Merge remote-tracking branch 'ansible/devel' into devel 2015-08-05 11:20:41 +02:00
Yannig Perré
c0bd140959 Add documentation for the ini lookup plugin. 2015-08-05 11:09:40 +02:00
Yannig Perré
733d40a77c When value does not exist, return default value instead of stopping ansible with an exception. 2015-08-05 10:54:24 +02:00
Brian Coca
aefca24616 Merge pull request #10857 from jeffb-stell/devel
Add test for https://github.com/ansible/ansible/issues/9851
2015-08-03 19:23:59 -04:00
James Cammarata
a586c74967 Merge pull request #11838 from cchurch/stringify_powershell_unquote_value
Fix for PowerShell unquote method when passed None.
2015-08-02 22:57:27 -04:00
Chris Church
cafc35fd5b Fix for PowerShell unquote method when passed None. 2015-08-02 18:38:29 -04:00
Chris Church
6969b5ac8b Make sure raw doesn't eat key=value arguments. 2015-08-02 11:57:32 -04:00
Chris Church
2154212491 Merge pull request #11094 from cchurch/test_win_feature_has_servermanager
Only run win_feature tests when the host has the ServerManager module.
2015-07-31 17:52:45 -04:00
Chris Church
e87cf4a3cc Fixes for WinRM/PowerShell support in v2.
- Add support for inserting module args into PowerShell modules.  Fixes #11661.
- Support Windows paths containing spaces.  Applies changes from #10727 to v2.  Fixes #9999.  Should also fix ansible/ansible-modules-core#944 and ansible/ansible-modules-core#1007.
- Change how execution policy is set for running remote scripts.  Applies changes from #11092 to v2.  Also fixes ansible/ansible-modules-core#1776.
- Use codepage 65001 (UTF-8) for WinRM connection instead of default (CP437), convert command to UTF-8 and results from UTF-8.  Replaces changes from #10024.  Fixes #11198.
- Close WinRM connection when task completes.
- Use win_stat, win_file and win_copy modules instead of stat, file and copy when called from within other action plugins (only when using WinRM+PowerShell).
- Unquote Windows path arguments before passing to win_stat, win_file, win_copy and slurp modules (only when using WinRM/PowerShell).
- Check for win_ping module to determine if core modules are missing (only when using WinRM/PowerShell).
- Add stdout_lines to result from running low level commands (so stdout_lines is available when using raw/script).
- Update copy action plugin to use shell functions for joining paths and checking for trailing slash.
- Update fetch action plugin to unquote source path when using Windows paths.
- Add win_copy and win_template action plugins that inherit from copy and template.
- Support running .bat and .cmd scripts using default system encoding instead of UTF-8.
- Always send PowerShell commands as base64-encoded blobs to allow for running simple PowerShell commands via raw.
- Support running modules on Windows with interpreters other than PowerShell.
- Update integration tests to support above changes and test unicode fixes.
- Add test for win_user error from ansible/ansible-modules-core#1241 (fixed by ansible/ansible-modules-core#1774).
- Add test for additional win_stat output values (implemented by ansible/ansible-modules-core#1473).
- Add test for OS architecture and name from setup.ps1 (implemented by ansible/ansible-modules-core#1100).

All WinRM integration tests pass for me with these changes.
2015-07-31 14:38:31 -04:00
Brian Coca
c2d8ca4bf7 fixed test to expected output 2015-07-30 18:36:54 -04:00
Brian Lloyd
07b14b9731 integration tests for windows implementation of lineinfile 2015-07-29 19:50:06 -04:00
James Cammarata
ba56beda90 Fix include task using a potentially undefined variable 2015-07-29 15:49:29 -04:00
James Cammarata
71867f9480 Remove vars attribute from base
Fixes #11779
2015-07-29 09:45:30 -04:00
James Cammarata
e505a1b7c4 Fix variable precedence integrationt test 2015-07-28 00:51:58 -04:00
Brian Coca
c76a66694f fixed typo 2015-07-27 22:54:57 -04:00
Michael Scherer
106e942faa Document and test 'is undefined' rather than 'is not defined'
According to https://github.com/ansible/ansible/issues/10273,
this syntax should work better for nested dicts.
2015-07-25 14:05:27 +02:00
Toshio Kuratomi
b06353791c Don't pass mode from synchronize action plugin to the ansible module
Fixes https://github.com/ansible/ansible-modules-core/issues/1783
2015-07-23 00:42:27 -07:00
James Cammarata
46f74a0d69 Re-adding --start-at-task test to unicode integration test 2015-07-21 12:36:41 -04:00