summaryrefslogtreecommitdiff
path: root/bin
Commit message (Collapse)AuthorAgeFilesLines
* Move ansible-test entry point. (#60281)Matt Clay2019-08-081-21/+1
|
* Relocate ansible-test code. (#60147)Matt Clay2019-08-061-5/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Initial move of `test/runner/` content. `test/runner/lib/` -> `test/lib/ansible_test/_internal/` `test/runner/` -> `test/lib/ansible_test/_internal/data/` * Initial move of `test/sanity/` content. `test/sanity/` -> `test/lib/ansible_test/_internal/data/sanity/` (except `test/sanity/ignore.txt`) * Initial move of `test/units/pytest/` content. `test/units/pytest/` -> `test/lib/ansible_test/_internal/data/pytest/` * Follow-up move of `test/runner/unit/` content. `test/lib/ansible_test/_internal/data/unit/` -> `test/lib/ansible_test/tests/unit/` * Initial move of `ansible.cfg` content. `test/units/ansible.cfg` -> `test/lib/ansible_test/_internal/data/units/ansible.cfg` `test/env/ansible.cfg` -> `test/lib/ansible_test/_internal/data/env/ansible.cfg` * Follow-up move of `data` directory. `test/lib/ansible_test/_internal/data/` -> `test/lib/ansible_test/_data/` * Update import statements. * Add missing __init__.py for unit tests. * Fix path references and miscellaneous issues.
* move CLI entrypoints under ansible package (#60004)Matt Davis2019-08-022-488/+2
| | | | * needed so ansible-test can always find the right ones to copy to a target * renamed the underlying scripts to be properly accessible as Python modules
* Use atexit to cleanup tmp dirs (#56532)Sam Doran2019-06-281-3/+0
| | | | | | * Wrap everything in try/except to avoid leaving files behind * Add unit tests, integration tests, and changelog * Do text the correct way
* Migrate command line parsing to argparse (#50610)Matt Martz2019-04-231-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Start of migration to argparse * various fixes and improvements * Linting fixes * Test fixes * Fix vault_password_files * Add PrependAction for argparse * A bunch of additional tweak/fixes * Fix ansible-config tests * Fix man page generation * linting fix * More adhoc pattern fixes * Add changelog fragment * Add support for argcomplete * Enable argcomplete global completion * Rename PrependAction to PrependListAction to better describe what it does * Add documentation for installing and configuring argcomplete * Address rebase issues * Fix display encoding for vault * Fix line length * Address rebase issues * Handle rebase issues * Use mutually exclusive group instead of handling manually * Fix rebase issues * Address rebase issue * Update version added for argcomplete support * -e must be given a value * ci_complete
* Add check to log jsonrpc request/response (#54606)Ganesh Nalawade2019-04-031-2/+7
| | | | | | | | | | | Fixes #54605 Add check in ansible-connection to check if persistent log message is enabled, if yes log the jsonrpc request in log file. With the current approach the _messages queue in `NetworkConnectionBase` is getting overwritten and response for `pop_message` api inovcation from ansible-connection is not recevied at the module side.
* Save the command line arguments into a global contextToshio Kuratomi2019-01-031-3/+3
| | | | | | | | | | | | | | * Once cli args are parsed, they're constant. So, save the parsed args into the global context for everyone else to use them from now on. * Port cli scripts to use the CLIARGS in the context * Refactor call to parse cli args into the run() method * Fix unittests for changes to the internals of CLI arg parsing * Port callback plugins to use context.CLIARGS * Got rid of the private self._options attribute * Use context.CLIARGS in the individual callback plugins instead. * Also output positional arguments in default and unixy plugins * Code has been simplified since we're now dealing with a dict rather than Optparse.Value
* Log device interaction and push labeled logs back to controller (#50028)Nathaniel Case2018-12-211-1/+2
| | | | | | | | | | | | * Add session tracing support for network_cli, netconf and httapi connection * Add `persistent_log_messages` configuration option to log device inteaction in log file for network_cli, netconf and httapi connection type * Log jsonrpc request and response in log file is configuration option is enabled * Update docs to talk about warning shown when persistent_log_messages is on
* Fix some handling of log messages from ansible-connection (#50214)Nathaniel Case2018-12-201-1/+3
|
* Allow persistent connection plugins to queue messages back to ↵Nathaniel Case2018-12-191-9/+11
| | | | | | | | | | | | ansible-connection (#49977) * Connections can queue messages to be returned from ansible-connection * Provide fallback for invalid display level * Strip display from plugins * Route messages through helper method to try to avoid improper appends
* Don't fail if a remote_addr with a '/' hits ansible_connection (#49781)Nathaniel Case2018-12-171-1/+6
| | | | | | | | | | | | * Fail if a remote_addr with a '/' hist ansible_connection This is _probably_ a CIDR block, but anything with a slash will fail, so no need to try to parse to make sure * Locks are now per-socket_path. Locks use the same value as socket_path. Locks are also cleaned up in shutdown like sockets.
* Update bare exceptions to specify Exception.Toshio Kuratomi2018-12-161-1/+1
| | | | | This will keep us from accidentally catching program-exiting exceptions like KeyboardInterupt and SystemExit.
* use ansible json encoding/decoding to avoid errors (#47214)Brian Coca2018-11-161-4/+5
| | | | tackle known issues with (de)serializing certain objects fixes #47200
* Remove runtime usage of pkg_resources.Toshio Kuratomi2018-10-182-13/+1
| | | | | | This should provide a startup time speed boost at the expense of making it harder to get ansible to use newer versions of packages than are provided by the platform.
* Clean up after ansible-connection if failure occurred in start() (#45929)Nathaniel Case2018-09-201-0/+2
|
* Make ansible-test available in the bin directory. (#45876)Matt Clay2018-09-191-0/+15
|
* Move plugin option settings. (#44774)Nathaniel Case2018-08-281-4/+0
| | | | | | * Move plugin option settings. * Add default value and clear after use.
* Prevent data being truncated over persistent connection socket (#43885)Nathaniel Case2018-08-101-19/+20
| | | | | | | | | | | | | | | | | | * Change how data is sent to the persistent connection socket. We can't rely on readline(), so send the size of the data first. We can then read that many bytes from the stream on the recieving end. * Set pty to noncanonical mode before sending * Now that we send data length, we don't need a sentinel anymore * Copy socket changes to persistent, too * Use os.write instead of fdopen()ing and using that. * Follow pickle with sha1sum of pickle * Swap order of vars and init being passed to ansible-connection
* Raise exception if command timeout is triggered (#43078)Ganesh Nalawade2018-08-021-9/+16
| | | | | | | | | | | | | | | | | | | | * Raise exception if command timeout is triggered Fixes #43076 If persistent connection timeout is triggered, riase exception which will be send over socket to module code instead of silently shutting down the socket. * Fix CI failure * Fix review comment * Fix CI failure * Fix review comment * Fix review comment
* \r does not round-trip the local socket, escape and restore on the other ↵Nathaniel Case2018-08-011-0/+2
| | | | side (#43507)
* Enable setting options for cliconf and other implementation plugins (if set ↵Ganesh Nalawade2018-07-301-0/+5
| | | | | | | | | | | | | to configurable) (#43368) * Enable setting setting cliconf plugin options Fixes #43367 * Add support to set configuration options for implementation plugins (eg: cliconf) from `ansible-connection` * Fix CI failure
* Remove unused imports from /bin and lib/ansible/cli (#43440)joren4852018-07-301-1/+1
| | | | | | * Remove unused imports from lib/ansible/cli * Remove unused imports from bin/
* Support setting persistent command timeout per task basis (#42847)Ganesh Nalawade2018-07-201-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Support setting persistent command timeout per task basis Fixes #42200 * Add variable `ansible_command_timeout` to `persistent_command_timeout` option for `network_cli` and `netconf` connection plugin so that the command_timeout can be set per task basis while using `connection=network_cli` or `connection=netconf` eg: ``` - name: run copy command ios_command: commands: - show version vars: ansible_command_timeout: 40 ``` * Modify `ansible-connection` to read command_timeout value from connection plugin options. * Add `ansible_command_timeout` to `persistent_command_timeout` option in `persistent` to support `connection=local` so that it is backward compatibilty * To support `connection=local` pass the timeout value as variables from persistent connection to `ansible-connection` instead of sending it in playcontext * Fix CI failure * Fix review comment
* Fixing issues with httpapi (#40388)Nathaniel Case2018-05-211-3/+14
| | | | | | | | | | | | | | * I seem to have forgotten the back half of tests * Set http timeout from persistent_command_timeout * Tweak URL generation and provide URL on error * Push var_options to connection process * Don't wait forever if coming from persistent * Don't send the entire contents of variables to ansible-connection
* Pull persistent connection parameters via get_option (#39367)Ricardo Carrillo Cruz2018-05-161-2/+3
| | | | | | | | | | | | | | | | | | | | | * WIP Pull persistent connection parameters via get_option * Fix pep8 * Add use_persistent_connection setting to paramiko_ssh plugin * Add vars section to persistent_command_timeout setting and prevail provider values over config manager * Use persistent_command_timeout on network_cli instead of timeout * Fix unit tests If we don't call loader to get network_cli, then _load_name is never set and we get KeyError. * Pull persistent_command_timeout via config manager for ios connection local * Pull persistent_command_timeout via config manager on connection local
* Properly unlock the socket file lock in ansible-connection (#39223)James Cammarata2018-04-251-46/+57
| | | | | | | | | | | | | Also use a lock file per host, rather than one global file lock. Commit 9c0275a879d introduced a bug where the lock file was only being unlocked by the child PID of the resulting fork done in ansible-connection. This causes delays when a large inventory causes a lot of contention on that global lock. This patch fixes the problem by ensuring the lock is released regardless of the fork condition, and also to use a lock file based on the remote address of the target host, removing the global lock bottleneck. Fixes #38892
* Normalize usage of temp and tmp on tmp (#36221)Toshio Kuratomi2018-02-151-1/+1
| | | | | * Normalize usage of temp and tmp on tmp * Rename system_tmps system_tmpdirs * Add ANSIBLE_REMOTE_TMP spelling of environment variables
* Acquire `display`ed messages from forked process (#36064)Nathaniel Case2018-02-131-0/+3
| | | Also restore verbosity value from loaded `play_context`
* Fix debug logs failing with persistent connection (#33049)Ganesh Nalawade2018-01-251-51/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Fix debug logs failing with persistent connection Fixes #33047 * As debug logs are written on stdout, it interrupts the communication between ansible-connection(background) process and main process. To avoid this add a string similar to exactly identify the response string. * Remove unwanted code in ansible-connection * Fix review comments * Fix spurious log emitted on ansible-connection stdout issue * ansible-connection which runs as a background process sends a json string (contains response received from remote device) to foreground ansible-playbook process over stdout. * If in case debug flag is enabled the connection_loader api invoked from ansible-connection `ssh = connection_loader.get('ssh', class_only=True)` results in emitting debug logs on stdout. This spurious log interfere with the actual response and results in failure while reading json string in ansible-playbook process * To avoid this save stdout of ansible-connection and redirect it string buffer to accumulate all the logs emitted by core API's * Add these logs in `result['messages']` which is send a json string after reinstating saved stdout * Remove unwanted code in ansible-connection * Fix review comment
* Error early if executing python version doesn't meet documented minimums ↵Matt Martz2018-01-091-0/+9
| | | | | | | | (#34655) * Error early if executing python version doesn't meet documented minimums. Fixes #34597 * Make recommended enhancements
* Add parent pid to persistent connection socket path hash (#33518)Ganesh Nalawade2017-12-151-5/+7
| | | | | | | | | | | | | | * Add parent pid to persistent connection socket path hash Fixes #33192 * Add parent pid in persistent connection socket path hash to avoid using same socket path for multiple simultaneous connection to same remote host. * Ensure unique persistent socket path for each ansible-playbook run * Fix CI failures
* Allow PDB to enter post mortem. fixes (#31086)Julien Palard2017-11-281-0/+4
|
* shuts down persistent connections at end of play run (#32825)Peter Sprygada2017-11-221-19/+17
| | | | | This change will now track any created persistent connection and shut it down at the end of the play run. This change also includes an update to properly honor the reset_connection meta handler.
* Config continued (#31024)Brian Coca2017-11-161-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * included inventory and callback in new config allow inventory to be configurable updated connection options settings also updated winrm to work with new configs removed now obsolete set_host_overrides added notes for future bcoca, current one is just punting, it's future's problem updated docs per feedback added remove group/host methods to inv data moved fact cache from data to constructed cleaner/better options fix when vars are added extended ignore list to config dicts updated paramiko connection docs removed options from base that paramiko already handles left the look option as it is used by other plugin types resolve delegation updated cache doc options fixed test_script better fragment merge for options fixed proxy command restore ini for proxy normalized options moved pipelining to class updates for host_key_checking restructured mixins * fix typo
* getattr() with no default is an AttributeError if missing (#32946)Nathaniel Case2017-11-151-1/+1
|
* Fix `authorize: yes` and `become_method: enable` (#32864)Nathaniel Case2017-11-141-2/+15
| | | | | | | | | * Update connection play_context when socket exists * Don't fail on connections other than network_cli * Fix enable prompt detection on ios & eos * Check against "Module not found" error code, defined in modules/jsonrpc.py
* Connection plugins network_cli and netconf (#32521)Nathaniel Case2017-11-091-213/+138
| | | | | | | | | | | | | | | | | | | | | | | | | * implements jsonrpc message passing for ansible-connection * implements more generic mechanism for persistent connections * starts persistent connection in task_executor if enabled and supported * supports using network_cli as top level connection plugin * enhances logging for persistent connection to stdout * Update action plugins * Fix Python3 RPC * Fix Junos bytes<-->str issues * supports using netconf as top level connection plugin * Error message when running netconf on an unsupported platform * Update tests * Fix `authorize: yes` for `connection: local` * Handle potentially JSON data in terminal * Add clarifying detail if possible on ConnectionError
* Remove log of command executed in persistent connection (#31581)Ganesh Nalawade2017-10-111-1/+0
|
* report extra info in verbose and if neededBrian Coca2017-10-031-0/+5
|
* nicer error on bad ansible config (#30461)Brian Coca2017-09-191-6/+9
| | | * nicer error on bad ansible config
* Miscellaneous pylint fixes.Matt Clay2017-09-131-1/+1
| | | | | | | | | | | | The following rules are no longer disabled: - bad-format-string - duplicate-key - lost-exception - trailing-newlines - unexpected-keyword-arg - useless-suppression - using-constant-test
* Create persistent socket path using port and connection type (#28492)Ganesh Nalawade2017-08-231-1/+1
| | | | | | | | | * Create persistent socket path using port and connection type * Use remote address, port, connection type and remote user to create a socket path. * Fix review comment
* Miscellaneous ansible-test fixes. (#28355)Matt Clay2017-08-172-3/+4
| | | | | | | | * Include .github in test targets. Fix BOTMETA.yml. * Include bin in compile tests. * Exclude links from test targets. * Include bin in pep8 and pylint tests. * Fix pep8 and pylint issues in bin dir.
* ansible-inventory cli tool (#22477)Brian Coca2017-08-151-0/+1
| | | | | | | | | | | | | | | | | | | | | * ansible-inventory cli tool added vars dump to graph made yaml inventory dump actual yaml inventory format cleaner dump fixed graph, no dump needed add pulling in host/group vars pep indentation crime added docstring for manpage autodoc remove ansible_facts from output added api compat layer allow import from new and old APIs better conditional for <2.4 pe4+p4 test stuck on OS X (seems popular today) but passes rest, merging anyways
* Ansible Config part2 (#27448)Brian Coca2017-08-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Ansible Config part2 - made dump_me nicer, added note this is not prod - moved internal key removal function to vars - carry tracebacks in errors we can now show tracebacks for plugins on vvv - show inventory plugin tracebacks on vvv - minor fixes to cg groups plugin - draft config from plugin docs - made search path warning 'saner' (top level dirs only) - correctly display config entries and others - removed unneeded code - commented out some conn plugin specific from base.yml - also deprecated sudo/su - updated ssh conn docs - shared get option method for connection plugins - note about needing eval for defaults - tailored yaml ext - updated strategy entry - for connection pliugins, options load on plugin load - allow for long types in definitions - better display in ansible-doc - cleaned up/updated source docs and base.yml - added many descriptions - deprecated include toggles as include is - draft backwards compat get_config - fixes to ansible-config, added --only-changed - some code reoorg - small license headers - show default in doc type - pushed module utils details to 5vs - work w/o config file - PEPE ATE! - moved loader to it's own file - fixed rhn_register test - fixed boto requirement in make tests - I ate Pepe - fixed dynamic eval of defaults - better doc code skip ipaddr filter tests when missing netaddr removed devnull string from config better becoem resolution * killed extra space with extreeme prejudice cause its an affront against all that is holy that 2 spaces touch each other! shippable timing out on some images, but merging as it passes most
* Fix Python3 in ansible-connection (#27645)Nathaniel Case2017-08-021-1/+2
| | | | | | * Fix Python3 in ansible-connection * Add `errors='surrogate_or_strict'` to `to_bytes()`
* Persistent connection timer changes (#27272)Ganesh Nalawade2017-08-011-8/+9
| | | | | | | | | | | * Add command_timeout timer that defines the amount of time to wait for a command or RPC call before timing out. * Remove connect_retries and connect_interval configuration varaible and replace it with connect_retry_timeout to control the timeout value of connection to local scoket. * Make required changes to netowrk action plugins and relevant network files in module_utils. * Required documentation changes.
* junos_netconf integration test failure fix (#27569)Ganesh Nalawade2017-08-011-1/+1
| | | | * Create socket using port value and not connection type * Correct error message in integration test task
* Add fix to read correct socket path recieved from ansible-connection (#27560)Ganesh Nalawade2017-08-011-1/+1
| | | | | | | | | | | Currently socket path is send from `ansible-connection` (running as background process) over stdout. This can conflict with debug logs that are also send on stdout resulting in incorrect socket path received by the main process. To avoid this add a socket path delimiter string which is recevied by main process and socket path is retrieved based on delimiter string. This implementation will change in future when ansible-connection framework is made more robust.
* ansible-connection Python3 fix (#26441)Nathaniel Case2017-07-051-2/+2
| | | | | | | | * Fix a number of unicode <-> bytes mismatches * Return socket_path as text, not bytes * Docstring run()