Commit graph

920 commits

Author SHA1 Message Date
Adrian Likins
8830cde28d Fix 'task name is not templated in retry callback' (add task_name property to TaskResult) (#21214)
Fix 'task name is not templated in retry callback'

Add a task_name property to TaskResult that knows to
check in TaskResult._task_fields.

Add integration test for v2_retry_runner callback

Fixes #18236
2017-02-24 12:33:24 -05:00
Adrian Likins
a2907c4d5c Add smoke/intg tests for vault cli (#21679)
Add smoke/intg tests for vault cli
2017-02-24 10:30:54 -05:00
Dag Wieers
aebf6c8c92 powershell.ps1: Ensure Fail-Json() works with Hashtables (#21697)
Without this change a dictionary $result object would be emptied if it
is anything but a PSCustomObject. Now we also support Hashtables.
2017-02-23 23:08:19 -08:00
Peter Sprygada
381f7209f8 fixes issue in nxos_config when retrieving current config (#21843)
When parsing the configuration, the wrong indent level was set so the
configurations could not be properly compared.  Also noted that
defaults: yes needed to be added to the integration tests to make the
test cases valid, which is also included in this patch

fixes #21828
2017-02-23 16:59:29 -05:00
Matt Clay
cba91c7f44 Test placement (#21801)
* Fix test placement and update messaging.
* Add note about group selection.
2017-02-22 12:43:45 -08:00
Matt Clay
9462707f21 Test www.redhat.com instead of docs.ansible.com. 2017-02-21 20:24:22 -08:00
Jordan Borean
a80251ff02 Added win_region module (#19147) 2017-02-20 11:50:27 +00:00
Matt Davis
8527013fbe Complete rewrite of Windows exec wrapper (#21510)
* supports pipelining for faster execution
* supports become (runas), creates interactive subsession under WinRM batch logon
* supports usage of arbitrary module_utils files
* modular exec wrapper payload supports easier extension
* integrates async wrapper behavior for pipelined/become'd async
* module_utils are loaded as true Powershell modules, no more runtime modifications to module code
2017-02-17 00:09:56 -08:00
Tom Melendez
8dcec1b659 [GCE] gce_net integration test (#21502) 2017-02-16 16:39:25 -05:00
Dave Kasberg
dbb452100a New module: cnos_vlan and various utility files (#21107)
* First set of CNOS network modules

Two modules: cnos_vlan and cnos_command.  First 2 of 17 CNOS modules

* Revert "First set of CNOS network modules"

This reverts commit 63da68b2a857e622b449f514050eed25fbcf0a35.

* cnos_vlan module

First of 17 CNOS modules

* Modify playbook for cnos_vlan module testing

* fix issue found by shippable in cnos.py

* cnos_backup module

* Fix Python3.5 compilation error

* remove cnos_backup module from this PR

* add aliases file so that testing of the cnos_vlan module will be skipped.

* Use empty aliases file

* utility scripts under module_utils changed to BSD license.

* clean up PEP8 issues, add cnos_vlan tests

* remove blank lines from yml files

* remove more blank lines

* remove even more blank lines

* Revert "remove even more blank lines"

This reverts commit bb3998661ce387260340bca39d5f146f5ec54f44.

* re-submit last commit

* fix blank lines in this file under parsing

* fix yamllint errors in doc section of cnos_vlan

* Fix errors reported by Sanity check using validate-modules

* change test playbook to include tasks for all modules

* fix additional pep8 errors

* more fixes, plus fix for python3

* fix for empty options section, removed unnecessary documentation

* fix up documentation section

* Correct options capitalization

* fix example section, add options

* Fix example section of the documentation
2017-02-16 08:11:39 +00:00
Adrian Likins
499d3a1b53 add a intg test for issue #19835 (#21487)
(postgresql_user changing role_attr_flags with no_password_checks
fails)
2017-02-15 15:28:29 -05:00
Michael Scherer
6fae1d2bbf Make password lookup treat /dev/null as a special case
I have from time to time a need of random password without
wanting to write them down (one example is mailman list creation,
that requires a password to be given to be sent to the list owner).

But using /dev/null do not return null, but the empty string, which
doesn't generate a password at all and so do not achieve my use case.
2017-02-15 12:15:09 -08:00
Toshio Kuratomi
e4a80965de Test the slurp module 2017-02-15 11:14:03 -08:00
Toshio Kuratomi
99fd2328af Fix hash filter for non-ascii strings and Python3
hashlib hashes operate on byte strings.  When given a text string on
Python3, hashlib backtraces.  When given a text string on Python2,
hashlib will backtrace if the string contains non-ascii characters.
Encode the text string to utf-8 prior to hashing to avoid this problem.

Fixes #21452
2017-02-15 10:50:10 -08:00
Matt Clay
9389fafae8 Enable MySQL tests on FreeBSD. 2017-02-14 12:39:48 -08:00
John R Barker
59306e2aef Add files via upload (#21062) 2017-02-11 12:12:32 +00:00
Jordan Borean
5cabe420ea Added win_reg_stat module (#19145) 2017-02-09 14:47:00 -08:00
Jordan Borean
1c885cb848 Added fix for win_file with broken symlinks (#19146) 2017-02-08 18:49:49 -08:00
Jordan Borean
1ce5fcf061 Added win_find module (#19144) 2017-02-08 22:19:08 +00:00
Marius Gedminas
2efb692cc4 known_hosts: support --diff (#20349)
* known_hosts: support --diff

* known_hosts: support --diff also without --check

* Add unit tests and fix incorrect diff in one corner case

Tests are good!

* Refactor for readability

* Python 3 compat

* More Python 3 compat

* Add an integration test for known_hosts

* Handle ssh-keygen -HF returning non-zero exit code

AFAICT this is a bug in ssh-keygen in some newer OpenSSH versions
(>= 6.4 probably; see commit dd9d5cc670):
when you invoke ssh-keygen with -H and -F <host> options, it always
returns exit code 1.  This is because in ssh-keygen.c there's a function
do_known_hosts() which calls

  exit (find_host && !ctx.found_key);

at the end, and find_host is 1 (because we passed -F on the command line),
but ctx.found_key is always 0.  Why is found_key always 0?  Because the
callback passed to hostkeys_foreach(), which is known_hosts_hash(),
never bothers to set found_key to 1.

* This test does not need root

* Avoid ssh-ed25519 keys in sample known_hosts file

Older versions of OpenSSH do not like them and ssh-keygen -HF
aborts with an error when it sees such keys:

  line 5 invalid key: example.net...
  /root/ansible_testing/known_hosts is not a valid known_hosts file.

* Fix Python 3 errors

Specifically, the default mode of tempfile.NamedTemporaryFile is 'w+b',
which means Python 3 wants us to write bytes objects to it -- but the
keys we have are all unicode strings.
2017-02-08 09:56:03 -05:00
Ricardo Carrillo Cruz
0adca6b7d4 Set block indentation to 1 on iosxr templates (#21105)
Network devices in the lab have by default an indentation of 1 for
sub-sections, and so does the netcfg.NetworkConfig constructor
indent param.
This will fix reported issue 21055, and make the integration tests
to pass.

Fixes #21055
2017-02-07 21:13:20 +01:00
Brian Coca
c86a17b7a0 refactoring async
- centralized skipping
- also fixed module name broken by previous refactor
- let action modules handle async processing
- moved async into base action class's module exec
- action plugins can now run final action as async
- actually skip copy if base skips
- fixed normal for new paths
- ensure internal stat is never async
- default poll to 10 as per docs
- added hint for callback fix on poll
- restructured late tmp, now a pipeline query
- moving action handler to connection as networking does
- fixed network assumption invocation is always passed
- centralized key cleanup, normalized internal var
- _supress_tmpdir_delete now in _ansible_xxx and gets removed from results
- delay internal key removal till after we use em
- nicer tmp removing, using existing methods
- moved cleanup tmp flag to mking tmp func
2017-02-06 19:32:00 -05:00
Matt Clay
ccb1b742f5 Fix win_stat test for changes from PR #20876
The changes to win_file in that PR resulted in changes to file
sizes and file hashes expected by the win_stat tests.
2017-02-03 12:58:11 -08:00
Brian Coca
a2c38c47aa added docs for vault and made trigger shorter: !vault (#20985)
* added docs for vault and made trigger shorter: !vault

* added single var valuting

* Update playbooks_vault.rst

Edit pass for spelling and grammar. Ship it!

* Update playbooks_vault.rst

Typo fixes.
2017-02-03 15:28:50 -05:00
jhawkesworth
2c70450e23 Fix 'touch' mode so it creates zero size files. (#20876) 2017-02-03 13:36:47 +01:00
Toshio Kuratomi
1df7d95cec Module utils default path (#20913)
* Make the module_utils path configurable
* Add a config value to define the path site module_utils files
* Handle module_utils that do not have source as an error
* Make an integration test for module_utils envvar working
* Add documentation for the ANSIBLE_MODULE_UTILS config option/envvar
* Add it to the sample ansible.cfg
* Add it to intro_configuration.
* Also modify intro_configuration to place envvars on equal footing with
  the config options (will need to document the envvar names in the
  future)
* Also add the ANSIBLE_LIBRARY use case from
  https://github.com/ansible/ansible/issues/15432 so we can close out
  that bug.
2017-02-02 17:48:53 -08:00
Dag Wieers
3dbce15ccb win_shortcut: Add missing $check_mode definition + bugfix + tests (#20911)
* win_shortcut: Add missing $check_mode definition

For some reason this entry was missing, possible a merge-conflict gone
wrong :-(

* Added integration tests and bugfix

Add missing changes.
2017-02-02 10:29:56 +01:00
Dag Wieers
bbe2903d63 Fix broken Shippable 2017-01-31 16:47:16 -08:00
John R Barker
553b6151ad iosxr tests: Initial work for 2.3 (#20883)
Ensure a loopback device exists for testing
Remove provider:
Default is to run task on Network, device, use delegate_to: localhost for local tasks.
2017-01-31 19:10:14 +00:00
Toshio Kuratomi
5c38f3cea2 Combine jimi-c and bcoca's ideas and work on hooking module-utils into PluginLoader.
This version just gets the relevant paths from PluginLoader and then
uses the existing imp.find_plugin() calls in the AnsiballZ code to load
the proper module_utils.

Modify PluginLoader to optionally omit subdirectories (module_utils
needs to operate on top level dirs, not on subdirs because it has
a hierarchical namespace whereas all other plugins use a flat
namespace).

Rename snippet* variables to module_utils*

Add a small number of unittests for recursive_finder

Add a larger number of integration tests to demonstrate that
module_utils is working.

Whitelist module-style shebang in test target library dirs

Prefix module_data variable with b_ to be clear that it holds bytes data
2017-01-31 09:41:24 -08:00
Matt Clay
cb76200c7d PEP 8 E111 & E114 cleanup. (#20838) 2017-01-30 15:01:47 -08:00
Matt Clay
95789f3949 PEP 8 whitespace cleanup. (#20783)
* PEP 8 E271 whitespace cleanup.
* PEP 8 W293 whitespace cleanup.
* Fix whitespace issue from recent PR.
2017-01-27 15:45:23 -08:00
Jordan Borean
971783a7fd Feature/win stat extra info (#19148)
* Added more return results to win_stat

* Changed Win2012 methods to support older versions in setup

* staging of the tests to work with older servers
2017-01-27 14:51:12 -08:00
Matt Clay
63b1e0c277 Fix infrequent PEP 8 issues. 2017-01-27 14:06:21 -08:00
Trond Hindenes
679a3cb1cc Merge pull request #20599 from dagwieers/win_regedit-cleanup
win_regedit: Cleanup, check/diff mode support, HKCC fix
2017-01-27 18:09:27 +01:00
Dag Wieers
0e80ba1867 Fix the integration test to comply recent changes 2017-01-26 20:06:46 +01:00
Matt Clay
31d6b6ef67 Run postgresql tests on FreeBSD. (#20676)
* Use vars for user, group and locale suffix.
* Switch tests from `es_MX` to `es_ES`.
* Enable postgresql tests on freebsd.
* Work-arounds for service restart on freebsd.
2017-01-25 18:45:28 -08:00
Matt Clay
5d5e5e25a2 Only set git config during test if unset.
This makes the git test less destructive.
2017-01-25 18:05:17 -08:00
Patrick Ogenstad
ac527ef86f Check for removal not allowed errors (#19251) 2017-01-25 13:05:44 +00:00
Matt Clay
d8b18d79fa Disable assertions that fail on WS 2016. 2017-01-24 20:08:50 -08:00
Matt Clay
d6cdd91511 Remove win_fetch from CI due to instability. 2017-01-24 17:33:11 -08:00
Ansible Test Runner
ff1a732ffd Increase timeout for http server in uri test. 2017-01-24 14:20:19 -08:00
Matt Clay
836e0b59d2 Fix git remote url change detection. (#20587)
* Fix git remote url change detection.

When comparing paths, unfrackgitpath must be called on both sides
of the comparison. Otherwise comparisons involving symlinks will
return incorrect results.

* Re-enable git test on OS X.

* Return None from unfrackgitpath when path is None.
2017-01-23 16:09:42 -08:00
Matt Clay
61e6e7868c Improve jinja2 test coverage. (#20533)
* Run `template` test on latest jinja2 version.
* Update jinja2 install for groupby_filter.
* Clean test output dir for each test.
2017-01-20 16:38:52 -08:00
Matt Clay
d87ee022bb Enable more ios tests on Shippable. 2017-01-20 13:26:59 -08:00
John R Barker
11c15bbbaf Disable IOS tests for the moment (#20524) 2017-01-20 20:24:54 +00:00
John R Barker
a12033a6e0 integration/targets/ios_* work to support IOS (#20414)
* WIP

* Don't set connection: network_cli in the playbook

* ios_config tests now passing

* Create test loopback device

* delete

* ios_* pass (apart from ios_facts)

* Remove provider lines
2017-01-20 20:18:12 +00:00
James Cammarata
188c3c608a Don't restrict local jinja2 variables to those that start with l_
Per a change in jinja2 2.9, local variables no longer are prefixed
with l_, so this updates AnsibleJ2Vars to pull in all locals (while
excluding some) regardless of name.

Fixes #20063

(cherry picked from commit 4d49b317929b86e1fc1b0cbace825ff73b372dc7)
2017-01-20 07:15:51 -06:00
Matt Clay
9213d0c5b0 Fix and enable more tests for osx and freebsd. (#20482)
* Fix `iterators` test for osx.
* Enable `git` test for osx.
* Enable `get_url` test for osx and freebsd.
* Remove unused SNI_URI from uri test.
* Use ansible hosted SNI host oustside docker.
* Enable `uri` test for osx and freebsd.
* Enable `gathering_facts` test for osx.
* Skip single task on osx until test is fixed.
2017-01-19 17:10:33 -08:00
Matt Martz
537b3b75a6 Add jinja2 groupby filter override to cast namedtuple to tuple. Fixes #20098 (#20362)
* Add jinja2 groupby filter override to cast namedtuple to tuple. Fixes #20098

* Address some of the requested changes

* Quoting

* Print the python path and version

* Be less explicitly verbose, rely on implicit verbosity
2017-01-19 11:39:59 -08:00