Commit Graph

1867 Commits (62dfa2ad118b1f5720bb7b3406147a138e10cf04)

Author SHA1 Message Date
Tom Melendez 7e88df7ebc Adding auth support for google-api-python-client and gcloud-python (#19090)
Support for the Google API and GCloud-Python Clients have been added.

The three libraries:
* GCloud-Python: A new function, get_google_cloud_credentials, should be used.  The credentials-object returned can be passed to any gcloud-python client.  Using this client library requires in the installation of gcloud-python.  This is preferred library for new modules.

* Google API: A new function, gcp_api_auth, should be used to take advantage of services requiring this client.  This client library should be used if the desired functionality is not available in GCloud-Python.  Using this library requires the installation of google-api-python-client.

* libcloud: Existing function, gcp_connect, should be used.  The interface and return values have not changed and existing modules (such as gce, gce_pd and gce_net) should work without modification.  Note that the credentials-fetching code has been refactored out of gcp_connect so that can be reused by all connection functions. To use this function, apache-libcloud must be installed.

Import guards have been added and will only be trigger if a user tries to use a function that is missing dependencies.

Credential-specifying mechanisms (i.e, ansible module params, env vars and libcloud secrets.py) have not changed.  They have been refactored and unit tests have been added to allow for changes going forward. We are deprecating (and removing in a subsequent release) the ability to specify credentials via the libcloud secrets file.  Also, we have deprecated (and also plan to remove in a subsequent release) the ability to use a p12 pem file for a key - the JSON format is strongly preferred.  Deprecation warnings have been added for both of these issues (see the Ansible docs on how to disable deprecation warnings).
8 years ago
Tom Melendez d09ad82e71 Add regex support to gce_tag module, add unit tests and update integration test. (#19087)
The gce_tag module can support updating tags on multiple instances via an instance_pattern field.  Full Python regex is supported in the instance_pattern field.

'instance_pattern' and 'instance_name' are mutually exclusive and one must be specified.

The integration test for the gce_tag module has been updated to support the instance_pattern parameter.  Unit tests have been added to test the list-manipulation functionality.

Run the integration test with:

TEST_FLAGS='--tags "test_gce_tag"' make gce

Run the unit tests with:

python test/units/modules/cloud/google/test_gce_tag.py
8 years ago
Matt Davis f96ac8bff0 fix multiple handler notifications (#19655)
Fixes #19647
Adds integration test to catch multiple handler notifications
8 years ago
azenk f2458140f6 Lastpass lookup plugin (#16285)
This plugin can be used with the lpass cli interface for lastpass.
[lastpass-cli](https://github.com/lastpass/lastpass-cli)

Example:
Add a lookup to your playbooks/variables somewhere:
```
some_variable: "{{ lookup('lastpass','Some Lastpass entry name or ID', field='username') }}"
```
Usage:
* start a lpass session prior to using ansible
* run ansible
* logout when finished

```
lpass login user@domain.com
ansible-playbook foo.yml
lpass logout
```
8 years ago
Rob Cutmore 1da6a67c50 Add tests for Git remote URL changes (#16893)
* Update Git tests for set remote URL changes
* Git: report changed when needed in check mode
8 years ago
Dag Wieers 438cd6687f Added tests for sefcontext module 8 years ago
Will Thames 5f0815d7f4 Fix too-many-quote problem in setup_ec2 role
An inner single-quote pair breaks out of the outer single-quote
pair. Rather than escaping the inner quotes to protect against
this, just use the fact that `str()` is equivalent to `""`.
8 years ago
Matt Clay dac226de4a Improve ansible-test completion and messaging. (#19627)
* Simplify type annotation of args.docker_util.
* Improve error messaging for ansible-doc test.
* Add completion for docker, remote and windows.
8 years ago
Gregory Shulov 6c3de3c299 Initial Commit for Infinidat Ansible Modules (#19429)
* Initial Commit for Infinidat Ansible Modules

Skip tests for python 2.4 as infinisdk doesn't support python 2.4

Move common code and arguments into module_utils/infinibox.py

Move common documentation to documentation_fragments. Cleanup Docs and Examples

Fix formating in modules description

Add check mode support for all modules

Import AnsibleModule only from ansible.module_utils.basic in all modules

Skip python 2.4 tests for module_utils/infinibox.py

Documentation and code cleanup

Rewrite examples in multiline format

Misc Changes

Test

* Add Infinibox modules to CHANGELOG.md

* Add ANSIBLE_METADATA to all modules
8 years ago
Gordon Gao d9e1e374b2 let chdir support relative path in more modules (#16736) 8 years ago
s-hertel 28b4931e3d testing GalaxyCLI.run() does what is expected 8 years ago
bart2 cdb35f4ce2 Fixes #16936 - Digest authentication not working in uri module (#18736) 8 years ago
Matt Clay 422857166b Remove legacy test alias migration script. (#19629)
* Require code-smell tests to be files.
* Add sanity check for integration test aliases.
* Remove migration script for test aliases.
8 years ago
James Cammarata dd0257b995 Template "original_task" fields in _process_pending_results
Since we no longer use a post-validated task in _process_pending_results, we
need to be sure to template fields used in original_task as they are raw and
may contain variables.

This patch also moves the handler tracking to be per-uuid, not per-object.
Doing it per-object had implications for the above due to the fact that the
copy of the original task is now being used, so the only sure way is to track
based on the uuid instead.

Fixes #18289
8 years ago
Adrian Likins 727ca6f436 Fix error on 'help module' in ansible-console (#19390)
If 'help xattr' for example, ansible-console would
traceback because module_docs.get_docstring() now
returns 4 values (module metadata was added)
8 years ago
Matt Clay cdd74b2b84 Fix foreman compile skip path. 8 years ago
Peter Sprygada 2a5a2773c8 adds new module net_command for network devices (#19468)
* new module net_command for sending a command to a network device
* adds unit test cases for module
* only works with connection=network_cli
8 years ago
Will Thames dce445f956 Improve error message for module validation (#19501)
Print out the data that fails to validate when doing
schema checking on modules

This allows easier interpretation of error messages.

From:

```
ERROR: DOCUMENTATION.notes.2: expected basestring
```

To:

```
ERROR: DOCUMENTATION.notes.2: expected basestring @ data['notes'][2].
Got {"As with C(include) this task can be static or dynamic, If static
it implies that it won't need templating nor loops nor conditionals and
will show included tasks in the --list options. Ansible will try to
autodetect what is needed, but you can set `static": 'yes|no` at task
level to control this.'}
```
8 years ago
Matt Clay 39f6368015 Update `aliases` file for `uri` integration test. 8 years ago
Matt Clay 9b5c782a0b Use `docker pull` by default in ansible-test. 8 years ago
Matt Clay 80c559bdef Test sftp and scp for ssh connection. 8 years ago
Toshio Kuratomi 0b440a9289 Code smell test for iteritems and itervalues (#19292)
* Code smell test for iteritems and itervalues

* Change the keydict object in authorized_keys so it doesn't throw a false postive

keydict is a bad data structure anyway.  We don't use the iteritems and
itervalues methods so just disable them so that the code-smell tests do
not trigger on it.

* Change release templates so they work with py3
8 years ago
Robin Roth afca957396 Fix UnboundLocalError remote_head in git (#19057)
* Fix UnboundLocalError remote_head in git

Fixes #5505

The use of remote_head was a leftover of #4562.
remote_head is not necessary, since the repo is unchanged anyway and
after is set correctly.

Further changes:
* Set changed=True and msg once local_mods are detected and reset.
* Remove need_fetch that is always True (due to previous if) to improve
clarity
* Don't exit early for local_mods but run submodules update and
switch_version

* Add test for git with local modifications
8 years ago
Andrea Tartaglia 59227d8c31 Removed dict.iteritems() in several other files.
This is for py3 compatibility #18506
8 years ago
Dag Wieers 7c71c678fa Fix regression in search path behaviour
This PR fixes a few issues:

- Missing role parent directory for relative paths
- Fix integration tests (add missing stage)
- Redesign integration tests
- Incorrect order with tasks-lookups
- Duplicate paths are listed
- Repetitive tasks/tasks or files/files were possible

==== using copy with test.txt
Before:
```
   491 1481281038.29393: search_path:
        /home/dag/home-made/ansible.testing/roles/test134/files/test.txt
        /home/dag/home-made/ansible.testing/roles/test134/tasks/test.txt
        /home/dag/home-made/ansible.testing/roles/test134/tasks/files/test.txt
        /home/dag/home-made/ansible.testing/roles/test134/tasks/tasks/test.txt
        /home/dag/home-made/ansible.testing/files/test.txt
        /home/dag/home-made/ansible.testing/test.txt
```

After:
```
 32505 1481280963.22418: search_path:
        /home/dag/home-made/ansible.testing/roles/test134/files/test.txt
        /home/dag/home-made/ansible.testing/roles/test134/test.txt
        /home/dag/home-made/ansible.testing/roles/test134/tasks/files/test.txt
        /home/dag/home-made/ansible.testing/roles/test134/tasks/test.txt
        /home/dag/home-made/ansible.testing/files/test.txt
        /home/dag/home-made/ansible.testing/test.txt
```

==== Using copy with files/test.txt

Before:
```
 31523 1481280499.63052: search_path:
        /home/dag/home-made/ansible.testing/roles/test134/files/test.txt
        /home/dag/home-made/ansible.testing/roles/test134/tasks/files/test.txt
        /home/dag/home-made/ansible.testing/roles/test134/tasks/files/test.txt
        /home/dag/home-made/ansible.testing/roles/test134/tasks/tasks/files/test.txt
        /home/dag/home-made/ansible.testing/files/files/test.txt
        /home/dag/home-made/ansible.testing/files/test.txt
```

After:
```
 31110 1481280299.38778: search_path:
        /home/dag/home-made/ansible.testing/roles/test134/files/test.txt
        /home/dag/home-made/ansible.testing/roles/test134/tasks/files/test.txt
        /home/dag/home-made/ansible.testing/files/test.txt
```

==== Using template with files/test.txt.j2
Before:
```
 30074 1481280064.15191: search_path:
        /home/dag/home-made/ansible.testing/roles/test134/templates/files/test.txt.j2
        /home/dag/home-made/ansible.testing/roles/test134/tasks/files/test.txt.j2
        /home/dag/home-made/ansible.testing/roles/test134/tasks/templates/files/test.txt.j2
        /home/dag/home-made/ansible.testing/roles/test134/tasks/tasks/files/test.txt.j2
        /home/dag/home-made/ansible.testing/templates/files/test.txt.j2
        /home/dag/home-made/ansible.testing/files/test.txt.j2
```

After:
```
 29201 1481279823.52752: search_path:
        /home/dag/home-made/ansible.testing/roles/test134/templates/files/test.txt.j2
        /home/dag/home-made/ansible.testing/roles/test134/files/test.txt.j2
        /home/dag/home-made/ansible.testing/roles/test134/tasks/templates/files/test.txt.j2
        /home/dag/home-made/ansible.testing/roles/test134/tasks/files/test.txt.j2
        /home/dag/home-made/ansible.testing/templates/files/test.txt.j2
        /home/dag/home-made/ansible.testing/files/test.txt.j2
```

This fixes #19048
8 years ago
Matt Clay f28b5a0ed8 Add --tox-sitepackages option to ansible-test. 8 years ago
Toshio Kuratomi dd46cb7b05 Add a code-smell test for iterkeys (#18589)
* Add a code-smell test for iterkeys
* Add a message on how to port iterkeys problems and make the grep more robust
8 years ago
Matt Clay f789a20f29 Update log download url. 8 years ago
Matt Clay 45772b961f Add private fork CI support to ansible-test. 8 years ago
Toshio Kuratomi c6b42028c4 Fixes for uri under python3 and local (non-httptester) testing 8 years ago
Matt Clay dab2bf7e13 Skip test_uri on python 3. 8 years ago
Adrian Likins c693ba19f9 unit tests for playbook/conditional.py (#18586)
Start of unit tests for playbook/conditional.py
8 years ago
Adrian Likins 3efef40822 Add unit tests for playbook/helpers.py (#18709) 8 years ago
Adrian Likins 1653a77f1d add unit tests for playbook/included_file.py (#18710) 8 years ago
Adrian Likins 08a5d506bb Fix errors on 'ansible-playbook --flush-cache' (#18754)
Add a unit test, and split out the flush cache logic to
it's own method.
Fixes #18708
8 years ago
Adrian Likins 6c4f554f5a Provide slightly better msg on fact cache error (#18759)
If the configured fact_cache plugin (fact_caching config)
fails, raise a fatal error instead of failing mysteriously
later.

Fixes #18751
8 years ago
Carlos E. Garcia 0b8011436d minor spelling changes 8 years ago
Lumír 'Frenzy' Balhar 84544ee8fd Fix AST nodes for Python 3 and enable dependent test_uri (#18597)
* Enable tests on python 3 for uri

* Added one more node type to SAFE_NODES into safe_eval module.

ast.USub represents unary operators. This is necessary for
parsing some unusual but still valid JSON files during testing
with Python 3.
8 years ago
John R Barker b915e790d3 veos-dut-01 is down, so use veos01 (#19299) 8 years ago
John R Barker bdc4fa6b99 Add group_vars/ops.yaml (#19288)
Authentication details for ops modules. Was missed during porting
8 years ago
Robin Roth 5bf07454cb Test apache2 force (#18500)
* Use native yaml for apache2 test

* Test removal of default modules with force

a2enmod on debian has `-f`, but not on SUSE (runs there without force).
Therefore don't test that option on SUSE.
The docs already specify that the option is intended for Debian systems
only.
8 years ago
Clark Boylan a65e34ce77 Fix synchronize retries (#18535)
* Fix synchronize retries

The synchronize module munges its task args on every invocation of
run(). This was problematic because the munged data was not fit for use
by a second pass of the synchronize module. Correct this by using a copy
of the task args on every invocation of run() so that the original args
are not affected.

Local testing using this playbook seems to confirm that things work as
expected:

  - hosts: all
  tasks:
    - delay: 2
      register: task_result
      retries: 1
      until: task_result.rc == 0
      synchronize:
        dest: /tmp/out
        mode: pull
        src: /tmp/nonexistent/

fixes #18281

* Update synchroncization fixture assertions

When we started operating on a copy of the task args the test assertions
were no longer asserting things about the munged state but of the
pristine state. Convert the copy of task args to a class member so that
it can be compared against later in testing and update the assertions to
check this munged copy.
* Shuffle objects around for cleaner testing

Attach the temporary args dict to the task rather than the action as
this makes updating the existing tests cleaner.
8 years ago
Matt Clay f9c4158ff8 Remove core/extras dirs from old PRs during CI. 8 years ago
John R Barker 39af9b5a86 Make it clearer where the network tests live (#19242) 8 years ago
Matt Clay cd47cb2a15 Remove remnants of obsolete fireball mode. 8 years ago
Matt Clay ac7edef2be Fix modules with documentation errors. 8 years ago
Robin Roth e18bc0d6f0 Add test for auto_import_keys in zypper_repository (#17898)
* tests the bug found in ansible/ansible-modules-extras#3086
8 years ago
Matt Clay 1c9a58a885 Run all tests when no last successful commit.
(cherry picked from commit 2e56035fddfd04eb084bd977fc1ee2f35c2f5283)
8 years ago
Matt Davis cb1888125d add metadata to doc support (#18802)
fix broken module docs
change doc AST id extraction to use == instead of in
8 years ago
Matt Clay 5628e260f2 Relocate module unit tests. (#18812)
* Relocate module unit tests.
* Fix classification of unit test changes.
8 years ago