Commit graph

7770 commits

Author SHA1 Message Date
Pascal Grange
8b08a28c89 fixes issue #13981: unsafe_writes block appeared too late in the atom… (#17405)
* fixes issue #13981: unsafe_writes block appeared too late in the atomic_move
workflow. This led to errno.EBUSY to not be managed in the context of
issue #!#981

* Reduce changes to fix #13981

* Abstract the unsafe_writes fallback into a helper method.
Explicitly try/except os.rename part of the code and call this helper method.
If the code fails in shutil.copy2 or shutil.move this should not be related to issue #13981
since they write to b_tmp_dest_name.
(as suggested by @abadger)

* Check if unsafe_writes in the caller, not in _unsafe_writes.
That way the function call reads as "Do an unsafe write"
and not as "I think we should do an unsafe_write.
2016-09-22 11:31:35 -04:00
Peter Sprygada
839f908a14 fixes mode on module_utils/dellos9.py (#17682) 2016-09-22 10:42:57 -04:00
Toshio Kuratomi
dde7c11713 Update submodule refs 2016-09-21 20:42:22 -07:00
Toshio Kuratomi
8aa8e07d13 Remove _load_hosts() from Play initialization as it's no longer needed and it breaks using extra_vars defining a list for hosts (#17699)
Thanks to @jimi-c for the solution

Fixes #16583
2016-09-21 17:25:54 -07:00
James Cammarata
c9d3d2b9a0 Allow for empty source in dwim_path_relative_stack
Fixes #17192
2016-09-21 16:16:14 -05:00
James Cammarata
23651b657e Create a raw lookup for hostvars that does not template the data
When using hostvars to get extra connection-specific vars for connection
plugins, use this raw lookup to avoid prematurely templating all of the
hostvar data (triggering unnecessary lookups).

Fixes #17024
2016-09-21 13:16:08 -05:00
Ondra Machacek
04165fb6c0 Add oVirt support to ansible/module_utils module (#17364)
* Add oVirt utility module

This patch add oVirt utility module, which contains helper functions,
for oVirt modules and also shared documentation fragment for oVirt.

* Adjust to Python 2.4

* Fixups

* Add support for poll interval and fixes
2016-09-21 12:41:36 -04:00
Gabriele
cfd880dab8 Adding raw check to nxos.py (#17659) 2016-09-21 05:35:56 -04:00
Peter Sprygada
765a76885b fixes issue where config sessions where left behind (#17673)
When using the Cli transport, if the session hung on a command and the
socket timed out, the config session would be left behind.  This change
will allow the shell to try to get control back and remove the config
session, assuming the channel is still open.

fixes ansible/ansible-modules-core#4945
2016-09-20 16:30:09 -04:00
Peter Sprygada
2a908b832c fixes commit confirm check in junos shared module (#17663)
The module didn't perform a commit confirm check which would cause
checking commits to be non idempotent.  This change will fix that problem.
2016-09-20 16:12:08 -04:00
Matt Clay
24c9e047c3 Remove test-docs from module search ignore list. (#17670) 2016-09-20 15:38:46 -04:00
Matt Clay
08e964a9c5 Update submodule refs. 2016-09-20 12:24:36 -07:00
Brian Coca
1e4e188318 changed missing file error to warning for lookups (#16800)
* changed missing file error to warning for lookups

* changed plugins that expected exception

warning will still be displayed, they now work with None value
2016-09-20 15:05:11 -04:00
Toshio Kuratomi
55cbe257cc Update submodule refs to pick up pip fixes 2016-09-20 11:03:28 -07:00
James Cammarata
4dc2bf4815 Take ITERATING_ALWAYS into account when setting failed state in PlayIterator
Fixes #15963
2016-09-20 11:11:52 -05:00
Timothy Appnel
1975a545bd Implements verbose always to assert action plugin module (#17654) 2016-09-20 10:52:21 -05:00
Toshio Kuratomi
a683256342 Update core submodule ref for pip fix 2016-09-20 08:05:43 -07:00
James Cammarata
1b54d3b6dc Merge branch 'threaded_receiver' into devel 2016-09-20 09:18:26 -05:00
Toshio Kuratomi
2f6ab44c76 Update sumodule refs 2016-09-20 07:10:17 -07:00
Peter Sprygada
547cea556f remove old imports from junos shared module (#17655)
this cleans up the old import mechanisms in the junos shared module
2016-09-19 23:14:17 -04:00
Peter Sprygada
433a0e1e40 allow netcfg to pass kwargs from __call__ to configure() (#17653)
This minor fix allows kwargs to pass from Config __call__ to the underlying
transport instance.
2016-09-19 22:27:31 -04:00
Peter Sprygada
6fc9ffd28e clean up junos shared module (#17652)
This cleans up the junos module removing some unneeded commands and fixing
method signature with unneeded **kwargs
2016-09-19 22:27:23 -04:00
Peter Sprygada
662008115b Merge pull request #17651 from skg-net/bugfix
Fix to handle the prompt on saving startup config
2016-09-19 21:15:44 -04:00
Matt Clay
5f72bae3b0 Update submodule refs. 2016-09-19 17:00:31 -07:00
Matt Clay
ded45fb535 Update submodule refs. 2016-09-19 16:35:05 -07:00
Senthil Kumar Ganesan
081730851c Fix to handle the prompt on saving startup config 2016-09-19 14:41:30 -07:00
Matt Clay
42a2875b83 Update submodule refs. 2016-09-19 13:52:51 -07:00
James Cammarata
1d2e1a5648 Do not set run_once for meta noop tasks
Fixes #17581
2016-09-19 14:27:02 -05:00
Toshio Kuratomi
e3451be457 Update submodule refs 2016-09-19 11:53:32 -07:00
Peter Sprygada
b38181116b Merge pull request #17638 from privateip/fix-netcli
fixes issue where netcli would cause exception with an invalid conditional
2016-09-19 14:46:13 -04:00
Toshio Kuratomi
5e9a8d9202 Fix password lookup py3 plus alikins unittest additions refactoring (#17626)
* Improve unit testing of 'password' lookup

The tests showed some UnicodeErrors for the
cases where the 'chars' param include unicode,
causing the 'getattr(string, c, c)' to fail.
So the candidate char generation code try/excepts
UnicodeErrors there now.

Some refactoring of the password.py module to make
it easier to test, and some new tests that cover more
of the password and salt generation.

* More refactoring and fixes.

* manual merge of text enc fixes from pr17475

* moving methods to module scope

* more refactoring

* A few more text encoding fixes/merges

* remove now unused code

* Add test cases and data for _gen_candidate_chars

* more test coverage for password lookup

* wip

* More text encoding fixes and test coverage

* cleanups

* reenable text_type assert

* Remove unneeded conditional in _random_password

* Add docstring for _gen_candidate_chars

* remove redundant to_text and list comphenesion

* Move set of 'chars' default in _random_password

on py2, C.DEFAULT_PASSWORD_CHARS is a regular str
type, so the assert here fails. Move setting the
default into the method and to_text(DEFAULT_PASSWORD_CHARS)
if it's needed.

* combine _random_password and _gen_password

* s/_create_password_file/_create_password_file_dir

* native strings for exception msgs

* move password to_text to _read_password_file

* move to_bytes(content) to _write_password_file

* add more test assertions about genned pw's

* Some cleanups to alikins and abadger's password lookup refactoring:

* Make DEFAULT_PASSWORD_CHARS into a text string in constants.py
  - Move this into the nonconfigurable section of constants.
* Make utils.encrypt.do_encrypt() return a text string because all the
  hashes in passlib should be returning ascii-only strings and they are
  text strings in python3.
* Make the split up of functions more sane:
   - Don't split such that conditionals have to occur in two separate functions.
   - Don't go overboard: Good to split file system manipulation from parsing
     but we don't need to do every file manipulation in a separate
     function.
  - Don't split so that creation of the password store happens in two
    parts.
  - Don't split in such a way that no decisions are made in run.
* Organize functions by when it gets called from run().
* Run all potential characters through the gen_candidate_chars function
  because it does both normalization and validation.
* docstrings for functions
* Change when we store salt slightly.  Store it whenever it was already
  present in the file as well as when encrypt is requested.  This will
  head of potential idempotence bugs where a user has two playbook tasks
  using the same password and in one they need it encrypted but in the
  other they need it plaintext.
* Reorganize tests to follow the order of the functions so it's easier
  to figure out if/where a function has been tested.
* Add tests for the functions that read and write the password file.
* Add tests of run() when the password has already been created.
* Test coverage currently at 100%
2016-09-19 11:37:57 -07:00
Peter Sprygada
1a8ad2a20f fixes issue where netcli would cause exception with an invalid conditional
The Conditional instance will cause a stack trace if the provided conditional
does not map properly to the response.  This fixes that issue so that the
Conditional instance will now raise a FailedConditionalError with the
conditional that caused the failure.

Modules *_command modules (and any other modules that create an instance
of Conditional) should be updated to catch the FailedConditionalError
exception.
2016-09-19 14:14:43 -04:00
Brian Coca
a87a239124 draft of return common fields
(cherry picked from commit da2da568a051d51edd8c25a4d324089f8bd616eb)
2016-09-19 12:35:59 -04:00
fallencliff
06d46a1ecc update facts.py for aix (#17539)
* update facts.py for aix

add product_serial ,lpar_info,product_name and pv/vg info into facts

10.223.219.10 | SUCCESS => {
    "ansible_facts": {
        "ansible_all_ipv4_addresses": [
            "77.77.77.1", 
            "10.223.219.10"
        ], 
        "ansible_all_ipv6_addresses": [
            "::1%1/0"
        ], 
        "ansible_architecture": "chrp", 
        "ansible_date_time": {
            "date": "2016-09-13", 
            "day": "13", 
            "epoch": "1473760269", 
            "hour": "17", 
            "iso8601": "2016-09-13T09:51:09Z", 
            "iso8601_basic": "20160913T175109568670", 
            "iso8601_basic_short": "20160913T175109", 
            "iso8601_micro": "2016-09-13T09:51:09.569251Z", 
            "minute": "51", 
            "month": "09", 
            "second": "09", 
            "time": "17:51:09", 
            "tz": "BEIST", 
            "tz_offset": "BEIST", 
            "weekday": "Tuesday", 
            "weekday_number": "2", 
            "weeknumber": "37", 
            "year": "2016"
        }, 
        "ansible_default_ipv4": {
            "address": "10.223.219.10", 
            "broadcast": "10.223.219.127", 
            "device": "en3", 
            "flags": [
                "UP", 
                "BROADCAST", 
                "NOTRAILERS", 
                "RUNNING", 
                "SIMPLEX", 
                "MULTICAST", 
                "GROUPRT", 
                "64BIT", 
                "CHECKSUM_OFFLOAD(ACTIVE)", 
                "LARGESEND", 
                "CHAIN"
            ], 
            "gateway": "10.223.219.1", 
            "interface": "en3", 
            "macaddress": "00:11:25:be:4b:75", 
            "mtu": "1400", 
            "netmask": "255.255.255.128", 
            "network": "10.223.219.0", 
            "type": "unknown"
        }, 
        "ansible_default_ipv6": {}, 
        "ansible_distribution": "AIX", 
        "ansible_distribution_release": "1", 
        "ansible_distribution_version": "6", 
        "ansible_dns": {}, 
        "ansible_domain": "", 
        "ansible_en0": {
            "device": "en0", 
            "flags": [
                "UP", 
                "BROADCAST", 
                "NOTRAILERS", 
                "RUNNING", 
                "SIMPLEX", 
                "MULTICAST", 
                "GROUPRT", 
                "64BIT", 
                "CHECKSUM_OFFLOAD(ACTIVE)", 
                "LARGESEND", 
                "CHAIN"
            ], 
            "ipv4": [
                {
                    "address": "77.77.77.1", 
                    "broadcast": "77.77.77.127", 
                    "netmask": "255.255.255.128", 
                    "network": "77.77.77.0"
                }
            ], 
            "ipv6": [], 
            "macaddress": "00:14:5e:b8:cd:a6", 
            "mtu": "1500", 
            "type": "unknown"
        }, 
        "ansible_en3": {
            "device": "en3", 
            "flags": [
                "UP", 
                "BROADCAST", 
                "NOTRAILERS", 
                "RUNNING", 
                "SIMPLEX", 
                "MULTICAST", 
                "GROUPRT", 
                "64BIT", 
                "CHECKSUM_OFFLOAD(ACTIVE)", 
                "LARGESEND", 
                "CHAIN"
            ], 
            "ipv4": [
                {
                    "address": "10.223.219.10", 
                    "broadcast": "10.223.219.127", 
                    "netmask": "255.255.255.128", 
                    "network": "10.223.219.0"
                }
            ], 
            "ipv6": [], 
            "macaddress": "00:11:25:be:4b:75", 
            "mtu": "1400", 
            "type": "unknown"
        }, 
        "ansible_env": {
            "AUTHSTATE": "compat", 
            "CLCMD_PASSTHRU": "1", 
            "HOME": "/home/yd_hzj", 
            "LANG": "C", 
            "LC_ALL": "C", 
            "LC_MESSAGES": "C", 
            "LC__FASTMSG": "true", 
            "LOCPATH": "/usr/lib/nls/loc", 
            "LOGIN": "yd_hzj", 
            "LOGNAME": "yd_hzj", 
            "MAIL": "/var/spool/mail/yd_hzj", 
            "NLSPATH": "/usr/lib/nls/msg/%L/%N:/usr/lib/nls/msg/%L/%N.cat", 
            "ODMDIR": "/etc/objrepos", 
            "PATH": "/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin:/usr/java14/jre/bin:/usr/java14/bin", 
            "PWD": "/home/yd_hzj", 
            "PYTHONPATH": "", 
            "SHELL": "/usr/bin/ksh", 
            "SSH_CLIENT": "10.223.172.41 33369 22", 
            "SSH_CONNECTION": "10.223.172.41 33369 10.223.219.10 22", 
            "SSH_TTY": "/dev/pts/12", 
            "TERM": "vt100", 
            "TZ": "BEIST-8", 
            "USER": "yd_hzj", 
            "_": "/usr/bin/python"
        }, 
        "ansible_fips": false, 
        "ansible_firmware_version": "SF240_358", 
        "ansible_fqdn": "test1", 
        "ansible_gather_subset": [
            "hardware", 
            "network", 
            "virtual"
        ], 
        "ansible_hostname": "test1", 
        "ansible_interfaces": [
            "en0", 
            "lo0", 
            "en3"
        ], 
        "ansible_kernel": "1", 
        "ansible_lo0": {
            "device": "lo0", 
            "flags": [
                "UP", 
                "BROADCAST", 
                "LOOPBACK", 
                "RUNNING", 
                "SIMPLEX", 
                "MULTICAST", 
                "GROUPRT", 
                "64BIT", 
                "LARGESEND", 
                "CHAIN"
            ], 
            "ipv4": [
                {
                    "address": "127.0.0.1", 
                    "broadcast": "127.255.255.255", 
                    "netmask": "255.0.0.0", 
                    "network": "127.0.0.0"
                }
            ], 
            "ipv6": [
                {
                    "address": "::1%1/0"
                }
            ], 
            "macaddress": "unknown", 
            "mtu": "16896", 
            "type": "unknown"
        }, 
        "ansible_lpar_info": "1 test1", 
        "ansible_machine": "00CE5FA34C00", 
        "ansible_memfree_mb": 9992, 
        "ansible_memtotal_mb": 98304, 
        "ansible_nodename": "test1", 
        "ansible_os_family": "AIX", 
        "ansible_pkg_mgr": "svr4pkg", 
        "ansible_processor": "PowerPC_POWER5", 
        "ansible_processor_cores": 2, 
        "ansible_processor_count": 12, 
        "ansible_product_name": "IBM,9119-595", 
        "ansible_product_serial": "02E5FA3", 
        "ansible_python": {
            "executable": "/usr/bin/python", 
            "has_sslcontext": false, 
            "type": "CPython", 
            "version": {
                "major": 2, 
                "micro": 5, 
                "minor": 7, 
                "releaselevel": "final", 
                "serial": 0
            }, 
            "version_info": [
                2, 
                7, 
                5, 
                "final", 
                0
            ]
        }, 
        "ansible_python_version": "2.7.5", 
        "ansible_selinux": false, 
        "ansible_service_mgr": "src", 
        "ansible_ssh_host_key_dsa_public": "AAAAE23Nzav1hVVTNNoYvp7eokKbwY", 
        "ansible_ssh_host_key_ecdsa_public": "AAAAE2VjZHNhLXNoYvp7eokKbwY=", 
        "ansible_ssh_host_key_rsa_public": "AAAAB3Nzav1hVVTNfKiM4W1j9mcw==", 
        "ansible_swapfree_mb": 16558, 
        "ansible_swaptotal_mb": 16896, 
        "ansible_system": "AIX", 
        "ansible_user_dir": "/home/yd_hzj", 
        "ansible_user_gecos": "", 
        "ansible_user_gid": 7, 
        "ansible_user_id": "yd_hzj", 
        "ansible_user_shell": "/usr/bin/ksh", 
        "ansible_user_uid": 263, 
        "ansible_userspace_bits": "32", 
        "ansible_vgs": {
            "realsyncvg": [
                {
                    "free_pps": "6", 
                    "pp_size": "128 megabyte(s)", 
                    "pv_name": "hdisk74", 
                    "pv_state": "active", 
                    "total_pps": "1999"
                }
            ], 
            "rootvg": [
                {
                    "free_pps": "0", 
                    "pp_size": "256 megabyte(s)", 
                    "pv_name": "hdisk0", 
                    "pv_state": "active", 
                    "total_pps": "546"
                }, 
                {
                    "free_pps": "113", 
                    "pp_size": "256 megabyte(s)", 
                    "pv_name": "hdisk1", 
                    "pv_state": "active", 
                    "total_pps": "546"
                }
            ], 
            "testvg": [
                {
                    "free_pps": "838", 
                    "pp_size": "256 megabyte(s)", 
                    "pv_name": "hdisk105", 
                    "pv_state": "active", 
                    "total_pps": "999"
                }, 
                {
                    "free_pps": "599", 
                    "pp_size": "256 megabyte(s)", 
                    "pv_name": "hdisk106", 
                    "pv_state": "active", 
                    "total_pps": "999"
                }
            ]
        }, 
        "module_setup": true
    }, 
    "changed": false
}

* Update facts.py

* Update facts.py
2016-09-19 12:20:29 -04:00
Michael Scherer
968101f611 Fix #17624 (#17627)
Even if the size of the network is 0, it should have a netmask.
2016-09-19 11:58:20 -04:00
Nathaniel Case
881da2b3f1 Fix call to axapi_call_v3() (#17637)
Closes #17584
2016-09-19 16:42:23 +01:00
René Moser
6247e7bc38 cloudstack: move common code to module_utils (#17635) 2016-09-19 14:47:03 +02:00
René Moser
3f6f4617dc cloudstack: fix has_changed dict values comparsion (#17632)
In some rare situations, the CloudStack API returns string for numbers
when we expected int.

With this fix, we ensure we compare the types expected.
2016-09-19 14:02:29 +02:00
Peter Sprygada
ff52e01a11 Merge pull request #17625 from skg-net/dellos6_template
Added support for template module for Dell Networking OS6 devices
2016-09-18 22:26:20 -04:00
Peter Sprygada
8f8eb84ebf Merge pull request #17613 from Qalthos/pyez_check
Add simple checks for libraries to junos
2016-09-18 22:25:13 -04:00
Peter Sprygada
79d1b51dfb Merge pull request #17623 from dgjustice/nxos_fixes
Fixed transport issues when calling self.execute from Cli
2016-09-18 22:24:01 -04:00
Joshua Elsasser
fa5f8a7543 Fix slaac filter (#17551) 2016-09-17 23:52:10 +02:00
d3justi
261666a01b Removed checks from Nxapi class. D\'oh\! 2016-09-17 14:40:00 -05:00
d3justi
07f3b27351 added a couple more checks 2016-09-17 14:32:03 -05:00
Senthil Kumar Ganesan
463349c0d1 Added support template module for Dell Networking OS6 devices 2016-09-17 10:55:40 -07:00
d3justi
d34f7c24d9 Fixed transport issues when calling self.execute from Cli 2016-09-17 10:38:24 -05:00
James Cammarata
5a57c66e3c Moving result reading to a background thread 2016-09-17 08:12:52 -05:00
Toshio Kuratomi
2989527cd9 Fix dataloader using deprecated version of is_encrypted (#17615) 2016-09-17 00:45:29 -07:00
Peter Sprygada
6826ed3879 Merge pull request #17622 from privateip/network-plugin-fix
fixes AttributeError: 'Task' object has no attribute '_block'
2016-09-16 22:31:34 -04:00
Peter Sprygada
353f6be273 Merge pull request #17545 from privateip/asa
removes filter attribute from asa
2016-09-16 22:06:19 -04:00