Commit graph

72 commits

Author SHA1 Message Date
Toshio Kuratomi
280ccfbb78 Add note about redirects proxies
Fixes #1574
2015-06-25 09:28:39 -07:00
Toshio Kuratomi
4519dd5f4d Small cleanups.
* Import url(lib|parse|lib2) if needed by the module rather than relying
  on module_utils.urls to do so.
* Remove stdlib modules from requirements
* Use the if __name__ conditional for invoking main()
2015-06-24 06:51:00 -07: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
Schmitt Christian
9ebef6275d Removed the wrong Note
Currently as already in the description, this module works with proxy settings.
2015-04-10 12:19:28 +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
Michael DeHaan
385a037cd6 package files 2014-09-26 11:05:47 -04:00
Michael DeHaan
c8e1a2077e file extensions! 2014-09-26 10:37:56 -04:00
Michael DeHaan
417309a626 Restructuring. 2014-09-26 10:13:26 -04:00
Michael DeHaan
73123b69fa Move modules into subdirectory. 2014-09-26 09:23:50 -04:00
James Cammarata
1ef592ff00 Push the expanduser call on the source down to slurp rather than fetch
Also moves the calculation of the destination file name until after
the slurp of the file contents, since the source as returned by slurp
may now be different, so we want to use that expanded path locally.

Fixes #8942
2014-09-23 15:32:07 -05:00
Will Thames
25c5250025 get_url module: Add timeout parameter 2014-09-08 13:58:25 +10:00
George Yoshida
cd0dae890c For content-disposition response header field, try to parse filename parameter even if it's not quoted. 2014-08-23 12:10:45 +09:00
Brian Coca
ac14a8d6ad unified calls to fs function vs duplicate functions for file and
directory
2014-05-24 09:28:45 -04:00
James Cammarata
a9c2eefd06 Remove erroneous set of status_code causing a traceback in module uri
Fixes #7416
2014-05-16 08:49:08 -05:00
Christian Berendt
bbcfda8c18 [get_url] check against lowered stripped sha256sum
The content of the sha256sum attribute should be lowered before comparing it with the calculated sha256sum.

In the following example the used sha256sum uses ABC.. and not abc.. and the check failed. This should not happen.

```
TASK: [get_url url=http://ftp.fau.de/apache/hadoop/common/hadoop-2.4.0/hadoop-2.4.0.tar.gz dest=/home/vagrant/hadoop-2.4.0.tar.gz mode=0644 sha256sum=024326AC68A1A68B5566B10F95609EAAFD9F70CFEB37FCA0E97CBB1674E57C3A] ***
failed: [instance000] => {"failed": true}
msg: The SHA-256 checksum for /home/vagrant/hadoop-2.4.0.tar.gz did not match 024326AC68A1A68B5566B10F95609EAAFD9F70CFEB37FCA0E97CBB1674E57C3A; it was 024326ac68a1a68b5566b10f95609eaafd9f70cfeb37fca0e97cbb1674e57c3a.

FATAL: all hosts have already failed -- aborting
```
2014-05-06 18:27:43 +02:00
James Cammarata
89d61b8a7d Add parameters to get_url for the url username/password
Fixes #6928
2014-04-24 00:26:50 -05:00
James Tanner
c69608cbe6 Fixes #6857 Make the url parameter required for get_url 2014-04-04 16:36:38 -04:00
Michael DeHaan
b06f5162cd Example cleanup. 2014-04-02 17:32:44 -04:00
Sven Schliesing
898346a468 Update uri 2014-03-31 14:32:56 +02:00
Sven Schliesing
d193e5571d Example for queueing build in Jenkins 2014-03-31 14:32:07 +02:00
Michael DeHaan
eb1c37c6e1 Merge pull request #6649 from picsolvebryan/devel
Accept status code from a list of valid codes.
2014-03-28 11:49:04 -04:00
bryan hunt
dff1fd3b37 Accept status code from a list of valid codes.
(cast the list of acceptable codes to a list of int )
2014-03-24 14:23:18 +00:00
bryan hunt
eb9ac9308c Accept status code from a list of valid codes. 2014-03-24 14:17:36 +00:00
bryan hunt
5561fbc427 Accept status code from a list of valid codes. 2014-03-24 13:51:44 +00:00
James Cammarata
c68be8b418 Remove validate_certs parameter from fetch_url calls 2014-03-12 10:31:01 -05:00
James Cammarata
a1b1182662 Validate SSL certs accessed through urllib*
* Adds another module utility file which generalizes the
  access of urls via the urllib* libraries.
* Adds a new spec generator for common arguments.
* Makes the user-agent string configurable.

Fixes #6211
2014-03-10 16:06:52 -05:00
James Cammarata
09eaa0c920 Fixing the unicode issue in uri for EL6 platforms
Fixes #5869
2014-02-25 13:04:05 -06:00
James Cammarata
0c33cc19bb Handle unicode content in the uri module properly
Fixes #5869
2014-02-24 23:34:17 -06:00
Richard Isaacson
acf0e408ae Merge pull request #5826 from romeotheriault/fix_follow_redirects
A fix for uri module regarding following redirects. The old behavior would follow redirects either way. This change clarifies the functionality and makes it a bit more explicit. Comparing the old behavior to the new 'yes' == 'all', 'no' == 'safe' and now 'no' will not follow any redirects. Historic behavior is still supported and documented with a push to the new values.
2014-02-07 11:36:51 -06:00
Eric Hanchrow
837d8e19b9 Clarify doc for get_url
Move a sentence from doc for the "force" option to that for the "dest" option.
2014-02-05 10:58:48 -08:00
James Cammarata
b8356b525a When force=yes, get_url should always download the specified file
This is accomplished by not setting the If-Modified-Since header,
and setting "cache-control: no-cache" instead. Note that if the
file content has not changed, the module will still report that
changed=false, as the md5's of the tmp file and existing file are
compared before swapping

Fixes #5104
2014-02-05 11:56:05 -06:00
Pedro Romano
b04f197113 Allow the 'PATCH' method in the 'uri' module since 'httplib2' allows it
and some APIs require it.
2014-02-02 20:53:52 +00:00
Romeo Theriault
863bba498c fix following redirects 2014-01-29 14:04:53 -10:00
Michael DeHaan
0d3a74d905 ansible -> ansibleworks 2014-01-28 20:29:41 -05:00
James Tanner
4f9aadcc07 Addresses #5023 Fix import comments 2013-12-02 15:13:49 -05:00
James Tanner
38edad70ac Fixes #5023 Convert all modules to use new snippet import pattern 2013-12-02 15:11:23 -05:00
Michael DeHaan
4c35b7f380 There's a cleaner way to do this, commit to module formatter pending.
Revert "No longer need to reference 'version_added' in docs for these, as this was quite a while ago."

This reverts commit ff0a41d446.
2013-11-27 21:23:03 -05:00