Commit Graph

3687 Commits (1c352dfea266c16c97fa04df3886d5701e5d5325)

Author SHA1 Message Date
Abhijeet Kasurde 928c4f08ca
Fix test case in vmware_guest (#52142)
Due to changes in https://github.com/ansible/ansible/pull/45412
vmware_guest testcase delete_vm failed. This patch will fix that testcase.

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
6 years ago
Will Thames 46fbcf08bc
aws_kms enhancements (#31960)
* Allow creation and deletion of keys (deletion just schedules for
  deletion, recreating an old key is just cancelling its deletion)
* Allow grants to be set, thus enabling encryption contexts to be
  used with keys
* Allow tags to be added and modified
* Add testing for KMS module
* Tidy up aws_kms module to latest standards
6 years ago
Wojciech Sciesinski a431e802ed Add posibilities to run the integration tests for PowerShell < 5.0 (#50808)
* Add posibilities to run the integration tests for PowerShell < 5.0

* Update of tests - based at a review comments for #50612

* The correction of YAML structure
6 years ago
Wojciech Sciesinski a7528cdd25 Update the NuGet package provider when needed (#50759)
* Update the NuGet package provider when needed

* Update NuGet provider conditionally
6 years ago
Andrew Gaffney 9c35f18dd6 Custom jinja Undefined class for handling nested undefined attributes (#51768)
This commit creates a custom Jinja2 Undefined class that returns
Undefined for any further accesses, rather than raising an exception
6 years ago
Abhijeet Kasurde fab815fc3b
VMware: Handle duplicate VM names in vmware_vm_facts (#45412)
This fix changes facts returned from vmware_vm_facts to list of dict from
dict of dict.

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
6 years ago
Abhijeet Kasurde 5c992fcc3f
ansible-vault: handle utf-8 filename in vault (#50341)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
6 years ago
Hannes Ljungberg 70d8f02db7 docker_swarm_service: Extend env and add env_files support (#51762)
* Extend env and add env_files support

* Python 2.6 compat

* Handle lists passed as string

* Add changelog fragment

* Use correct link formatting

Co-Authored-By: hannseman <hannes@5monkeys.se>

* Fix typo

Co-Authored-By: hannseman <hannes@5monkeys.se>

* Handle empty env and env_files values
6 years ago
Felix Fontein 09f78d2f6c ufw: allow to insert rules relative to first/last IPv4/IPv6 rules (#49796)
* Insert should have type int.

* Add insert_relative_to option.

* Add changelog.

* Add tests.

* Improve comment.
6 years ago
Jordan Borean 179cbb9891
win_dsc - return warning from DSC invocation (#51927) 6 years ago
Ari Stark 2f85d62989 Add state option to git_config module (#50578)
* Add state option to git_config module

State present/absent option works like --set/--unset option for 'git config'.

* Change git_config to avoid useless parameter passed to git command

When unsetting value, command was : git config --unset foo ''.
Now command is : git config --unset foo.

* Add some integration tests to git_config module

* Add missing aliases file

* Change set up method

Using git command seems to cause troubles on some OS : changing config
by changing '.gitconfig' file.

* Remove some distros from tests pool

Git is not installed or is out of date on these distros.

* Fix aliases to skip tests on centos6

* Refactor tests of the git_config module

* Add use case when state=absent and value is defined
6 years ago
Dag Wieers 031a1a5cc2 vsphere_file: New module to manage files on datastores (#48180) 6 years ago
Matt Martz 445ff39f94
Become plugins (#50991)
* [WIP] become plugins

Move from hardcoded method to plugins for ease of use, expansion and overrides
  - load into connection as it is going to be the main consumer
  - play_context will also use to keep backwards compat API
  - ensure shell is used to construct commands when needed
  - migrate settings remove from base config in favor of plugin specific configs
  - cleanup ansible-doc
  - add become plugin docs
  - remove deprecated sudo/su code and keywords
  - adjust become options for cli
  - set plugin options from context
  - ensure config defs are avaialbe before instance
  - refactored getting the shell plugin, fixed tests
     - changed into regex as they were string matching, which does not work with random string generation
     - explicitly set flags for play context tests
 - moved plugin loading up front
 - now loads for basedir also
 - allow pyc/o for non m modules
 - fixes to tests and some plugins
 - migrate to play objects fro play_context
 - simiplify gathering
 -  added utf8 headers
 - moved option setting
 - add fail msg to dzdo
 - use tuple for multiple options on fail/missing
 - fix relative plugin paths
 - shift from play context to play
 - all tasks already inherit this from play directly
 - remove obsolete 'set play'
 - correct environment handling
 - add wrap_exe option to pfexec
 - fix runas to noop
 - fixed setting play context
 - added password configs
 - removed required false
 - remove from doc building till they are ready

future development:
  - deal with 'enable' and 'runas' which are not 'command wrappers' but 'state flags' and currently hardcoded in diff subsystems

* cleanup

  remove callers to removed func
  removed --sudo cli doc refs
  remove runas become_exe
  ensure keyerorr on plugin
  also fix backwards compat, missing method is attributeerror, not ansible error
  get remote_user consistently
  ignore missing system_tmpdirs on plugin load
  correct config precedence
  add deprecation
  fix networking imports
  backwards compat for plugins using BECOME_METHODS

* Port become_plugins to context.CLIARGS

This is a work in progress:
* Stop passing options around everywhere as we can use context.CLIARGS
  instead

* Refactor make_become_commands as asked for by alikins

* Typo in comment fix

* Stop loading values from the cli in more than one place

Both play and play_context were saving default values from the cli
arguments directly.  This changes things so that the default values are
loaded into the play and then play_context takes them from there.

* Rename BECOME_PLUGIN_PATH to DEFAULT_BECOME_PLUGIN_PATH

As alikins said, all other plugin paths are named
DEFAULT_plugintype_PLUGIN_PATH.  If we're going to rename these, that
should be done all at one time rather than piecemeal.

* One to throw away

This is a set of hacks to get setting FieldAttribute defaults to command
line args to work.  It's not fully done yet.

After talking it over with sivel and jimi-c this should be done by
fixing FieldAttributeBase and _get_parent_attribute() calls to do the
right thing when there is a non-None default.

What we want to be able to do ideally is something like this:

class Base(FieldAttributeBase):
    _check_mode = FieldAttribute([..] default=lambda: context.CLIARGS['check'])

class Play(Base):
    # lambda so that we have a chance to parse the command line args
    # before we get here.  In the future we might be able to restructure
    # this so that the cli parsing code runs before these classes are
    # defined.

class Task(Base):
    pass

And still have a playbook like this function:

---
- hosts:
  tasks:
  - command: whoami
    check_mode: True

(The check_mode test that is added as a separate commit in this PR will
let you test variations on this case).

There's a few separate reasons that the code doesn't let us do this or
a non-ugly workaround for this as written right now.  The fix that
jimi-c, sivel, and I talked about may let us do this or it may still
require a workaround (but less ugly) (having one class that has the
FieldAttributes with default values and one class that inherits from
that but just overrides the FieldAttributes which now have defaults)

* Revert "One to throw away"

This reverts commit 23aa883cbed11429ef1be2a2d0ed18f83a3b8064.

* Set FieldAttr defaults directly from CLIARGS

* Remove dead code

* Move timeout directly to PlayContext, it's never needed on Play

* just for backwards compat, add a static version of BECOME_METHODS to constants

* Make the become attr on the connection public, since it's used outside of the connection

* Logic fix

* Nuke connection testing if it supports specific become methods

* Remove unused vars

* Address rebase issues

* Fix path encoding issue

* Remove unused import

* Various cleanups

* Restore network_cli check in _low_level_execute_command

* type improvements for cliargs_deferred_get and swap shallowcopy to default to False

* minor cleanups

* Allow the su plugin to work, since it doesn't define a prompt the same way

* Fix up ksu become plugin

* Only set prompt if build_become_command was called

* Add helper to assist connection plugins in knowing they need to wait for a prompt

* Fix tests and code expectations

* Doc updates

* Various additional minor cleanups

* Make doas functional

* Don't change connection signature, load become plugin from TaskExecutor

* Remove unused imports

* Add comment about setting the become plugin on the playcontext

* Fix up tests for recent changes

* Support 'Password:' natively for the doas plugin

* Make default prompts raw

* wording cleanups. ci_complete

* Remove unrelated changes

* Address spelling mistake

* Restore removed test, and udpate to use new functionality

* Add changelog fragment

* Don't hard fail in set_attributes_from_cli on missing CLI keys

* Remove unrelated change to loader

* Remove internal deprecated FieldAttributes now

* Emit deprecation warnings now
6 years ago
Jérôme BAROTIN b99de25f32 Enable changed var with ufw check mode (#49948)
* Enable 'changed' var with ufw check mode

* Fix from comment of the PR + Unit Test

* Fix on ufw module after the second review

- delete rules change works in check mode
- simplify execute def & use it on every call process
- improved regexp
- rename vars defaults to current_default_values

* Add ignore error to execute() and use it in get_current_rules()

* Update after third code review (introduce change in changed status)

* Adjust tests and fix some problems (#1)

* 'active' also appears in 'inactive'.

* 'reject' is also a valid option here.

* For example for reloaded, changed will be set back to False here.

* Improve and adjust tests.

* Fix after merging integration test

* handle "disabled" on default routed

* Add /var/lib/ufw/.. rules files

* add unit test

* Fix pep8 formatting error

* Separate ipv6 and ipv4 rules process from checkmode

* fix non-ascii error on ci

* Some change after review

* Add unit test with sub network mask

* rename is_match function by is_starting

* add changelog fragment
6 years ago
Felix Fontein 9b1cbcf3a4 openssl_csr: ignore empty strings in altnames (#51473)
* Ignore empty strings in altnames.

* Add changelog.

* Add idempotence check without SAN.

* Fix bug in cryptography backend.
6 years ago
Hannes Ljungberg 153e996760 docker_swarm_service: Remove defaults (#51216)
* Drop descriptions of docker-py constraints <=3.0.0

* Properly indent documentation

* Clearer examples

* Spelling

* Fix example

* Revert "Drop descriptions of docker-py constraints <=3.0.0"

This reverts commit 8106215af62ae5880c3b748cec562a85f2247bdc.

# Conflicts:
#	lib/ansible/modules/cloud/docker/docker_swarm_service.py

* Add min versions for placement preferences

* Add endpoint_mode and publish to option_minimal_versions

* Restrict update max_failure_ratio and monitor versions

* Remove defaults and only pass required arguments

* Fix indentation

* Fix args documentation

* Fix replicas documentation

Co-Authored-By: hannseman <hannes@5monkeys.se>

* Add type to all documented options

* Add suboptions for mounts, secrets and configs

* Add suboptions to argument spec

* Remove redundant validation and casting

* Don’t default Spec.EndpointSpec.Mode to vip

* Use single quotes as string literal

* Catch ImportError explicitly

* Move init to top of class

* Align closing brackets

* Spelling

* Import LooseVersion

* Documentation fixes

* Documentation fix

* Documentation fixes

* Remove required: false and default=None

* Defaults for update_delay and update_parallelism

* Set correct key for default

* Handle empty idempotency

* Clearer image documentation

Co-Authored-By: hannseman <hannes@5monkeys.se>

* Clearer constraint documentation

Co-Authored-By: hannseman <hannes@5monkeys.se>

* Better documentation of corresponding service opts
6 years ago
Adam Miller 2721ed260e Properly handle unauthenticated yum proxy config (#51915)
Fixes #51548

Signed-off-by: Adam Miller <admiller@redhat.com>
6 years ago
gyorgypeter 7fa5694975 VMware: Module for managing mirroring sessions. (#50338)
This module manages the mirroring sessions, and the necessary port settings.

* Correct Documentation and CS
* PEP8, YAML, Documentation Error Fix
* Added empty return statement

Co-Authored-By: gyorgypeter <32464524+gyorgypeter@users.noreply.github.com>
6 years ago
Matt Davis 46bf38711c fix azure_rm_deployment test
* recent changes to args for hosted template file broke the test; changed test to use a specific known-working commit instead of `master`.
* long-term may want to consider hosting the template in httptester or just embedding a local copy
6 years ago
Jordan Borean c92fcf0b57 Get docker tests working on OpenSUSE (#51896) 6 years ago
Abhijeet Kasurde c20722474a
ec2_vol_facts: set filters to default value (#51589)
Fixes: #51554

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
6 years ago
Jordan Borean 6fcbfcf6b6
win_rds: wait for reboot to be complete (#51849) 6 years ago
Zim Kalinowski d252cc7a2b adding cosmos db account module (#47181)
* adding cosmos db account module

* fixes

* fixed issues

* cosmos db account test fixes

* updating cosmosdb

* fixed required

* version from autogereneator

* several upgrades

* idempotency changes

* idempotency improvements

* updated cosmos db module with new idempotency check

* and idempotency check shall fail now....

* try to fail it again

* now should really fail

* one more

* introducing comparison template

* fixes + sorting of arrays

* updated comparisons

* don't compare if parameter is none

* one more test

* fixed compare

* fixed idempotency?

* more logging

* fix comparison rules

* make smaller change

* actually compare multiple write locations

* just change failover

* remove debugging stuff

* one more fix

* fixed remaining sanity test

* updating comparison stuff

* fix pep8

* fix pep8

* will pep8 finally work?

* one more fix

* cosmos db updates

* updating cosmos db account

* fixed pep8

* fix type

* fixed indent

* fixed problem with python 3

* another fix for python 3

* bool type here

* cosmos db fixes

* fix

* fix

* fix

* fixed syntax
6 years ago
Jordan Borean 0f0d33a954 start getting modules to use shared import error code (#51787) 6 years ago
David Passante cbde04606a Cloudstack: New module cs_vlan_ip_range (#51597) 6 years ago
Wojciech Sciesinski b8a7e35b22 Correct integration tests for the win_disk_facts module (#51044)
* Correct integration tests for the win_disk_facts module

* Exclude W2K8, W2K8-R2 from tests run under CI
6 years ago
Jordan Borean e284d21139
win_rds: move the tests into 1 target to make it quicker (#51728) 6 years ago
Martin Krizek 33b07f322c
yum: disableexcludes is supported on centos6 (#51698)
* yum: disableexcludes is supported on centos6

* Add changelog
6 years ago
Hannes Ljungberg 4a5d38b55a docker_swarm_service: Enable tests (#51170)
* Enable tests

* Comment fixes

* Try lowering timeouts

* Comment fix

* Comment fix

* Comment fix

* Add a pause to let service update

* Fix comment

* Disable dns_search tests

* Disable dns_servers test

* Fix comment

* Fix comment

* Fix comment

* Fix comment

* Fix comment

* Fix comment

* Fix comment

* Revert "Disable dns_servers test"

This reverts commit 763e9da716b78f4986f313b3ba1ab98faacb742e.

* Revert "Disable dns_search tests"

This reverts commit 2859e4e3a5ebdca078de84d821bb53bbdf967dfd.

* Revert "Add a pause to let service update"

This reverts commit e990dfae1a62e9a42b07960819818bc75fd04427.

* Revert "Try lowering timeouts"

This reverts commit 1617772de81ecef0e560b38c7564646ec3874c3c.

* Ensure that services are running while testing

* Retry tasks on update out of sequence error

* Remove unnecessary check for APIError.explanation

Co-Authored-By: hannseman <hannes@5monkeys.se>

* Ignore errors when tearing down test suite

* Retry with a loop instead of tail recursion

* Initialize self.diff_trace in run

* Add change log fragment

* Actually raise error

* Add unit test for retrying

* Lint

* Change to bugfix

* Remove whitespace

* Mock docker dependency

* Use download.fedoraproject.org

* Revert "Use download.fedoraproject.org"

This reverts commit 5931791f7c.
6 years ago
Jordan Borean c572d17c2e
ansible-test: fix incompatibilty with the RDS tests and httptester (#51716)
* test out win_uri on Shippable

* run all tests for group 3 - ci_complete

* use shared setup and cleanup role for RDS

* Set shippable matrix back to normal

* cleanup changes to support Server 2008 R2
6 years ago
Jordan Borean 6ad5002712
win_updates - mark as unstable again (#51713) 6 years ago
Jordan Borean f78cdcd2c5
test win_setup - make py3 compatible (#51693) 6 years ago
Pilou 7a3582d651 uri: check unexpected failure doesn't occur when file cannot be saved (#45824)
* uri: fix TypeError when file can't be saved

Fix the following exception (and others):

    Traceback (most recent call last):
      File "/home/lilou/debug_dir/__main__.py", line 604, in <module>
        main()
      File "/home/lilou/debug_dir/__main__.py", line 554, in main
        write_file(module, url, dest, content, resp)
      File "/home/lilou/debug_dir/__main__.py", line 320, in write_file
        module.fail_json(msg="Destination dir '%s' not writable" % os.path.dirname(dest), **resp)
    TypeError: fail_json() got multiple values for keyword argument 'msg'

I would rather remove **resp from returned values but this module is
flagged as stableinterface.

* Static imports are more straight forward and preferred unless dynamic inclusion is required.
6 years ago
Jordan Borean 2e99dea867
win_service - use custom binary for tests (#51689) 6 years ago
Kairo Araujo a355686987 new module: aix_devices, manage AIX devices (#32290)
* new module: aix_devices AIX devices management

This module discovery, defines, removes and modifies attributes of AIX
devices.

* Added hide attributes that can be used for aliases

Added hid attributes that can be used to manage aliases on en
interfaces.

* After tests: docs and attributes tests

Fixed attributes tests and doc explaining how to use
attributes with comma.

* Fixed grammar on module description

Fixed grammar on module description

* Included test/legacy/aix_devices.yml for tests

As discussed on IRC ansible-devel channes, was include the
legacy tests for further manual tests.

* Added 'attributes' as dictionary

Added 'attributes' as a dictionary makes the configuration
simple.

* Changed the added version from 2.5 to 2.7

Fixed the shippable error from 2.5 to 2.7

```
2018-06-01 08:28:02 ERROR: Found 1 validate-modules issue(s) which
need to be resolved:
2018-06-01 08:28:02 ERROR:
lib/ansible/modules/system/aix_devices.py:0:0: E307 version_added
should be 2.7. Currently 2.5 (75%)
```

* Various changes

* Revert

* Changed the tests to integration dir

* Implement 'available' state

'available' state is the AIX state used, that works same as 'present'

* The states were changed to AIX expressions and kept Ansible states.

Makes sense keep the states names to AIX and use the Ansible 'standards'
states.

'available' is 'present'
'removed' is 'absent'

It makes easy to AIX sysadmins use the module, however it keep the
Ansible meanings.

* Fixed choices according with latest patchset (commit)

* A few doc changes

Nothing material
6 years ago
Jordan Borean ebc9e4caf7
add pause to make test more stable (#51680) 6 years ago
Felix Fontein 89a1c68f98 docker_volume: improve force option (deprecate, add new option) (#51145)
* docker_volume: Deprecating force option, adding recreate option.

* Add changelog.

* Remove mis-placed force: yes for docker_volume.
6 years ago
Feike Steenbergen 38e70ea317 Add session_role to postgresql modules (#43650)
* Allow session_role to be set for PostgreSQL

By implementing session_role it becomes possible to run the specific
PostgreSQL commands as a different role.
The usecase that is immediately served by this, is the one that one
ansible playbook can be shared by multiple users, which all have
their
own PostgreSQL login_user. They do not need to share login
credentials,
as they can share the role within the PostgreSQL database.

The following example may give some insight:

$ psql -U jdoe -X -d postgres

postgres=> CREATE DATABASE abc;
ERROR:  permission denied to create database
postgres=> set role postgres;
SET
postgres=# CREATE DATABASE abc;
CREATE DATABASE

fixes #43592

* Tests for session_role in PostgreSQL

* Bump version_added for session_role feature

* Remove explicit encrypted parameter from tests
6 years ago
Kevin Breit a55838b013 Digital Ocean integration test for digital_ocean_tag (#49169)
* Add Digital Ocean integration test template

- Actual integration tests will come shortly

* Add digital_ocean-tag test

* Add integration test for creating and deleting tags

* Remove cloud confiugration file

* Enhancements for integration test for idempotency
- Added new lines per review
- Added proper tests for idempotency checks
- Actual module is broken so deletion test doesn't work

* Add check for do_api_key and instruct if it doesn't work.

* Fix indentation

* Remove idempotency test for nonidempotency action

* Add notes for delete idempotency
6 years ago
Dag Wieers cfa028677d
ACI: Fix integration tests using urldecode (#51610)
This is in result of changes to use urlencode to encode query strings.
6 years ago
Federico87 f94378fc2f ios_ntp module (#50705)
* ios_ntp module

* add execute_module for config func

* fix units test

* test empty list

* update example

* change want logic to follow have - removed try/except

* update commands list for config test

* add idempotent test case

* add more test
6 years ago
Anil Kumar Muraleedharan 004d8b03d4 Lenovo cnos l3interface (#51322)
* Adding cnos_l3_interface module in alignment with others vendors.
6 years ago
Alex Stephen 27c5e38e10 Bug fixes for GCP modules (#51573) 6 years ago
Alex Stephen 2b0f16443c Bug fixes for GCP modules (#51574) 6 years ago
Alex Stephen 6a79468acf Bug fixes for GCP modules (#51576) 6 years ago
Alex Stephen 802827536c New Module: gcp_redis_instance (#51578) 6 years ago
Brian Coca e010034151
unquote ev (#51560)
* unquote ev

* properly test for defined var
6 years ago
Jordan Borean f27078df52
win_power_plan: fix for Windows 10 and Server 2008 compatibility (#51471) 6 years ago
Jordan Borean 2a701d22f4
win_rds move to test group 3 (#51559) 6 years ago
Andrea Tartaglia 042aeba46c Base integration test for gitlab modules (#51490)
* Added basic integration test targets for gitlab modules

* Removed cloud/gitlab config from aliases, it doesn't exist yet

* Fixed CI issues
6 years ago