Commit Graph

20185 Commits (bd31cc096af11ccbf203a34dda480909d7d38be9)
 

Author SHA1 Message Date
Toshio Kuratomi bd31cc096a Fix facts.py for python3 (#17131)
* Fix facts.py for python3

* Update facts unittest to account for filepaths being byte strings
8 years ago
Peter Sprygada 9d29431661 Merge pull request #17114 from skg-net/Dell_Ansible_Roadmap
Added Dell Networking Modules to the Roadmap
8 years ago
Sandra Wills 63be666b53 Merge pull request #17119 from sam-at-github/patch-3
I think that is a better analogy.
8 years ago
Adrian Likins 7bd57acda4 Linux mount/fs (lsblk) facts fixes and tests. (#17036)
Fixes #10779

Refactor some of the block device, mount point, and
mtab/fstab facts collection for linux for better
performance on systems with lots of block devices.

Instead of invoking 'lsblk' for every entry in mtab,
invoke it once, then map the results to mtab entries.

Change the args used for invoking 'findmnt' since the
previous combination of args conflicts, so this would
always fail on some systems depending on version.

Add test cases for facts Hardware()/Network()/Virtual() classes
__new__ method and verify they create the proper subclass based
on the platform.system() results.

Split out all the 'invoke some command and grab it's output'
bits related to linux mount paths into their own methods so
it is easier to mock them in unit tests.

Fix the DragonFly* classes that did not defined a 'platform'
class attribute. This caused FreeBSD systems to potentially
get the DragonFly* subclasses incorrectly. In practice it
didnt matter much since the DragonFly* subclasses duplicated
the FreeBSD ones. Actual DragonFly systems would end up with
the generic Hardware() etc instead of the DragonFly* classes.

Fix Hardware.__new__() on PY3, passing args to __new__
would cause "object() takes no parameters" errors. So
check for PY3 and just call __new__ without the args

See
https://hg.python.org/cpython/file/44ed0cd3dc6d/Objects/typeobject.c#l2818
for some explaination.
8 years ago
nitzmahone 9fedcdfc47 bump extras submodule ref 8 years ago
nitzmahone 88c36bbc34 bump submodule refs 8 years ago
jctanner 14da357feb vmware inventory script enhancements (#17106)
* Allow the user to disable certificate verification
* Allow the user to find VMs only in specific clusters
8 years ago
James Cammarata b617d62203 Don't use an unset playbook basedir when searching for hostgroup vars
The flag new_pb_basedir is not being utilized in Inventory._get_hostgroup_vars,
leading to the situation where an inventory with no playbook basedir set will
read host/group vars from the $CWD, regardless of the inventory and/or playbook
relative location. This patch corrects that by not using the playbook basedir
if it is unset (None).

This patch also corrects a bug in which the VariableManager would accumulate
host/group vars files, which could lead to incorrect vars files being used when
playbooks are run from different directories containing their own group/host vars
directories.

Fixes #16953
8 years ago
sam-at-github a2d0bbed8c Handlers are triggered at the play level, not playbook. (#17121) 8 years ago
James Cammarata 732d722a7f Catch a missing include_vars filename
Related to ansible/ansible-modules-core#4445
8 years ago
sam-at-github 16426ad795 I think that is a better analogy. 8 years ago
Matt Davis e0bdb502e3 raw now returns changed: true (#17112)
for consistency w/ shell/command/script "non-idempotent" modules.

Updated tests, changelog.
8 years ago
Senthil Kumar Ganesan 48df950a75 Added Dell Networking Modules to the Roadmap 8 years ago
Josh Smift 81d7e132f9 force deletion of .pyc files (#17109) 8 years ago
James Cammarata f4237b2151 Rework the way params are assigned to TaskIncludes when they're dynamic
Copying the TaskInclude task (which is the parent) before loading the blocks
makes the code much more simple and clean, and fixes a bug introduced during
the performance improvement changes (and specifically the change which moved
things to a single-parent model).

Fixes #17064
8 years ago
Nathaniel Case cada4fb8d1 Relicense netcfg.py to BSD (#17110)
As with #17025. The caveat regarding machilde's (now obsoleted) commit has been addressed, so netcfg.py is able to be easily relicensed.
8 years ago
Olaf Alders 8681df4b58 s/shutdown/shut down/ (#17107)
shutdown is a noun.  In the task name you really want a verb.
8 years ago
Brian Coca 297e2d8266 added bits and bytes arg types (#17102)
* added bits and bytes arg types

* changed function alias method as per feedback

* use enumerate vs managing i myself
8 years ago
Brian Coca b1410fa278 fixed tests to accoutn for new parameter 8 years ago
Brian Coca 5fe9d3c3d5 make parsed param private and explicit (#17104)
* make parsed param private and explicit

* fixed missed parsed
8 years ago
Ryan S. Brown 30268f6bd0 Pass keyword arguments from modules to _boto3_conn 8 years ago
Scott Butler 124c1e3d27 Added substitution definitions and references for version number, etc 8 years ago
James Tanner f62df4e78d Update submodule refs 8 years ago
scottb 89ce1fc917 Merge pull request #17051 from ferrants/patch-2
Update playbooks_lookups.rst
8 years ago
James Cammarata f722d41eab Allow notifies to be sent to the top level includes when they were static
Since we introduced static includes in 2.1, this broke the functionality
where a notify could be sent to a named include statement, triggering all
handlers contained within the include. This patch fixes that by adding a
search through the parents of a handler for any TaskIncludes which match.

Fixes #15915
8 years ago
Ryan Brown c5cc6edb93 Merge pull request #16606 from ryansb/rds-cluster-inventory-aioue
Support RDS clusters in AWS dynamic inventory script
8 years ago
Ryan S. Brown 0783c172d7 Paginate DB cluster responses in AWS RDS dynamic inventory 8 years ago
David Shrewsbury bf8c871801 Fix async logic when parsing fails (#17091)
We want to NOT consider the async task as failed if the result is
not parsed, which was the intent of:

  https://github.com/ansible/ansible/pull/16458

However, the logic doesn't actually do that because we default
the 'parsed' value to True. It should default to False so that
we continue waiting, as intended.
8 years ago
James Tanner 1f5552f586 Update submodule refs 8 years ago
James Cammarata daf6eb97d3 Make sure includes for handlers in roles look in the correct subdir 8 years ago
Brian Coca 64a8d24b72 slightly better presentation docs
- description items are now separated
- choices/defaults start at their own line
8 years ago
Tim Whittington b3c686f4c5 Note that to_nice_yaml(indent=X) was new in 2.2 (#17085)
The ability to pass indent parameter to to_nice_yaml was introduced in 2.2, but this is not noted in the docs.
8 years ago
Ted Timmons f4bd38a153 document what glob style is used (#17080)
Took some digging to find that `with_fileglob` calls a method named `fileglob()`, which uses Python's `glob` library.
8 years ago
Brian Coca 4c034fd002 updated container detection to new lxc (#17063)
fixes #17030
8 years ago
Peter Sprygada 8620fda947 Merge pull request #17077 from agaffney/junos_doc_fix
Update junos docs fragment to note the default port for transport=netconf
8 years ago
John R Barker a8a8ef4682 2.1 has been released
Also link to new feature documentation - We need to do more of this

Thanks to kustodian for suggesting this
8 years ago
James Cammarata 3c65c03a67 Changing license on module_utils/splitter.py to BSD 8 years ago
Andrew Gaffney fdabfb6821 Update junos docs fragment to note the default port for transport=netconf 8 years ago
James Cammarata c669a381d1 Don't immediately return failed for any_errors_fatal tasks
Instead of immediately returning a failed code (indicating a break in
the play execution), we internally 'or' that failure code with the result
(now an integer flag instead of a boolean) so that we can properly handle
the rescue/always portions of blocks and still remember that the break
condition was hit.

Fixes #16937
8 years ago
Matt Clay b44eb402bd Update ansible-core-ci endpoint. (#17071) 8 years ago
scottb 7eed464db0 Merge pull request #17061 from nickmisasi13/patch-1
Update developing_inventory.rst
8 years ago
Dag Wieers cb5675a29f Remove a useless section, only act on 'shell' (#16205) 8 years ago
Matt Clay 4cee67452b Update submodule refs. 8 years ago
jctanner da23700b15 Update submodule refs (#17062) 8 years ago
Dag Wieers 56148291e9 Emit warnings when safe_eval() raises a SyntaxError or other Exception (#14304)
This change is related to reported issue #14291 and pull request #14293.

Without the fix from #14293, this change will emit a warning as shown below, on the following playbook:

``yaml
---
- hosts: localhost
  gather_facts: no
  vars:
    works:
      key1: 'string'
      key2: 1234
    fails:
      key1: 'string'
      key2: 1234
      key3: false
  tasks:
  - debug: msg={{ works | to_json }}
  - debug: msg={{ fails | to_json }}
```

On error, this results in a proper warning:

```
[dag@moria ansible.dag]$ ansible-playbook test49.yml

PLAY ***************************************************************************

TASK [debug] *******************************************************************
ok: [localhost] => {
    "msg": {
        "key1": "string",
        "key2": 1234
    }
}

TASK [debug] *******************************************************************
 [WARNING]: Error in expression "{"key3": false, "key2": 1234, "key1": "string"}". (name 'false' is not defined)

ok: [localhost] => {
    "msg": "{\"key3\": false, \"key2\": 1234, \"key1\": \"string\"}"
}

PLAY RECAP *********************************************************************
localhost                  : ok=2    changed=0    unreachable=0    failed=0
```
8 years ago
nickmisasi13 85dd9aa4ec Update developing_inventory.rst
Changed a misleading line from returning to printing
8 years ago
Dag Wieers 1268f4778d Introduce new 'filetree' lookup plugin (#14332)
* Introduce new 'filetree' lookup plugin

The new "filetree" lookup plugin makes it possible to recurse over a tree of files within the task loop. This makes it possible to e.g. template a complete tree of files to a target system with little effort while retaining permissions and ownership.

The module supports directories, files and symlinks.

The item dictionary consists of:
 - src
 - root
 - path
 - mode
 - state
 - owner
 - group
 - seuser
 - serole
 - setype
 - selevel
 - uid
 - gid
 - size
 - mtime
 - ctime

EXAMPLES:
Here is an example of how we use with_filetree within a role:

```yaml
 - name: Create directories
   file:
     path: /web/{{ item.path }}
     state: directory
     mode: '{{ item.mode }}'
     owner: '{{ item.owner }}'
     group: '{{ item.group }}'
     force: yes
   with_filetree: web/
   when: item.state == 'directory'

 - name: Template complete tree
   file:
     src: '{{ item.src }}'
     dest: /web/{{ item.path }}
     state: 'link'
     mode: '{{ item.mode }}'
     owner: '{{ item.owner }}'
     group: '{{ item.group }}'
   with_filetree: web/
   when: item.state == 'link'

 - name: Template complete tree
   template:
     src: '{{ item.src }}'
     dest: /web/{{ item.path }}
     mode: '{{ item.mode }}'
     owner: '{{ item.owner }}'
     group: '{{ item.group }}'
     force: yes
   with_filetree: web/
   when: item.state == 'file'
```

SPECIAL USE:
The following properties also have its special use:

 - root: Makes it possible to filter by original location
 - path: Is the relative path to root
 - uid, gid: Makes it possible to force-create by exact id, rather than by name
 - size, mtime, ctime: Makes it possible to filter out files by size, mtime or ctime

TODO:
 - Add snippets to documentation

* Small fixes for Python 3

* Return the portion of the file’s mode that can be set by os.chmod()

And remove the exists=True, which is redundant.

* Use lstat() instead of stat() since we support symlinks

* Avoid a few possible stat() calls

* Bring in line with v1.9 and hybrid plugin

* Remove glob module since we no longer use it

* Included suggestions from @RussellLuo

- Two blank lines will be better. See PEP 8
- I think if props is not None is more conventional 😄

* Support failed pwd/grp lookups

* Implement first-found functionality in the path-order
8 years ago
Jim Ladd 329a134cb3 Increase local version for unofficial rpms (#17026) 8 years ago
Matt Davis 525c0469d2 tweak hacking/env-setup to work under ash (#17054) 8 years ago
jctanner 39d764c7ad Restore previous behavior of ignoring missing files via with_fileglob (#17053)
Fixes #16801
8 years ago