Commit Graph

29 Commits (d5edb77db4c7f1617ab10facf5a6c821e126abe6)

Author SHA1 Message Date
Alex Willmer d5edb77db4 Add description of ansible.utils.path.unfrackpath() basedir argument 1 month ago
Matt Clay 9f899f9492
Require `from __future__ import annotations` (#81902) 8 months 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
Brian Coca b439e41a91
expand ansible-doc coverage (#74963)
* Expand ansible-doc to tests/filters and fix existing issues

  enable filter/test docs if in single file or companion yaml
  add docs for several filters/tests plugins
  allow .yml companion for docs for other plugins, must be colocated
  verify plugins are valid (not modules, cannot)
  fix 'per collection' filtering
  limit old style deprecation (_ prefix) to builtin/legacy
  start move to pathlib for saner path handling
  moved some funcitons, kept backwards compat shims with deprecation notice

  Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
  Co-authored-by: Felix Fontein <felix@fontein.de>
  Co-authored-by: Sandra McCann <samccann@redhat.com>
2 years ago
Brian Coca ba87c225cd
fixed fetch traversal from slurp (#68720)
* fixed fetch traversal from slurp

  * ignore slurp result for dest
  * fixed naming when source is relative
  * fixed bug in local connection plugin
  * added tests with fake slurp
  * moved existing role tests into runme.sh
  * normalized on action excepts
  * moved dest transform down to when needed
  * added is_subpath check
  * fixed bug in local connection

fixes #67793

CVE-2019-3828
4 years ago
Matt Martz 737dbefd78
Get copy tests passing with split controller/target (#58516)
* Get copy tests passing with split controller/target

* Remove sudoers file

* add missed set_fact
5 years ago
Sam Doran 6cf6f5a34b
Use atexit to cleanup tmp dirs (#56532)
* Wrap everything in try/except to avoid leaving files behind
* Add unit tests, integration tests, and changelog
* Do text the correct way
5 years ago
Matt Davis e38881410f caution tape on makedirs_safe (#55241)
* removed usages in winrm/psrp to be consistent with other connection plugins
5 years ago
Matt Clay eec0275b27 Fix encoding handling in unfrackpath. 5 years ago
Brian Coca 3886f80e44 fix paths to actually be config file relative (#31533)
* fix paths to actually be config file relative

also allow to unfrack paths for 'not cwd'
only use -i 'localhost,' for adhoc in pull
7 years ago
Toshio Kuratomi 3f12fccd02 Fix several things causing tracebacks with unicode cwd (#27731)
Fixes #27511
7 years ago
Dag Wieers 51b595992b ansible/utils/: PEP8 compliancy (#24686)
- Make PEP8 compliant
7 years ago
Brian Coca 8f97aef1a3 Transition inventory into plugins (#23001)
* draft new inventory plugin arch, yaml sample

 - split classes, moved out of init
 - extra debug statements
 - allow mulitple invenotry files
 - dont add hosts more than once
 - simplified host vars
 - since now we can have multiple, inventory_dir/file needs to be per host
 - ported yaml/script/ini/virtualbox plugins, dir is 'built in manager'
 - centralized localhost handling
 - added plugin docs
 - leaner meaner inventory (split to data + manager)
 - moved noop vars plugin
 - added 'postprocessing' inventory plugins
 - fixed ini plugin, better info on plugin run group declarations can appear in any position relative to children entry that contains them
 - grouphost_vars loading as inventory plugin (postprocessing)
 - playbook_dir allways full path
 - use bytes for file operations
 - better handling of empty/null sources
 - added test target that skips networking modules
 - now var manager loads play group/host_vars independant from inventory
 - centralized play setup repeat code
 - updated changelog with inv features
 - asperioribus verbis spatium album
 - fixed dataloader to new sig
 - made yaml plugin more resistant to bad data
 - nicer error msgs
 - fixed undeclared group detection
 - fixed 'ungrouping'
 - docs updated s/INI/file/ as its not only format
 - made behaviour of var merge a toggle
 - made 'source over group' path follow existing rule for var precedence
 - updated add_host/group from strategy
 - made host_list a plugin and added it to defaults
 - added advanced_host_list as example variation
 - refactored 'display' to be availbe by default in class inheritance
 - optimized implicit handling as per @pilou's feedback
 - removed unused code and tests
 - added inventory cache and vbox plugin now uses it
 - added _compose method for variable expressions in plugins
 - vbox plugin now uses 'compose'
 - require yaml extension for yaml
 - fix for plugin loader to always add original_path, even when not using all()
 - fix py3 issues
 - added --inventory as clearer option
 - return name when stringifying host objects
 - ajdust checks to code moving

* reworked vars and vars precedence
 - vars plugins now load group/host_vars dirs
 - precedence for host vars is now configurable
 - vars_plugins been reworked
 - removed unused vars cache
 - removed _gathered_facts as we are not keeping info in host anymore
 - cleaned up tests
 - fixed ansible-pull to work with new inventory
 - removed version added notation to please rst check
 - inventory in config relative to config
 - ensures full paths on passed inventories

* implicit localhost connection local
7 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
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
Toshio Kuratomi 313d4b2c9e Move a path being passed around as a byte string to being passed around as a text string. (#17190)
This is enough to get minimal copy module working on python3

We have t omodify dataloader's path_dwim_relative_stack and everything
that calls it to use text paths instead of byte string paths
8 years ago
Toshio Kuratomi 1ecf51d87e * Fix race in creating temp directories pre-fork (#16965)
* These can still race when multiple ansible processes are created at
    the same time.
* Reverse order of expanduser and expandvars in unfrakpath(). So that
  tildes in environment variables will be handled.
8 years ago
Brian Coca 3afe50dfe2 push unicode handling into unfrack 8 years ago
Brian Coca bae988ee9b fix path utils 8 years ago
Brian Coca 38cca53669 return friendlier error when failing to make dirs 8 years ago
Matt Clay 1e1852c34d Add missing to_bytes on directory path. 8 years ago
Robin Roth e01ff3b352 remove unused imports
clean up imports of time.sleep and stat that are no (longer) used here
9 years ago
James Cammarata ff9f5d7dc8 Starting to add additional unit tests for VariableManager
Required some rewiring in inventory code to make sure we're using
the DataLoader class for some data file operations, which makes mocking
them much easier.

Also identified two corner cases not currently handled by the code, related
to inventory variable sources and which one "wins". Also noticed we weren't
properly merging variables from multiple group/host_var file locations
(inventory directory vs. playbook directory locations) so fixed as well.
9 years ago
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.
9 years ago
Brian Coca 65b82f69e4 avoid failing when mode is none 9 years ago
Brian Coca ba02e5e3bf minor adjustments as per code review 9 years ago
Brian Coca 2590df6df1 created makedirs_safe function for use in cases of multiprocess
should fix #11126 and most race conditions
9 years ago
James Cammarata ce3ef7f4c1 Making the switch to v2 9 years ago