Commit Graph

21274 Commits (4794b5da4591797eb250d3e983f43b4ab0b75528)
 

Author SHA1 Message Date
James Cammarata 4794b5da45 Merge class dict with parent dict when creating meta attributes
In some situations, where the Base class defines an Attribute, the
BaseMeta class doesn't properly see the _get_parent_attribute or
_get_attr_<whatever> methods because of multiple layers of subclasses
(ie. Handler, which subclasses Task). This addresses that by merging
the __dict__ of the parent with the current classes __dict__ meaning
all future iterations see available special methods.

Fixes #18378
8 years ago
Matt Clay 912d6ed8cc Clean up code-smell sanity scripts. (#18407)
- Replace find ';' with '+' for faster execution.
- Replace grep -R with -r to avoid recursive warnings.
- Exclude .git and .tox directories from recursive grep.
- Improve messaging on failed sanity checks.
- Add no-basestring check to Shippable.
8 years ago
Matt Clay 8c270ac75f Add empty-init code-smell script. (#18406)
Also removed boilerplate from otherwise empty __init__.py files
which should not contain any code (checked by empty-init script).
8 years ago
Toshio Kuratomi 6a3893c518 Remove direct calls to print and cleanup imports
All display of information should go through display instead of through print.
8 years ago
Brian Coca a0f27d552c File attributes (#18213)
* added attributes to base file params

* dont change attributes when none

* fixed test to deal with new attributes
8 years ago
Brian Coca 7a33c14782 added 'friendly' name to fact gathering
fixes #18198
8 years ago
Brian Coca 8cab33a779 skip vmware inventory when missing lib
fixes #18190
8 years ago
Michael Scherer 37de9031c6 Detect virtualisation on netbsd (#18381)
* Refactor OpenBSD sysctl based detection in a separate class

The idea is later to reuse this code for NetBSD and FreeBSD, who
use a different sysctl key for vendor and product.

* Add detection of virtualisation on NetBSD

* Add support to detect running as a Xen guest

tested on NetBSD 7 on Rackspace.
8 years ago
Michael Scherer ccecbdd78d Add DMI facts on NetBSD and refactor code (#18388)
* Add support for OpenBSD dmi fact gathering

* Refactor get_sysctl in the Hardware class

Due to difference between Darwin/NetBSD and OpenBSD, we
have to change the regexp used split the key/value

* Add support for dmi facts on NetBSD
8 years ago
Toshio Kuratomi 03550caece Move mdt dynamic inventory plugin into contrib/inventory where it
belongs
8 years ago
jbarnett1981 2f7983ef12 Provide MDT Dynamic Inventory script (#18352)
* Add files via upload

* Update mdt_dynamic_inventory.py

Adding maintainer name in docstring
fixing deprecated print syntax on a few lines
fixing configparser import to support python2 and python3

* Update mdt_dynamic_inventory.py

* Update mdt_dynamic_inventory.py

Adding --host functionality
8 years ago
Toshio Kuratomi ee14e0cc2a Text's .translate() is easier to use than bytes
Text strings and byte strings both have a translate method but the byte
string version is harder to use.  It requires a mapping of all 256 bytes
to a translation value.  Text strings only require a mapping from the
characters that are changing to the new string.  Switching to text
strings on both py2 and py3 allows us to state what we're getting rid of
simply without having to rely on the maketrans() helper function.
8 years ago
Matt Clay ecb7f13119 Update log url for Shippable download-logs script.
Also improved error handling.
8 years ago
Michael Scherer fd44917561 Remove duplicate declaration of human_to_bytes
This is already declared in basic.py, in a more complete way.
8 years ago
Michael Scherer 150ea49d8a Add tunnel linux (#18118)
* Refactor the type selection of network device under linux

* Add the tunnel type to the type of net interface under Linux
8 years ago
Michael Scherer df145df962 Make facts detection work on OpenBSD with Python3
The traceback is the following:

    Traceback (most recent call last):
      File \"/tmp/ansible_8s0bj604/ansible_module_setup.py\", line 134, in <module>
        main()
      File \"/tmp/ansible_8s0bj604/ansible_module_setup.py\", line 126, in main
        data = get_all_facts(module)
      File \"/tmp/ansible_8s0bj604/ansible_modlib.zip/ansible/module_utils/facts.py\", line 3641, in get_all_facts
      File \"/tmp/ansible_8s0bj604/ansible_modlib.zip/ansible/module_utils/facts.py\", line 3584, in ansible_facts
      File \"/tmp/ansible_8s0bj604/ansible_modlib.zip/ansible/module_utils/facts.py\", line 1600, in populate
      File \"/tmp/ansible_8s0bj604/ansible_modlib.zip/ansible/module_utils/facts.py\", line 1649, in get_memory_facts
    TypeError: translate() takes exactly one argument (2 given)

And the swapctl output is this:

    # /sbin/swapctl -sk
    total: 83090 1K-blocks allocated, 0 used, 83090 available

The only use of the code is to remove prefix in case they are present, so just
replacing them with empty space is sufficient.
8 years ago
Michael Scherer bd6ac784bb Add support for KVM in the Solaris virt detection
smbios -i 256 return:

    # smbios -i 256
    ID    SIZE TYPE
    256   77   SMB_TYPE_SYSTEM (system information)

      Manufacturer: Red Hat
      Product: KVM
      Version: RHEL 6.4.0 PC

      UUID: 8a3b8b1a-ba59-1a4b-5f85-ab53a5a885a9
      Wake-Up Event: 0x6 (power switch)
      SKU Number:
      Family: Red Hat Enterprise Linux
8 years ago
Michael Scherer 12354869b9 Add xen guest detection on FreeBSD 8 years ago
Michael Scherer bc6c1afb1e Fix media_type detection on NetBSD
On NetBSD 7.0.1, ifconfig return this:
    $ ifconfig
    ne0: flags=8863<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST> mtu 1500
            ec_capabilities=1<VLAN_MTU>
            ec_enabled=0
            address: 00:20:91:45:00:78
            media: Ethernet 10baseT full-duplex
            inet 192.168.156.29 netmask 0xffffff00 broadcast 192.168.156.255

Which result into setup returning this:
    "media_type": "ull-duplex",

So we have to specialise that method, since FreeBSD ifconfig return
something like this:

    ue0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=80009<RXCSUM,VLAN_MTU,LINKSTATE>
        ether 00:20:91:a7:48:45
        inet 192.168.156.11 netmask 0xffffff00 broadcast 192.168.156.255
        media: Ethernet autoselect (100baseTX <full-duplex>)
        status: active
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
8 years ago
Michael Scherer d393409fed Fix type detection on OpenSolaris for loopback interface
Extract of ifconfig output:

    # ifconfig  -a
    lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
            inet 127.0.0.1 netmask ff000000
    rtls0: flags=1004843<UP,BROADCAST,RUNNING,MULTICAST,DHCP,IPv4> mtu 1500 index 3
            inet 192.168.125.125 netmask ffffff00 broadcast 192.168.125.255
            ether 0:20:91:83:45:82
8 years ago
David Côté-Tremblay 221cafe769 Removing the shebang and the execution permission so the command be prefixed with python2 or python3 as needed 8 years ago
Adrian Likins dd0189839e Fix bug (#18355) where encrypted inventories fail 18355 (#18373)
* Fix bug (#18355) where encrypted inventories fail

This is first part of fix for #18355
* Make DataLoader._get_file_contents return bytes

The issue #18355 is caused by a change to inventory to
stop using _get_file_contents so that it can handle text
encoding itself to better protect against harmless text
encoding errors in ini files (invalid unicode text in
comment fields).

So this makes _get_file_contents return bytes so it and other
callers can handle the to_text().

The data returned by _get_file_contents() is now a bytes object
instead of a text object. The callers of _get_file_contents() have
been updated to call to_text() themselves on the results.

Previously, the ini parser attempted to work around
ini files that potentially include non-vailid unicode
in comment lines. To do this, it stopped using
DataLoader._get_file_contents() which does the decryption of
files if vault encrypted. It didn't use that because _get_file_contents
previously did to_text() on the read data itself.

_get_file_contents() returns a bytestring now, so ini.py
can call it and still special case ini file comments when
converting to_text(). That also means encrypted inventory files
are decrypted first.

Fixes #18355
8 years ago
Michael Scherer 5aaf1d1a15 On python 3.5, sys.subversion have been removed
So to get the type of the python interpreter, we need to look at
sys.implementation.name which do not return 'cpython', instead of 'CPython',
but that's upstream breakage, so not much we can do.
8 years ago
scottb fcada3e889 Merge pull request #17201 from trondhindenes/windows_module_docs
Windows module docs
8 years ago
Trond Hindenes 5d75cd1b5e Merge branch 'windows_module_docs' of https://github.com/trondhindenes/ansible into windows_module_docs 8 years ago
Trond Hindenes 986d88c6ff bugfix text 8 years ago
Trond Hindenes e9a2f099f8 bugfix text 8 years ago
Brian Coca bec9ebbf30 added docs for new arg 8 years ago
Brian Coca 8217c1c39c resolve inventory path on init
This allows meta refresh_inventory to work with relative paths
Added option to unfrackpath to not resolv symlinks
fixes #16857
8 years ago
Tom Melendez 28dc527b2c Basic integration test for gce_tag. (#17928) 8 years ago
Toshio Kuratomi ed134d81f1 Limit how much of the file we read to test if it's an encrypted vault file
Fixes memory errors reported in #16391
8 years ago
James Cammarata 7c049b16c7 Adding ansible_release dir created by release to .gitignore 8 years ago
James Cammarata 3cdb9b228a Updating release versions for release playbook 8 years ago
Matt Clay 1238a4c0c9 Run validate-modules with python 2 only.
This allows validate-modules to run in an environment where
python 3 is the default. This will no longer be necessary once
validate-modules is updated to work with both python 2 and 3.
8 years ago
Michael Scherer 57b8acccec Add support for network alias on NetBSD
While testing on netbsd 6.0, ansible setup failed with:

    Traceback (most recent call last):
      File \"/tmp/ansible_m2ieeq/ansible_module_setup.py\", line 134, in <module>
        main()
      File \"/tmp/ansible_m2ieeq/ansible_module_setup.py\", line 126, in main
        data = get_all_facts(module)
      File \"/tmp/ansible_m2ieeq/ansible_modlib.zip/ansible/module_utils/facts.py\", line 3609, in get_all_facts
      File \"/tmp/ansible_m2ieeq/ansible_modlib.zip/ansible/module_utils/facts.py\", line 3552, in ansible_facts
      File \"/tmp/ansible_m2ieeq/ansible_modlib.zip/ansible/module_utils/facts.py\", line 2500, in populate
      File \"/tmp/ansible_m2ieeq/ansible_modlib.zip/ansible/module_utils/facts.py\", line 2584, in get_interfaces_info
      File \"/tmp/ansible_m2ieeq/ansible_modlib.zip/ansible/module_utils/facts.py\", line 2644, in parse_inet_line
    socket.error: illegal IP address string passed to inet_aton

The cause is having aliases on lo like this:

     lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 33184
         inet 127.0.0.1 netmask 0xff000000
         inet alias 127.1.1.1 netmask 0xff000000

So if the address is 'alias', we have to skip it.
8 years ago
Jasper Lievisse Adriaanse c17dad0def Rework how OpenBSD processor facts are resolved 8 years ago
scottb 2131eaba0c Merge pull request #18350 from Shaps/ssh_cp_dir_option_docs
Docs for control_path_dir option
8 years ago
Matt Clay bb3801bafd Cleanup and fixes for code smell scripts.
- Fix shellcheck issues.
- Add .tox exclusions.
8 years ago
James Tanner 2d43b20eb9 Update submodule refs 8 years ago
Toshio Kuratomi a3ba96c512 Fix setup.py install.
In setuptools prior to 21.2.1, package_data can't directly reference
a directory.  Modify the entry for galaxy data so that it includes the
files but not the directories

Fixes #18231
8 years ago
Matt Clay 88dbb5a630 Python 3 fixes for ansible-doc. 8 years ago
Andrea Tartaglia b18263cf36 ANSIBLE_SSH_CONTROL_PATH_DIR option added (#18342)
* ANSIBLE_SSH_CONTROL_PATH_DIR option added

This removes the hardcoded value ( $HOME/.ansible/cp ) from ssh.py.
User is able to change the ControlPath directory ( the one that replaces %(directory)s ).

 Fixes #18325

* Added config option in ansible.cfg
8 years ago
Jasper Lievisse Adriaanse 9547d6b422 Detect vmm virtualization for OpenBSD, both host and guest. 8 years ago
Andrea Tartaglia e70561540c Docs for control_path_dir option 8 years ago
Matt Clay 469c4a106b Fix and create code-smell test for line endings. 8 years ago
Matt Clay 66a0b1475f Update submodule refs. 8 years ago
Tony Kinsley 73da2663a3 Resolves #18312 python3 support for ec2.py 8 years ago
Robin Roth 6ca6a9a291 Exclude floppy disks from lsblk call for uuids
Fixes #18326
8 years ago
James Cammarata 7ff9942ec6 Correctly reassign implicit block parents when an include is involved 8 years ago
Brian Coca 32a7b4ce71 only validate extensions when using dir loading
fixes #18223
8 years ago