Commit Graph

77 Commits

Author SHA1 Message Date
Pedro Algarvio
40a64191a1
Absolute imports and A LOT of code cleanup. 2017-03-01 01:33:07 +00:00
Pedro Algarvio
3beb3fb801
Move whatever we need from salttesting to salt.
Let's drop the salttesting dependency cycle.
2017-02-28 22:52:49 +00:00
Pedro Algarvio
1daa2e24cd
Moved some test supporting modules to tests/support
Previously they were in tests/utils which also had test case modules.
2017-02-28 22:52:48 +00:00
Pedro Algarvio
bdb3cc3d89
Test websockets against the actual tornado application created in salt 2017-02-23 23:19:45 +00:00
Pedro Algarvio
1e2753c875
Fix imports after renames 2017-02-23 23:19:43 +00:00
Pedro Algarvio
15af4c9728
Test filenames conformity. Adjust for pytest. 2017-02-23 23:19:42 +00:00
kstreee
51972d0724 Removes a redundant test case after removed 'batch' in 'netapi'. 2017-02-10 07:12:22 +00:00
Mike Place
7fc803b4bd Try/except the setup call in tornado test as a workaround pending salt-testing release 2016-08-22 19:08:40 +09:00
rallytime
72a116b731 Merge branch '2016.3' into 'develop'
Conflicts:
  - salt/states/pkg.py
2016-08-02 13:05:36 -06:00
kstreee
28f793caac Fix missing first data in stream when subscribing stream using a function 'read_async'. 2016-08-02 07:37:25 +00:00
rallytime
cbf42a8407 Merge branch '2016.3' into 'develop'
Conflicts:
  - conf/master
  - doc/ref/configuration/master.rst
  - salt/cli/batch.py
  - salt/cli/daemons.py
  - salt/config/__init__.py
  - salt/minion.py
  - salt/modules/aptpkg.py
  - salt/modules/beacons.py
  - salt/states/archive.py
  - salt/states/cmd.py
  - salt/utils/gitfs.py
  - tests/unit/states/cmd_test.py
2016-04-26 14:42:26 -06:00
rallytime
80fcdfb9d8 Merge branch '2015.8' into '2016.3'
Conflicts:
  - doc/topics/targeting/grains.rst
  - salt/cli/daemons.py
  - salt/exceptions.py
  - salt/minion.py
  - salt/modules/schedule.py
  - salt/scripts.py
  - salt/states/archive.py
2016-04-26 12:07:42 -06:00
rallytime
9064d3bbfb Merge branch '2015.5' into '2015.8'
Conflicts:
  - salt/cloud/clouds/vmware.py
  - salt/modules/file.py
  - salt/states/archive.py
2016-04-25 15:45:17 -06:00
rallytime
ce72851861 Merge branch '2014.7' into '2015.5'
Conflicts:
  - salt/netapi/rest_tornado/__init__.py
  - salt/netapi/rest_tornado/saltnado.py
2016-04-22 10:24:06 -06:00
Seth House
2775edc176 Saltnado /run fix (#32590)
* Revert "Verify auth in saltnado run (#32552)"

This reverts commit b19c5a5ce7.

* Call runner.cmd_async instead to enforce eauth

* Check for both token or user/pass before giving to Salt

* Remove comment as we're now enforcing auth here

* Lint and functionality fix courtesy of Mike P.

* Don't fail the whole request if there's an eauth problem
2016-04-22 10:10:47 -06:00
kstreee
1c9e05249f [saltstack/salt#31534] Resolve data['arg'] type issue. Now rest_tornado can accept not only a list of string type for 'arg', but also a string type data for 'arg'. 2016-03-01 01:53:30 +00:00
Nicolas Delaby
a8dc33a5e3 Saltnado provide also get parameters to the context 2016-02-19 09:11:15 +01:00
Nicolas Delaby
f0a6d2b814 Saltnado provide also get parameters to the context 2016-02-15 10:09:02 +01:00
FELD Boris
049815fb34 Add support for cors preflight request for parametrized urls
The implementation was broken for jobs and minions handlers
2015-11-10 18:37:03 +01:00
Mike Place
23fcc9e348 Merge pull request #27248 from tinyclues/better_cors_headers
[Saltnado] - The CORS implementation was a bit naive about headers allowance.
2015-09-23 08:50:06 -06:00
Mike Place
3933eed307 Merge pull request #27249 from tinyclues/login_support_more_content_type
[Saltnado] - Add the support of login payload in JSON and YAML.
2015-09-23 08:49:42 -06:00
FELD Boris
6417161fd7 The CORS implementation was a bit naive about headers allowance.
A preflight request send the list of headers of the final request
in a special header ```Access-Control-Request-Headers```.
The server must returns the list of allowed header in the special header
```Access-Control-Allow-Headers```.

This PR just returns the whole list of headers but may allow filtering of some
of them quite easily. I'm not sure to see how filtering how headers may
impact security, if anyone has some leads.
2015-09-18 23:24:43 +02:00
FELD Boris
a4fd1e75c5 Add the support of login payload in JSON and YAML.
Login endpoint supported only application/x-www-form-urlencoded which may
be an useless limitation. This PR add support for more content-type,
JSON and YAML and every content-type supported by saltnado in general
as it uses the same deserialisation method than the lowstate deserialisation.
2015-09-18 19:16:47 +02:00
FELD Boris
5e9c3c7d96 Improve support of Accept header in saltnado.
It currently supports 'simple' values like application/json, but Accept header
could also include more than one value with parameters
See http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1.
For example:

```application/json, text/javascript, */*; q=0.01```

This PR add support for multiple media_range in Accept header, support parsing
of parameter (like q=0.01) but discard them and finally iterate on
media_range and take the first compatible.

A more complete implementation may fully supports the RFC and support
q parameter and specific order of priority to find the most compatible
Content-Type but I don't think it's worth the pain.

If we want a better implementation, werkzeug has actually an implementation
http://werkzeug.pocoo.org/docs/0.10/datastructures/#werkzeug.datastructures.Accept.best_match.
2015-09-17 00:48:34 +02:00
FELD Boris
ef3b7ddc2d Fix lints 2015-09-15 20:29:18 +02:00
FELD Boris
b13f66ee4b Add support for CORS in saltnado.
Add support for CORS and tests in RPC salt-api. The code was inspired by
https://github.com/globocom/tornado-cors.

Also add support for CORS in websocket. By adding some tests, I made
a small refactoring to make the websocket handler more easily testable.

Some documentation about CORS could be found here
https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS
for reference.
2015-09-15 18:52:44 +02:00
Mike Place
b13b6b912a Merge pull request #26984 from tinyclues/26505_improve_content_type_support
[NetAPI] SaltNado - Improve support for Content-Type parsing. Ref #26505
2015-09-14 13:02:28 -06:00
Seth House
6d22514934 Rename the rest_cherrypy tests to conform to our convention
Previously they conformed to the default unittest2 convention.
2015-09-09 10:39:34 -06:00
FELD Boris
23c7b4847c Improve support for Content-Type parsing. Ref #26505
It currently supports 'simple' values like application/json, but Content-Type
header could also includes parameter. See RFC http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17.

When sending JSON from a browser for example, the Content-Type is
`application/json; charset=utf-8` and salt-api failed to detect JSON content.

The proposition is to use cgi.parse_header method (https://docs.python.org/2.7/library/cgi.html?highlight=cgi#cgi.parse_header)
to correctly parse the Content-Type value but ignore parameters, JSON should
always be UTF-8 but I don't know about other supported Content-Type.
2015-09-09 16:41:29 +02:00
Seth House
2aa3da8911 Rename the rest_cherrypy tests to conform to our convention
Previously they conformed to the default unittest2 convention.
2015-09-08 15:40:06 -06:00
Colton Myers
befb666623 Merge remote-tracking branch 'upstream/2015.2' into merge-forward-develop
Conflicts:
    salt/modules/mongodb.py
    salt/utils/http.py
    salt/utils/process.py
    tests/integration/__init__.py
2015-04-27 10:28:53 -06:00
rallytime
8d5b50e17c Don't forget the blank lines at the end of the file 2015-04-24 16:29:51 -06:00
Justin Findlay
3226c6ccb4 further saltnado lint 2015-04-13 16:28:10 -06:00
Thomas Jackson
3f1558b5d2 No reason to implement get_app in the mixin 2015-04-13 16:28:10 -06:00
Thomas Jackson
16bc3d0731 Pylint fixup 2015-04-13 16:28:10 -06:00
Justin Findlay
e132bcd5ca further saltnado lint 2015-04-12 16:39:57 -06:00
Thomas Jackson
5c0cca47d3 No reason to implement get_app in the mixin 2015-04-11 16:48:05 -07:00
Thomas Jackson
6f4a009343 Pylint fixup 2015-04-11 16:46:55 -07:00
Joshua Semar
46a25b5c58 missed switch to build_tornado 2015-04-10 16:40:42 +00:00
Joshua Semar
d9ed9f1e5b fix linting errors 2015-04-10 16:35:07 +00:00
Joshua Semar
c56845e904 include mod_opts on tornado application, refactor get_app 2015-04-10 15:06:30 +00:00
Colton Myers
d82d7645c9 Merge remote-tracking branch 'upstream/2015.2' into merge-forward-develop
Conflicts:
    salt/modules/cmdmod.py
    salt/modules/debian_ip.py
    salt/modules/drac.py
    salt/modules/rpm.py
    salt/returners/postgres_local_cache.py
2015-03-19 16:13:16 -06:00
Thomas Jackson
234d02b218 Add timeout to saltnado's event listener
Fixes #21707

The issue is basically that the master has seen N minions-- and not all N are currently connected. The publish job returns to the salt-api that N minions got the job-- and it dutifilly waits for all the returns. With this we use the same ping timeout that the CLI does while waiting for returns. So once all minions are no longer running the job we will return.
2015-03-18 08:09:41 -07:00
Thomas Jackson
205787c256 Add timeout to saltnado's event listener
Fixes #21707

The issue is basically that the master has seen N minions-- and not all N are currently connected. The publish job returns to the salt-api that N minions got the job-- and it dutifilly waits for all the returns. With this we use the same ping timeout that the CLI does while waiting for returns. So once all minions are no longer running the job we will return.
2015-03-17 19:17:32 -07:00
Pedro Algarvio
1a779fd51c Py3 compatibility fixes 2015-01-30 22:25:05 +00:00
Pedro Algarvio
309876eac1 Py3 compatibility fixes 2015-01-30 22:25:05 +00:00
Pedro Algarvio
60f215f191 Add from __future__ import absolute_import 2015-01-30 22:25:04 +00:00
Mike Place
74501f56ae Fix tornado tests
The tornado test runner isn't respecting timeouts as it claims it
should in async mode. However, the env variable is working as-described.
2015-01-12 15:36:34 -07:00
Colton Myers
dc43840cee Merge branch '2014.7' into merge-forward
Conflicts:
	salt/modules/glusterfs.py
	salt/modules/macports.py
	salt/modules/makeconf.py
	salt/modules/mdadm.py
	salt/modules/smartos_vmadm.py
	salt/modules/zypper.py
	salt/utils/event.py
	tests/integration/netapi/rest_tornado/test_app.py
	tests/unit/netapi/rest_tornado/test_handlers.py
2014-11-21 12:05:32 -07:00
Thomas Jackson
75bf7bd091 pylint fix 2014-11-20 18:35:41 -08:00