Commit graph

1825 commits

Author SHA1 Message Date
Jordan Borean
8c5ee3461e win_stat: simplified tests before next change (#32996) 2017-11-16 16:22:57 -05:00
Daniel Shepherd
cfbe9c8aee [cloud] Add IPv6 support for ec2_vpc_subnet module(#30444)
* Add integration test suite for ec2_vpc_subnet

* wrap boto3 connection in try/except

update module documentation and add RETURN docs

add IPv6 support to VPC subnet module

rename ipv6cidr to ipv6_cidr, use required_if for parameter testing, update some failure messages to be more descriptive

DryRun mode was removed from this function a while ago but exception handling was still checking for it, removed

add wait and timeout for subnet creation process

fixup the ipv6 cidr disassociation logic a bit per review

update RETURN values per review

added module parameter check

removed DryRun parameter from boto3 call since it would always be false here

fix subnet wait loop

add a purge_tags parameter, fix the ensure_tags function, update to use compare_aws_tags func

fix tags type error per review

remove **kwargs use in create_subnet function per review

* rebased on #31870, fixed merge conflicts, and updated error messages

* fixes to pass tests

* add test for failure on invalid ipv6 block and update tags test for purge_tags=true function

* fix pylint issue

* fix exception handling error when run with python3

* add ipv6 tests and fix module code

* Add permissions to hacking/aws_config/testing_policies/ec2-policy.json for adding IPv6 cidr blocks to VPC and subnets

* fix type in tests and update assert conditional to check entire returned value

* add AWS_SESSION_TOKEN into environment for aws cli commands to work in CI

* remove key and value options from call to boto3_tag_list_to_ansible_dict

* remove wait loop and use boto3 EC2 waiter

* remove unused register: result vars

* revert az argument default value to original setting default=None
2017-11-16 14:58:12 -05:00
Will Thames
46c4f6311a [cloud] Add retries/backoff to ec2_vpc_subnet module (#31870)
* Allow backoff for describe_subnets

Improve exception handling to latest standards

* Add integration test suite for ec2_vpc_subnet

* Add test for creating subnet without AZ

Fix bug identified by test

Fixes #31905
2017-11-16 13:09:42 -05:00
Will Thames
60b29cf57d [cloud] Follow up on FIXMEs in ec2_ami & ec2_ami tests (#32337)
* Several tests were marked as FIXME and should have been fixed with
the boto3 move.

* Improved tags output. Add purge_tags option (default: no)

* Allow description and tags update

* Return launch_permissions

* Allow empty launch permissions for image creation

* Empty launch permissions should work the same way for image
creation as no launch permissions

* Cope with ephemeral devices in AMI block device mapping

* Ephemeral devices can appear in AMI block devices, and this information should be returned

* Fix notation for creating sets from comprehensions
2017-11-16 10:14:20 -05:00
saichint
aef50eaa40 Integration Tests only: nxos_udld, nxos_udld_interface, nxos_vxlan_vtep_vni (#29143)
* it cases for vxlan_vtep_vni, udld

* platform specific testing

* fix vxlan_vtep for n7k

* fix udld_intf setup

* skip udld tests on titanium n7k

* remove hardcoding

* fix udld tests for titanium
2017-11-16 07:39:59 +00:00
Ganesh Nalawade
ba0aade8f4
Fix ios_config integration test failures (#32959) 2017-11-16 12:37:47 +05:30
Abhijeet Kasurde
e61bcc3438
Provide clear error message after failure (#32928) 2017-11-16 06:42:27 +00:00
Abhijeet Kasurde
2d4c4e09db
Add vmware fact about 'Cores Per Socket' (#32881)
This fix adds new fact - 'Cores Per Socket' about vmware guest machine.
Also, adds integration test for this change.

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2017-11-16 06:22:32 +00:00
Mike Wiebe
208208ab8f Fix nxos_snmp_host bug (#32916)
* Fix nxos_snmp_host bug

* Enable nxos_snmp_host tests
2017-11-16 06:17:42 +00:00
Jordan Borean
1bc4940ee1
added powershell symlink util helper (#27153)
* Added symbolic link util for powershell

* updated module_util license to BSD
2017-11-16 10:12:02 +10:00
Jordan Borean
e16e6313c7 windows: fix for checking locked system files (#30665)
* fix for checking locked system files

* moved functions to share module util and created tests

* fixed windows-paths test based on win_stat changes
2017-11-15 19:04:03 -05:00
Jordan Borean
5e20fd0943 removed psobject to hashtables that were missed (#32710)
* removed psobject to hashtables that were missed

* fix up win_region change
2017-11-15 14:51:16 -08:00
Adrian Likins
86dc3c09ac
Fix vault --ask-vault-pass with no tty (#31493)
* Fix vault --ask-vault-pass with no tty

2.4.0 added a check for isatty() that would skip setting up interactive
vault password prompts if not running on a tty.

But... getpass.getpass() will fallback to reading from stdin if
it gets that far without a tty. Since 2.4.0 skipped the interactive
prompts / getpass.getpass() in that case, it would never get a chance
to fall back to stdin.

So if 'echo $VAULT_PASSWORD| ansible-playbook --ask-vault-pass site.yml'
was ran without a tty (ie, from a jenkins job or via the vagrant
ansible provisioner) the 2.4 behavior was different than 2.3. 2.4
would never read the password from stdin, resulting in a vault password
error like:

        ERROR! Attempting to decrypt but no vault secrets found

Fix is just to always call the interactive password prompts based
on getpass.getpass() on --ask-vault-pass or --vault-id @prompt and
let getpass sort it out.

* up test_prompt_no_tty to expect prompt with no tty

We do call the PromptSecret class if there is no tty, but
we are back to expecting it to read from stdin in that case.

* Fix logic for when to auto-prompt vault pass

If --ask-vault-pass is used, then pretty much always
prompt.

If it is not used, then prompt if there are no other
vault ids provided and 'auto_prompt==True'.

Fixes vagrant bug https://github.com/hashicorp/vagrant/issues/9033

Fixes #30993
2017-11-15 14:01:32 -05:00
Pavel
c56dcb7afa module_utils: vmware.py. Incorrect chain of attributes to obtain snapshots from virtual machine (#32669)
* Update vmware.py
Incorrect chain of attributes to obtain snapshots from virtual machine. Module 'vmware_guest_facts' uses method 'gather_vm_facts' of vmware.py and always gets empty list of snapshots.
* Added test for module vmware_guest_facts. Checked VM snapshots.
* Fixed tests for vmware_guest_facts. Ignored certificate for vmware_guest_snapshot module.
2017-11-15 16:00:22 +00:00
Sebastiaan van Doesselaar
900abcddb3 Integrated publickey import and removal in iosxr_user (#32115)
* Integrated publickey import and removal in iosxr_user

* Fixed linting issues

* Added version added for publickeyfile option

* Added quotation marks to version, oops

* Added some integration tests, added some checks to prevent aggregate users with public keys.

* Added some integration test files

* Created mutually exclusive public_key and public_key_contents versions of config

* Modified tests to use both methods and test more logins

* Added supports for aggregates

* Incorporated provider auth

* Fixed some lint issues

* Fixed a YAML lint issue

* Implemented catches for unconfigured providers.

* Fixed catches, hopefully

* Another test

* Added groups support so you can add users to multiple groups

* Trailing whitespace
2017-11-15 07:34:36 -07:00
Prasad Katti
239464f804 ec2_key: add a test for the force option (#32748)
* ec2_key: test force option

* ec2_key: changes requested via review comments
2017-11-15 22:53:41 +10:00
Gawain
fa764f6918 New Module vmware_host_facts (#26492)
Add new module  vmware_host_facts ,it can get remote vmware host system info like setup module

* modify ansible version
* optimized output for human readable
* add serial number get_system_facts() add ansible_product_serial
* fix pep8 issue and ansible module required format
* Use find_obj method instead get_obj
* add ansible_hostname ansible_distribution_build
* add integration test
* vmware_host_facts integration test add verify
* fix yamllint issue
* fix boilerplate test
* Update vmware_host_facts.py
* fix RETURN key's name
2017-11-14 15:41:55 +00:00
Trishna Guha
3ee2501c83
multiple fixes nxos (#32903)
Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
2017-11-14 15:23:11 +00:00
Trishna Guha
11de330372
change inventory_hostname to ansible_host to fix test (#32890)
Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
2017-11-14 10:44:47 +00:00
Ganesh Nalawade
c3636108bc
Change netconf port in testcase as per test enviornment (#32883) 2017-11-14 15:11:44 +05:30
Trishna Guha
a17244f896
ios_vlan DI module (#32490)
* ios_vlan DI module

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>

* Integration test

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>

* comment out testcases since the image is not available in dci

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>

* add aggregate test

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
2017-11-14 05:50:17 +00:00
Prasad Katti
f891e92581 ec2_key: fix fingerprint generation in tests (#32817) 2017-11-14 14:40:55 +10:00
Sam Doran
ea3638b580 Add proper check mode support to the script module (#31852)
* Do not run script in check mode

Fixes #30676

* Reformat script integration test

* Add integration tests for check mode of script module

* Fix name on test

* Cleanup temp file

* win_script integration test syntaxt changes

* Add check mode tests for win_script

* Use proper variable in test

* Fail if source file does not exist

* Verify script is accessible and don't copy in check mode

Use shlex to properly split shell arguments, though a path with spaces in it still needs to be quoted in the playbook.
Add note to docs describing such.
Improve error message if file is not found indicating there may be a space in the path.

* Properly encode path now that path is split using shlex

* Allow for spaces in both path and script name

* Add unicode character test to Linux script tests

* Add Linux test for space in path to script
2017-11-13 15:33:44 -08:00
Kellin
464ded80f5 Add link dest to synchronize module (#32746)
* Clean up after two recent synchronize tests

- add clean up after the last two tests in synchronize to make them
  match with the expectations in the previous tests

Signed-off-by: Robert Marshall <rmarshall@redhat.com>

* Add link-dest functionality to synchronize module

- add the link-dest option to the synchronize module code
- add tests for the link-dest option
- add documentation of the link_dest option to synchronize
- modify changed flag so it can properly work around rsync
  upstream not flagging hardlinks as a change properly in
  formatted output

Signed-off-by: Robert Marshall <rmarshall@redhat.com>

* Minor change to test
2017-11-13 11:13:25 -05:00
Mike Wiebe
de8d00b401 Fix snmp bugs on Nexus 3500 platform (#32773)
* Add n35 platform support

* Fix regex bug and add snmp_location it tests

* Enable nxos_snmp_location tests
2017-11-13 08:03:06 +00:00
Adrian Likins
9c58827410
Better handling of malformed vault data envelope (#32515)
* Better handling of malformed vault data envelope

If an embedded vaulted variable ('!vault' in yaml)
had an invalid format, it would eventually cause
an error for seemingly unrelated reasons.
"Invalid" meaning not valid hexlify (extra chars,
non-hex chars, etc).

For ex, if a host_vars file had invalid vault format
variables, on py2, it would cause an error like:

  'ansible.vars.hostvars.HostVars object' has no
  attribute u'broken.example.com'

Depending on where the invalid vault is, it could
also cause "VARIABLE IS NOT DEFINED!". The behavior
can also change if ansible-playbook is py2 or py3.

Root cause is errors from binascii.unhexlify() not
being handled consistently.

Fix is to add a AnsibleVaultFormatError exception and
raise it on any unhexlify() errors and to handle it
properly elsewhere.

Add a _unhexlify() that try/excepts around a binascii.unhexlify()
and raises an AnsibleVaultFormatError on invalid vault data.
This is so the same exception type is always raised for this
case. Previous it was different between py2 and py3.

binascii.unhexlify() raises a binascii.Error if the hexlified
blobs in a vault data blob are invalid.

On py2, binascii.Error is a subclass of Exception.
On py3, binascii.Error is a subclass of TypeError

When decrypting content of vault encrypted variables,
if a binascii.Error is raised it propagates up to
playbook.base.Base.post_validate(). post_validate()
handles exceptions for TypeErrors but not for
base Exception subclasses (like py2 binascii.Error).

* Add a display.warning on vault format errors
* Unit tests for _unhexlify, parse_vaulttext*
* Add intg test cases for invalid vault formats

Fixes #28038
2017-11-10 14:24:56 -05:00
Dario Zanzico
8a21fa2c07 remove cpuHotAddEnabled, memoryHotAddEnabled defaults from configSpec (#25202)
* add hardware.hotadd_cpu, hardware.hotadd_memory parameters
* use hotadd_{cpu,memory} paramters on create integration tests
2017-11-10 13:09:30 +00:00
Tim Rightnour
4756b392ea Apply fix to allow the root resource pool of a cluster to be chosen (#31641)
Whitespace cleanup
2017-11-10 13:51:36 +01:00
Jordan Borean
abc4210a33 azure_rm_virtualmachine: add custom image support (#32367)
* azure_rm_virtualmachine: added support for specifying custom image

* Use separate parameter for custom_image, add very basic test

* missed the version_added tag for doco

* removed whitespace I accidentally left in

* merged custom image into the image dict and added more tests

* added one more test
2017-11-09 18:48:14 -05:00
Ganesh Nalawade
37b0537279
Fix ios_config file prompt issue (#32744)
Fixes #23263

Add a carriage return (\r) at end on copy config
command which results in prompt on cli terminal
2017-11-09 22:43:49 +05:30
Will Thames
316e7939d6 [cloud] Improve aws testing and use {{ region }} var (#26892)
* Protect AWS credentials from accidental commits

* Improve documentation for IAM policies

* Update ELB tests to be multi region

Allow AZs to reflect the region in which the tests are run.

This will not work for regions with fewer than three AZs,
but those are relatively rare
2017-11-09 11:56:31 -05:00
Abhijeet Kasurde
dbadb5a014 Add details about snapshot in result (#32730)
This fix adds details about snapshots in result of
vmware_guest_snapshot, when operation is successful.

Fixes: #32154

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2017-11-09 11:42:30 -05:00
Jiri Tyr
1a3037ff63 Making options of type list (fixing #32704) (#32706) 2017-11-09 10:57:27 -05:00
Martin Krizek
356901b72d yum: case for multilib when installing from a file (#32236) 2017-11-09 06:04:53 -05:00
Martin Krizek
714598e91b
acl: do not remove all default entries (#32615) 2017-11-09 10:31:33 +01:00
Abhijeet Kasurde
39595771fa Integration test for git archive without update (#32390)
* Unit test for git archive without update

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>

* Clean clone the repo first
2017-11-09 10:23:26 +01:00
Ganesh Nalawade
6aa95ce5fd
Fix ios and vyos net integration test issue (#32692) 2017-11-08 21:39:21 +05:30
Trishna Guha
5336d14d9d
fix eos_static_route test typo (#32661)
Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
2017-11-08 05:21:35 +00:00
Will Thames
c93ddf5473 Move profile and region checking to module_utils.ec2 (#31921)
* Move profile and region checking to module_utils.ec2

Remove ProfileNotFound checking from individual modules

There are plenty of `if not region:` checks that could be removed,
once more thorough testing of this change has occured

The ec2_asg, iam_managed_policy and ec2_vpc_subnet_facts modules
would also benefit from this change but as they do not have tests
and are marked stableinterface, they do not get this change.
2017-11-07 13:56:17 -05:00
Trishna Guha
48ab1a1334
eos_static_route DI module (#32587)
* eos_static_route DI module

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>

* Integration test

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>

* Add net_static_route test

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>

* Validate ip address

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
2017-11-07 11:13:03 +00:00
Ganesh Nalawade
6d1d06e0f7
Fix junos netconf port issue in integration test (#32610) 2017-11-07 11:41:51 +05:30
Philippe Dellaert
930fde5f70 vmware_dvs_portgroup: Add configuration of vlan trunk, security settings and port policies and integration tests (#32298)
* Add configuration of vlan trunk, security settings and port policies, and tests

This commit adds the following capabilities to the
vmware_dvs_portgroup module:
- Support for VLAN trunk portgroup
- Support for all security settings (promiscuous, forged transmits & mac
address changes)
- Support for all the port specific policies
- port specific policies match the vCenter UI behaviour (for instance:
block override is enabled by default)
- Cleanup and use of proper API entities not root entities
- Integration testing

* Cleanup of docs and adding more examples
2017-11-06 11:46:51 -05:00
Abhijeet Kasurde
c11c882345 Update vmware integration tests (#31273)
* Boilerplat fixed
* Standardized vcsim variables in all modules

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2017-11-06 11:28:15 -05:00
Jordan Borean
978a979566
win_dsc: improved parameter handling (#31556)
* win_dsc: improved parameter handling

* removed uneeded try/catch leftover from testing

* removed undeed return values

* added custom DSC to fully test out casting

* fix up codestyle issues

* using new Requires ps version check

* fixed up error message check on earlier ps version
2017-11-06 09:44:04 +10:00
Jordan Borean
15b492ca57 win_become: get admin token and fix async (#32485)
* win_become: make it easier to become with an admin token

* Fixed up pep8 whitespace

* fix for Server 2008

* Added support for async and become on newer hosts and fix warnings
2017-11-03 16:14:48 -07:00
Jordan Borean
5b1db00b65
win_service: quoted path fix (#32469)
* win_service: fix for path in quotes

* Added tests to verify behaviour doesn't regress
2017-11-03 09:55:03 +10:00
Brian Coca
e582a69e9c
show specific undefined var errors on -v in debug (#32206)
* show specific undefined var errors on -v in debug

allows users to get more specific information about undefined errors
as they might be looking at a complex data structure and need to find
the specific leaf that has the issue

* now tests works at all verbosity levels

* updated to unicode objects
2017-11-02 18:11:31 -04:00
Martin Krizek
7cf3811d29
acl: add integration tests (#32494) 2017-11-02 16:55:42 +01:00
Ganesh Nalawade
6a0e8cae10
Fix net platform agnostic network module integration tests (#32489) 2017-11-02 11:36:18 +05:30
Jordan Borean
9dc9313c65
win_package: add support for arguments as list (#32024)
* win_package: add support for arguments as list

* re-added failure tests as they were accidentally commented out

* changed exit_code in failure messages to rc
2017-11-02 09:39:21 +10:00