Commit Graph

292 Commits (d94cc3568a81596572fabed6a7f0e6d1486b71ca)

Author SHA1 Message Date
jctanner 4ba60d00c8 Refactor the parameter splitting in ini lookup to handle more path formats (#16477)
Refactor the parameter splitting in ini lookup to handle more path formats.

Fixes #16468
2016-06-28 13:24:57 -04:00
Pilou b361bf90d7 Lookup password omit salt (#16361)
* Lookup unencrypted password must not include salt
* Integration test lookup: remove previous directory
* Test that lookup password doesn't return salt
* Lookup password: test behavior with empty encrypt parameter

Closes #16189
2016-06-27 10:44:25 -07:00
James Cammarata aefa12a20f Merge pull request #13709 from traveloka/credstash-support-encr-context
Make credstash lookup plugin support encryption contexts
2016-06-21 11:00:43 -05:00
rdezavalia a7274774ed Support etcd v2. Use this version by default (#12312)
* Support etcd v2. Use this version by default

* default to etcd v1
2016-06-06 11:26:12 -04:00
feliksik 95cf095222 hashi_vault lookup: be more rebust, and allow fields with other name than 'value' (#13690)
* more robust hashi_vault module, and allow querying specific field in secret-dict

* allow fetching entire secret dict with trailing ':'

* process comment by bcoca for PR #13690
2016-05-14 21:48:31 -04:00
Toshio Kuratomi c75b5ba85f Use to_bytes and to_str instead of str as str is unsafe. 2016-04-04 12:57:32 -07:00
Dag Wieers 055aae55f7 Implement own CSVRecoder and CSVReader from documentation
As detailed in the python manual:
https://docs.python.org/2/library/csv.html
2016-04-04 20:32:08 +02:00
Dag Wieers ac75069ee0 Support different encoding types in csvfile lookup plugin
This fixes #15266.
2016-04-04 14:11:44 -04:00
Brian Coca 0bd6f3a5e8 correctly adds searchpath as list 2016-04-01 23:14:56 -04:00
Toshio Kuratomi b70bf3b056 Use io.StringIO and io.BytesIO instead of StringIO.StringIO for compat with py3 2016-02-26 16:43:05 -08:00
Brian Coca a8aa5ff4eb fix cartesian lookup
it seems that this was not working in 1.9 but we swallowed up the error
fixes #14437
2016-02-11 10:35:37 -05:00
Dag Wieers dee5dba82a Handle when the lookup-plugin is used in jinja-style
This fixes #14190.
2016-02-03 17:10:40 +01:00
Brian Coca dd4787701f fix unicode input for template lookup
fixes #14207
2016-01-29 10:42:52 -05:00
Brian Coca c2ac1507ea corrected host/group match in inventory_hostnames
now the lookup works when using ! and & operators
fixes #13997
2016-01-20 18:32:39 -05:00
Michel Alexandre Salim afb2abf980 Make credstash lookup plugin support encryption contexts
Previously, the lookup plugin passes all its keyword arguments to
credstash's `getSecret`; while this works for passing the standard
parameters (version, region and table), this does not allow passing
a dictionary of key-value pairs as `getSecret`'s context parameter.

Instead, pop `version`, `region` and `table` from `kwargs`, supplying
the default value if they are not defined, and pass the rest of the `kwargs`
as the `context` parameter.
2016-01-02 15:23:27 +07:00
Brian Coca 89646d4253 no need to be executable 2015-11-16 14:40:35 -08:00
Sebi Calbaza 1f052d5ce6 fixed super invocation 2015-11-15 13:48:40 +02:00
Toshio Kuratomi 958fb29b78 Merge pull request #12881 from Scypho/devel
fix for issue #11885 - allowing json in lookup template calls
2015-11-12 15:39:35 -08:00
Toshio Kuratomi 62979efa14 Finish up plugin porting to global display
Also remove display = display which does nothing
2015-11-11 10:44:23 -08:00
Toshio Kuratomi b05d0b8c9c Port lookup plugins to global display. 2015-11-11 10:44:22 -08:00
Toshio Kuratomi db5d3f03a9 Fix first_found not finding files in roles (only templates) 2015-11-09 13:47:17 -08:00
Brian Coca 57d3245d0d remove commented out prints 2015-10-30 14:02:41 -04:00
Jens Peter Schroer ecae636160 allowing json in lookup template calls 2015-10-23 14:21:46 +02:00
James Cammarata 86de1429e5 Cleaning up FIXMEs 2015-10-22 16:03:50 -04:00
Toshio Kuratomi f34b55ac2b Add python3-compat boilerplate to all .py files in lib/ansible 2015-10-19 18:36:19 -07:00
Toshio Kuratomi 7aa9f6754a Cleanup more pyflakes warnings (2 real problems) 2015-10-19 12:01:01 -07:00
Toshio Kuratomi 0888d78b84 Cleanup some pyflakes warning (1 real error) 2015-10-19 11:42:46 -07:00
Brian Coca 6d87bd405d Merge pull request #12765 from bcoca/lookup_inventory_hostname
implemented inventory_hostname lookup in v2
2015-10-16 15:05:23 -04:00
Toshio Kuratomi baa309309d Bundle a new version of python-six for compatibility along with some code to make it easy for distributions to override the bunndled copy if they have a new enough version. 2015-10-16 08:21:28 -07:00
Brian Coca 9b088a1e40 implemented inventory_hostname lookup in v2 2015-10-15 13:11:42 -04:00
Toshio Kuratomi 8277747a04 Fix password lookup when password file exists and the password is not encrypted 2015-10-12 15:52:03 -07:00
Toshio Kuratomi b49e0995cb Fix typo 2015-10-12 13:29:04 -07:00
Toshio Kuratomi b58d7470d4 Cleanup logic and be more paranoid about passwords with spaces 2015-10-12 12:55:33 -07:00
Brian Coca f5f3bf06e4 Merge pull request #12550 from redrampage/remove-pw-salt-deletion
Removed deletion of salt by 'password' lookup
2015-10-12 11:33:19 -04:00
Brian Coca 4ba5ebd1c8 Merge pull request #12538 from yesbox/url_lookup_plugin_httperror_fix
Fix url lookup plugin HTTPError message not being reachable
2015-10-02 21:30:16 -04:00
Abhijit Menon-Sen 49b35ad5dd Remove mysterious old cruft
The two lines were added in 2673eb0a and modified in 60e1a1f8, but foo
is completely unused. Removing it doesn't break anything: out it goes!
2015-10-01 20:32:08 +05:30
RedRampage 922b5c8109 Removed deletion of salt by 'password' lookup
Removed deletion of salt param from lookup file by 'password' lookup_filter.
Old behaviour leads to constant changed status when two tasks uses same lookup,
one with 'encrypt' parameter, and other without.

For example:

    tasks:
      - name: Create user
        user:
          password: "{{ lookup('password', inventory_dir + '/creds/user/pass' ncrypt=sha512_crypt) }}"
          ...
    # Lookup file 'creds/user/pass' now contain password with salt
      - name: Create htpasswd
        htpasswd:
          password: "{{ lookup('password', inventory_dir + '/creds/user/pass') }}"
          ...
    # Salt gets deleted from lookup file 'creds/user/pass'
    # Next run of "Create user" task will create it again and will have 'changed' status
2015-09-28 23:28:01 +03:00
Jesper Geertsen Jonsson 353b549eb0 Fix HTTPError message not being reachable 2015-09-27 18:01:19 +00:00
James Cammarata 60e1a1f8eb Fix bug in nested lookup where pop is called indiscriminately 2015-09-25 17:16:56 -04:00
James Cammarata 65630d2ce1 Fixing one more bug related to staticmethods in LookupBase 2015-09-23 02:33:32 -04:00
James Cammarata cbbb270761 Cleanup bug from moving base lookup methods to staticmethods 2015-09-23 02:26:19 -04:00
Toshio Kuratomi c83f51b7f2 Some LookupBase cleanups:
* Make LookupBase an abc with required methods (run()) marked as an
  abstractmethod
* Mark methods that don't use self as @staticmethod
* Document how to implement the run method of a lookup plugin.
2015-09-22 16:19:36 -07:00
James Cammarata c95d4ca05f Properly assign search path to environment.loader in template lookup
Same fix as was applied in f162990c to the action plugin

Fixes #12355
2015-09-17 14:47:20 -04:00
Toshio Kuratomi e2c49b4ef4 Fix problem with "=" in the initial file path. 2015-09-09 11:14:31 -07:00
Toshio Kuratomi c68e04c185 Use parse_kv to correctly parse parameters from password lookup
Fixes https://github.com/ansible/ansible-modules-core/issues/1968
2015-09-04 12:18:46 -07:00
Marius Gedminas 0c6ce31f76 Use 'except ... as' syntax
This syntax works on Python 2.6 through 3.x.  lib/ansible/module_utils
(and lib/ansible/modules) need to support Python 2.4, so I didn't touch
those.
2015-08-27 22:15:04 +03:00
Brian Coca b2bfe3502b make sure delimiter is basestring for cvsfile
fixes #12062
2015-08-26 18:38:39 -04:00
Brian Coca 47d9e7ca93 Merge pull request #11984 from Alphadelta14/devel
Support any Mapping for with_dict lookup.
2015-08-22 12:39:42 -04:00
Brian Coca 2787b3acac ported consul_kv lookup from v1 2015-08-21 00:22:20 -04:00
Brian Coca 74079db8d2 ported dig lookup from v1 2015-08-21 00:22:01 -04:00
Brian Coca 1acb29ff9b sequence will now run once for start=end, added test to suite
fixes #11979
2015-08-18 02:33:23 -04:00
Alphadelta14 77b60a1a67 Support any Mapping for with_dict lookup.
This resolves 3939348286 breaking `with_dict: hostvars`.
2015-08-17 20:11:24 -04:00
Brian Coca 9f5e4c0ef6 lookup plugin that does no flattening 2015-08-14 17:05:41 -04:00
Brian Coca 8af0ff4a58 Merge pull request #11567 from lekum/shelvefile_lookup
Add shelvefile lookup plugin
2015-08-13 10:47:44 -04:00
Brian Coca 7666bde666 updated hashi_vault to new listify, added to changelog 2015-08-10 21:10:00 -04:00
Brian Coca 4399ddc7da Merge pull request #11674 from defionscode/hashi_vault_lookup
Hashicorp Vault lookup Plugin
2015-08-10 21:07:22 -04:00
Jonathan Davila 175068fdae Hashicorp Vault lookup Plugin 2015-08-10 19:35:28 -04:00
Toshio Kuratomi d35b956900 listify lookup plugin terms when they're specified as "{{ lookup(terms) }}"
Before this, they were not listified there but they were listified when
specified like this:

with_lookup: terms
2015-08-10 09:07:37 -07:00
Brian Coca 8f106c9a58 Merge pull request #11078 from Yannig/devel
New lookup plugin : ini
2015-08-07 09:46:54 -04:00
Yannig Perré 07fcb50b9b Porting ini lookup plugin against ansible v2. 2015-08-07 09:40:24 +02:00
Brian Coca 3c57018a10 Merge pull request #11778 from Ensighten/add_credstash_plugin
add credstash lookup plugin
2015-08-06 23:27:18 -04:00
Scott Cunningham 87ef53c962 credstash lookup plugin: python 2.6-compatible string.format() 2015-08-05 23:40:43 -07:00
Scott Cunningham c4629b72e0 credstash lookup plugin: error out in run function when credstash not installed, not at module scope 2015-08-05 23:37:10 -07:00
Yannig Perré 09d257e637 Porting ini lookup plugin against ansible v2. 2015-08-05 12:07:16 +02:00
James Cammarata dbd755e0f4 Fix jinja2 template search pathing
Fixes #9933
2015-08-04 22:50:16 -04:00
Scott Cunningham 934ce86d35 update credstash lookup plugin to use Python 2.4-compatible exception catching 2015-08-04 18:29:37 -07:00
James Cammarata 5266679964 Use templar all the way down
Fixes bugs related to creating Templar() objects on the fly, where
the shared loader objects (serialized to TaskExecutor) aren't used
so information loaded into plugin loaders after forking is lost.

Fixes #11815
2015-08-04 12:25:53 -04:00
James Cammarata 2673eb0afb Add option to fail on undefined variables to listify
And use it in the call to get the loop items for a task.
2015-08-03 12:04:31 -04:00
Scott Cunningham 193e857bc4 credstash lookup plugin: raise AnsibleError when credstash library not installed 2015-07-30 21:04:26 +01:00
Scott Cunningham 695e456cb0 add credstash lookup plugin 2015-07-29 11:18:13 +01:00
James Cammarata d6cafff2f9 Additional changes to fix fileglob relative path lookups 2015-07-27 16:35:57 -04:00
James Cammarata ee835ff7ad Add a base-level get_basedir method for lookup plugins and fix relative lookups
Fixes #11746
2015-07-27 10:41:28 -04:00
Abhijit Menon-Sen 8737061a8f lookupfile should lookup the given file=xxx
(Earlier it used to lookup the pre-split term.)
2015-07-25 15:38:26 +05:30
Brian Coca 851ed45bbf adding display to plugins and start moving debug to display 2015-07-23 10:26:12 -04:00
Brian Coca b678b9828c simplified and normalized lookup search path behaviour 2015-07-22 22:32:37 -04:00
Serge van Ginderachter 8d1549900c fix AnsibleError object name in subelements plugin
fixes #11624
2015-07-17 17:39:31 +02:00
Alejandro Guirao 587a6cb44c Remove v1 code 2015-07-13 15:48:23 +02:00
Alejandro Guirao 6e99023c84 Changed to support Ansible v2 2015-07-13 15:37:27 +02:00
Alejandro Guirao 8efc42d993 Add shelvefile lookup plugin 2015-07-13 10:31:35 +02:00
Brian Coca 5122455db8 ported missing sequence updates from 1.9 2015-07-03 13:54:51 -04:00
James Cammarata 9341148f04 Throw an error if with_first_found finds no files by default
Fixes #9976
2015-07-01 16:09:34 -04:00
Toshio Kuratomi d315f6e22c Fix Etcd constructor 2015-06-12 12:59:29 -07:00
Toshio Kuratomi 77c76e632e Switch etcd and url lookup plugins to verify ssl certificates 2015-06-12 12:54:57 -07:00
Brian Coca aaab69cae9 brought back terms testing as with_ is not only way to call and we cannot guarantee terms is a list otherwise. 2015-06-11 13:45:04 -04:00
Brian Coca 40336b50af removed redundant string check
added playbook path lookup
2015-06-10 22:58:08 -04:00
Davide Guerri ee06eebea3 Fix lookup() plugin
lookup() plugin is currently broken because _get_file_contents() now
returns a tuple: (contents, show_data).

This patch fix that issue.
2015-06-04 19:46:09 +01:00
Brian Coca 3e2e81d896 missing path in import path for making paths 2015-06-02 23:42:00 -04:00
Brian Coca 2590df6df1 created makedirs_safe function for use in cases of multiprocess
should fix #11126 and most race conditions
2015-06-02 11:41:30 -04:00
James Cammarata 9aa8676bdd More template unit tests for v2 2015-05-17 01:06:02 -05:00
James Cammarata 830225d9c1 Fix errors in subelements lookup plugin and associated tests (v2) 2015-05-12 15:09:03 -05:00
Serge van Ginderachter 9b646dea41 Add optional 'skip_missing' flag to subelements 2015-05-12 12:52:16 -05:00
James Cammarata ce3ef7f4c1 Making the switch to v2 2015-05-03 21:47:26 -05:00