Commit Graph

36 Commits (6b3bab64769988baadde13e85cf1afa8fd381f9c)

Author SHA1 Message Date
Abhijeet Kasurde 6b3bab6476
plugin: fixed examples of csv lookup plugin (#83068)
Fixes: #83031

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2 months ago
Brian Coca 8b2dd5fdd3
updated looups to use set_option in custom parse (#82425)
limit password params
  updated test error message catching
  make sure we reset params for each term
  ensure we only update options if we have em
5 months ago
Herman van Rink d6a8df3218
csvfile - add a keycol parameter to specify in which column to search. (#82242) 7 months ago
Adam Ross b815b15362
Fix additional spelling errors in builtin modules (#82012) 8 months ago
Matt Clay 9f899f9492
Require `from __future__ import annotations` (#81902) 8 months ago
Jesús Martínez Novo f2ade88334
Fix yaml syntax in csvfile_lookup example (#81221)
Testing this example gives a parse error.
The correct syntax needs a colon for assignment, not equal sign
11 months ago
Felix Fontein 7cf15d0732
Use semantic markup for remaining plugins. (#81189)
also change  `ansible_psrp_protocol` for `protocol`  as what matters is the option itself, not what was used to set it
11 months ago
Sloane Hertel 1ecc62ba06
Document lookups using dwim (#80878) 1 year ago
Matt Clay 2cd1744be3
Use ansible.module_utils.common.text.converters (#80704)
Replace use of old `ansible.module_utils._text` and add a unit test to maintain backwards compatibility.
1 year ago
Felix Fontein 7e634f54c3
Module/plugin docs: (#78380) 2 years ago
Matt Clay f68c66a3ef Remove collections compat from controller code. 2 years ago
Syed Ali Haider 6bca0a5dc2
docs: add fqcn to module examples (#73546)
Co-authored-by: Felix Fontein <felix@fontein.de>
2 years ago
Brian Coca 84e473a26e
All lookups ported to config system (#74108)
* all lookups to support config system

 - added get_options to get full dict with all opts
 - fixed tests to match new error messages
 - kept inline string k=v parsing methods for backwards compat
 - placeholder depredation for inline string k=v parsing
 - updated tests and examples to also show new way
 - refactored and added comments to most custom k=v parsing
 - added missing docs for template_vars to template
 - normalized error messages and exception types
 - fixed constants default
 - better details value errors

Co-authored-by: Felix Fontein <felix@fontein.de>
3 years ago
Felix Fontein aff78f4cbc
Fix various sanity errors in plugins (#71736)
* Fix various sanity errors in plugins.

* Revert callback_type -> type transform.

* Undo paramiko_ssh 'connection' change, since this discrepancy is hardcoded in the plugin loader.

* Standardize on name and type (for callbacks).

* Fix existing author entries.

* Add 'Unknown (!UNKNOWN)' as author when author is missing.

* These are actually parsed as integers in the code.

* Revert "Add 'Unknown (!UNKNOWN)' as author when author is missing."

This reverts commit 29d1438aca.
4 years ago
Rick Elrod 1b4fd23ba6
csvfile: use parse_kv() for args, add tests (#70550)
Change:
- Use parse_kv() for parsing in the csvfile lookup plugin. This allows
  us to handle multi-word search keys and filenames. Previously, the
  plugin split on space and so none of these things worked as expected.
- Add integration tests for csvfile, testing a plethora of weird cases.

Test Plan:
- New integration tests, CI

Tickets:
- Fixes #70545

Signed-off-by: Rick Elrod <rick@elrod.me>
4 years ago
Matt Clay a11f631ee4 Python 3.8 collections compatibility fixes.
Includes a new pylint blacklist plugin to prevent regressions.
6 years ago
Colin McCarthy 84a40b71c2 Added (Define Values From CSV File) to example section (#46620)
Adding a new example demonstrating setting facts from a CSV file, from a real-world network use case.
6 years ago
Abhijeet Kasurde 063d19048d
plugins: Doc improvement (#41378)
* Typo fixes
* Grammer fixes
* Option fixes

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
6 years ago
vigiroux 0b3ed626b3 empty lines in csvfile means row has no items in list; check row len first. (#40089) 6 years ago
Toshio Kuratomi 09325b619e
Fix csvfile traceback on Python3 (#37625)
* Fix csvfile traceback on Python3

The csvfile lookup uses some custom iterators.  These needed to be
ported to handle the python3 iterator protocol.  In addition, the
csvfile module takes an iterator of byte strings in Python2 and an
iterator of text strings in Python3

Fixes #36808
6 years ago
Matt Martz 99d4f5bab4 Remove uses of assert in production code (#32079)
* Remove uses of assert in production code

* Fix assertion

* Add code smell test for assertions, currently limited to lib/ansible

* Fix assertion

* Add docs for no-assert

* Remove new assert from enos

* Fix assert in module_utils.connection
7 years ago
Brian Coca 24d4787b2d Lookup docs (#30280)
* finalize lookup documentation
* minor fixes to ansible-doc
 - actually show which file caused error on when listing plugins
 - removed redundant display of type and name
* smart quote fixes from toshio
7 years ago
Dag Wieers 5553b20828 Collated PEP8 fixes (#25293)
- Make PEP8 compliant
7 years ago
Toshio Kuratomi 6bad4e57bd Migrate most uses of if type() to if isinstance()
Also convert those checks to use abcs instead of dict and list.

Make a sentinel class for strategies to report when they've reache the end
7 years ago
Toshio Kuratomi 4ed88512e4 Move uses of to_bytes, to_text, to_native to use the module_utils version (#17423)
We couldn't copy to_unicode, to_bytes, to_str into module_utils because
of licensing.  So once created it we had two sets of functions that did
the same things but had different implementations.  To remedy that, this
change removes the ansible.utils.unicode versions of those functions.
8 years ago
Brian Coca 3c39bb5633 fixed lookup search path (#16630)
* fixed lookup search path

added ansible_search_path var that contains the proper list and in order
removed roledir var which was only used by first_found, rest used role_path
added needle function for lookups that mirrors the action plugin one, now
both types of plugins use same pathing.

* added missing os import

* renamed as per feedback

* fixed missing rename in first_found

* also fixed first_found

* fixed import to match new error class

* fixed getattr ref
8 years ago
Toshio Kuratomi c75b5ba85f Use to_bytes and to_str instead of str as str is unsafe. 8 years ago
Dag Wieers 055aae55f7 Implement own CSVRecoder and CSVReader from documentation
As detailed in the python manual:
https://docs.python.org/2/library/csv.html
8 years ago
Dag Wieers ac75069ee0 Support different encoding types in csvfile lookup plugin
This fixes #15266.
8 years ago
Toshio Kuratomi 7aa9f6754a Cleanup more pyflakes warnings (2 real problems) 9 years ago
Brian Coca b2bfe3502b make sure delimiter is basestring for cvsfile
fixes #12062
9 years ago
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
9 years ago
James Cammarata ee835ff7ad Add a base-level get_basedir method for lookup plugins and fix relative lookups
Fixes #11746
9 years ago
Abhijit Menon-Sen 8737061a8f lookupfile should lookup the given file=xxx
(Earlier it used to lookup the pre-split term.)
9 years ago
Brian Coca b678b9828c simplified and normalized lookup search path behaviour 9 years ago
James Cammarata ce3ef7f4c1 Making the switch to v2 9 years ago