Commit Graph

24 Commits (79e9dae29212a88aa60122ca6bd608947399017f)

Author SHA1 Message Date
Matt Martz 79e9dae292
Don't show params when there is an issue with `set_option(s)` (#75805) 3 years ago
Matt Clay 234994fc07 Fix boilerplate in setup.py and lib/ansible/ dir. 4 years ago
Sandra McCann 7ef7c1b5d7
add note on write access to socket_path (#67060)
* Change socket_path error messages to not directly refer to socket_path
* Apply suggestions from code review

Co-Authored-By: Nathaniel Case <this.is@nathanielca.se>
4 years ago
Nathaniel Case ffe8f45ddd
Pickle non-str objects to survive connection return (#63110)
* Fail more helpfully when data is not str

* Pickle arbitrary objects to return from connection
5 years ago
Matt Martz 5941e4c843
Properly JSON encode AnsibleUnsafe, using a pre-processor (#60602)
* Properly JSON encode AnsibleUnsafe, using a pre-processor. Fixes #47295

* Add AnsibleUnsafe json tests

* Require preprocess_unsafe to be enabled for that functionality

* Support older json

* sort keys in tests

* Decouple AnsibleJSONEncoder from isinstance checks in preparation to move to module_utils

* Move AnsibleJSONEncoder to module_utils, consolidate instances

* add missing boilerplate

* remove removed.py from ignore
5 years ago
Kevin Breit 6fff8e1d7e Fix spelling error in connection (#54957)
`connection` module utility had a spelling error. s/catergory/category
5 years ago
Nathaniel Case f05979932b
Allow AnsibleVaultEncryptedUnicode to pass through exec_jsonrpc (#48306)
* Allow AnsibleVaultEncryptedUnicode to pass through exec_jsonrpc

* Add changelog
6 years ago
Nathaniel Case 02432565cd
Remove cliconf from httpapi connection (#46813)
* Bare minimum rip out cliconf

* nxapi changeover

* Update documentation, move options

* Memoize device_info

* Gratuitous rename to underscore use of local api implementation

Fixup eos module_utils like nxos

* Streamline version and image scans

* Expose get_capabilities through module_utils

* Add load_config to module_utils

* Support rpcs using both args and kwargs

* Add get_config for nxos

* Add get_diff

* module context, pulled from nxapi

We could probably do this correctly later

* Fix eos issues

* Limit connection._sub_plugin to only one plugin
6 years ago
Nathaniel Case 3feb6c9e0f
Try to be more verbose with JSON decode errors (#47066)
* Try to be more verbose with JSON decode errors
6 years ago
Nathaniel Case 03d8fa05b6
Try to be more helpful when JSON gives up (#45600)
* Try to be more helpful when JSON gives up
6 years ago
Nathaniel Case f221105882
Prevent data being truncated over persistent connection socket (#43885)
* 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
6 years ago
Ganesh Nalawade 3f3101dfe5
Raise exception if command timeout is triggered (#43078)
* 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
6 years ago
Nathaniel Case 8c620a17d4
Let called functions use `method` keyword (#43086)
Hopefully we can live without `method_` instead
6 years ago
Matt Clay c262dbfd30 Use https for links to ansible.com domains. 6 years ago
Ganesh Nalawade 53d3e7e306
Add troubleshooting URL for persistent socket path related issue (#38542)
* Add troubleshooting URL for persistent socket path related issue

socket path timeout related error messages are not displayed on the
console as the ansible-connection process does not have access to it.
Until this is fixed need to point to troubleshooting URL so that
users can take corrective actions.

* Fix CI issue
6 years ago
Ganesh Nalawade 3d63ecb6f3
Refactor junos modules to Use netconf and cliconf plugins (#32621)
* Fix junos integration test fixes as per connection refactor (#33050)

Refactor netconf connection plugin to work with netconf plugin

* Fix junos integration test fixes as per connection refactor (#33050)

Refactor netconf connection plugin to work with netconf plugin
Fix CI failure
Fix unit test failure
Fix review comments
7 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
Nathaniel Case 9c0275a879
Connection plugins network_cli and netconf (#32521)
* 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
7 years ago
Toshio Kuratomi ac56a2f138 Remove wildcard imports and get_exception calls
Fixed module_utils
7 years ago
Ganesh Nalawade 112cae73df Minor py3 compliance change for network module (#26695)
*  Convert return value of `execute_command` to appropriate type
7 years ago
Peter Sprygada 3f17e87c5a pulls the jsonrpc request builder code into top level function (#25833)
refactors the Connection class to use the top level function.  This will
make the request_builder() function useful for other components such as
action handlers.
7 years ago
Ganesh Nalawade 6215922889 Add support for cliconf and netconf plugin (#25093)
* ansible-connection refactor and action plugin changes
* Add cliconf plugin for eos, ios, iosxr, junos, nxos, vyos
* Add netconf plugin for junos
* Add jsonrpc support
* Modify network_cli and netconf connection plugin
* Fix py3 unit test failure
* Fix review comment
* Minor fixes
* Fix ansible-connection review comments
* Fix CI issue
* platform_agnostic related changes
7 years ago
Dag Wieers 5553b20828 Collated PEP8 fixes (#25293)
- Make PEP8 compliant
7 years ago
Peter Sprygada b8f138cabb adds connection module to module_utils (#21310)
* connection module connecting to persistent sockets
7 years ago