Commit graph

38 commits

Author SHA1 Message Date
Toshio Kuratomi
cb1093e085 Fix the six import 2016-06-04 10:49:13 -07:00
Toshio Kuratomi
469169f654 Be sure to import urllib.parse from somewhere 2016-06-04 08:49:24 -07:00
Michael Scherer
cc99fe24fc Convert the network subfolder to py3/py2.4 syntax (#3690) 2016-05-18 09:08:30 -07:00
James Cammarata
b1641ec486 Remove extraneous debug stuff from uri module left over from testing 2016-04-25 14:34:27 -04:00
James Cammarata
84ee00bb42 Make sure uri output contains json output when a non-200 status is returned
Prior to the switch to the urls.py code, non-200 responses contained
a 'json' value when the content-type was JSON. This fix restores that
field upon a non-2xx response.

Fixes ansible/ansible#15555
2016-04-25 14:19:03 -04:00
Toshio Kuratomi
a2f41dfb04 Give headers a default so that we can add to it. 2016-03-24 07:24:28 -07:00
Matt Martz
3c59eedb9b Don't pass follow_redirects to fetch_url, use module.params instead 2016-03-07 15:34:22 -06:00
Brian Coca
0bbb7ba38d Merge pull request #3135 from mscherer/improve_uri_doc
Fix non RFC 2606 domain name in doc
2016-02-29 17:52:35 -05:00
Toshio Kuratomi
7088f72742 At least for now, set body to raw as it can be either a dict or jsonified-str
Since our validation does conversion as well as validation, I'm not sure
this is entirely correct.  May need to take a look at our conversion
code and re-examine to be sure we're doing it right.
2016-02-29 07:20:39 -08:00
Michael Scherer
d81a6740ec Fix non RFC 2606 domain name in doc 2016-02-28 11:51:17 +01:00
Matt Martz
adf2125339 Indicate in notes that the dependency on httplib2 was removed for v2.1 2016-02-23 11:53:02 -06:00
Matt Martz
7f206fdfe8 Drop dependency on httplib2 in the uri module, instead using ansible.module_utils.urls 2016-02-23 10:35:11 -06:00
Brian Coca
f5a374103f fixes for uri module
- clarify docs on body_json behaviour
- only tranform into json if body input is not a string
  users keep passing json string and expecint it to not be jsonified again
- fixed issue with removes not handling path expansion correctly
- switched all path variables to 'type path' to handle expansions
2016-02-11 01:09:20 -05:00
cspollar
34f7d7b068 Fixed typo in uri module example 2015-12-02 14:01:16 -06:00
Toshio Kuratomi
22c2789b72 Document and return an error if httplib2 >= 0.7 is not present. We
can't use httplib2 0.6.x and below because they do not verify TLS
certificates and thus are insecure.

Fixes #1875
2015-10-28 08:52:22 -07:00
Toshio Kuratomi
49ee5dd443 Remove debugging 2015-10-19 10:20:42 -07:00
Toshio Kuratomi
11833906b5 xmlcharrefreplace is only for encoding, not for decoding :-( 2015-10-19 10:15:13 -07:00
Brian Coca
f33fba84c0 specified that uri must be uppercase 2015-10-19 10:14:07 -04:00
Brian Coca
03a809a21c added version_added to body_format in uri 2015-07-23 15:52:11 -04:00
Brian Coca
11c6e6a3f5 Merge pull request #1179 from hver/devel
Allow custom methods in uri module
2015-07-10 09:50:51 -04:00
Hennadiy (Gena) Verkh
f190f98b06 Update uri.py
Added methods 'TRACE', 'CONNECT' from https://www.rfc-editor.org/rfc/rfc2616.txt, section 5.1.1
Added method 'REFRESH'
2015-07-09 11:39:46 +02:00
James Meickle
73390f8ecc Change uri debug example 2015-06-29 13:23:03 -04:00
murdochr
9040c2f75c Change docs to reflect correct when syntax for matching variable strings as per MD's forum post as this fails with unhelpful error otherwise.
https://groups.google.com/forum/#!topic/ansible-project/D2hQzZ_jNuM
2015-06-20 21:36:10 +01:00
Greg DeKoenigsberg
2a5f0bde87 Proper author info for all remaining modules 2015-06-15 15:53:30 -04:00
Toshio Kuratomi
5983d64d77 Properly flip default for verifying server cert. Add nice error messages when the cert is invalid 2015-05-28 15:33:21 -07:00
Toshio Kuratomi
7fea93835c Change uri module to validate ssl certs by default 2015-05-28 15:05:00 -07:00
whiter
ba35cb8173 Doc update to highlight use of body_type parameter 2015-05-28 15:27:46 +10:00
Toshio Kuratomi
b307f7bcba Fix problem writing binary content to a temporary file in the uri module.
Fixes https://github.com/ansible/ansible/issues/10938
Fixes https://github.com/ansible/ansible/issues/7606
2015-05-14 14:19:15 -07:00
Tom Paine
97b64abf75 Update uri.py
Move choices from description to choices field.
2015-05-12 12:29:00 +01:00
Hennadiy (Gena) Verkh
1f37f2a152 Removed method restriction in uri module 2015-04-21 11:43:09 +02:00
Sébastien Bocahu
b2d570e991 Removes YAML body_format option
It would require adding a dependency to the YAML module while it might
not provide much benefit (has anybody seen a HTTP API taking YAML as
input ?)
2015-03-30 10:23:46 +02:00
Sébastien Bocahu
6b20c3890f Add body_format for handling of JSON and YAML body
body_format is a new optional argument that enables handling of JSON or
YAML serialization format for the body argument.
When set to either 'json' or 'yaml', the body argument can be a dict or list.
The body will be encoded, and the Content-Type HTTP header will be set,
accordingly to the body_format argument.

Example:

- name: Facette - Create memory graph
  uri:
    method: POST
    url: http://facette/api/v1/library/graphs
    status_code: 201
    body_format: json
    body:
      name: "{{ ansible_fqdn }} - Memory usage"
      attributes:
        Source": "{{ ansible_fqdn }}"
        link: "1947a490-8ac6-4bf2-47c1-ff74272f8b32"
2015-03-27 11:11:25 +01:00
Brian Coca
42d91951cf Merge pull request #537 from zitterbacke/patch-2
fix uri modul for JSON-escape quotation marks
should fix #121
2015-03-19 09:12:29 -04:00
Dan Rue
c2f731e5bd Do not mark "skipped" when changed is false
When using the "creates" option with the uri module, set changed
to False if the file already exists. This behavior is consistent with
other modules which use "creates", such as command and shell.
2015-02-17 15:19:22 -06:00
zitterbacke
22e1b26bea fix uri modul for JSON-escape quotation marks
consider the following response body (content) of a REST/JSON webservice containing escaped quotation marks:

```json
{ "key": "\"works\"" }
```

decoding this string not as raw will lose the backslash as JSON escape. later json.loads will fail to parse.

Inspired by [this thread](https://groups.google.com/forum/#!topic/ansible-project/kymtiloDme4) on the mailing list and the following python shell code:

```python
import json
string=r'{ "key": "\"works\"" }'
json.loads(string)
json.loads(string.decode('raw_unicode_escape'))
json.loads(string.decode('unicode_escape'))
```
2014-12-17 20:09:44 +01:00
Toshio Kuratomi
9c6826e928 Add text/json as a mimetype to try deserializing
Fixes #503
2014-12-16 13:55:08 -08:00
Toshio Kuratomi
6317d3a988 Move from md5 to sha1 to work on FIPS-140 enabled systems 2014-11-06 21:25:55 -08:00
Michael DeHaan
0be8798858 Renames. 2014-11-04 17:29:56 -05:00
Renamed from network/uri.py (Browse further)