Commit Graph

37 Commits

Author SHA1 Message Date
David Moreau Simard 4dc1649279
Remove Zuul configuration for ara-clients
Depends-On: https://review.openstack.org/640818
Change-Id: Ic97bbe97d78f8a99167f286e85bf927ed38d40a1
2019-03-04 12:02:40 -05:00
David Moreau Simard 0614e3c9f5
Update README to explain ara-clients was migrated back into ara
The ara-clients standalone repository is being discontinued.
The clear and logical separation of components was nice but the overhead
in complexity was not worth it.

Change-Id: I345dfa25c049d7e3874a8f502156c857df44c734
2019-03-02 08:48:10 -05:00
David Moreau Simard e42c10e7b4
Fix pep8 issues
It doesn't look like the integration test job picked those up.

Change-Id: I8041e0c0730f5d65c014f52992b0ed086322a4b3
2019-01-25 12:35:33 -05:00
David Moreau Simard 72ac0dcf99
Add new integration jobs to ara-clients
There are new jobs defined in ara-infra for testing ara-clients with
the other ARA components. Add them to the check and gate pipelines.

Depends-On: https://review.openstack.org/#/c/630303
Change-Id: Ia2353c3a20896242d173405457787a5dd29ac5e0
2019-01-23 09:46:12 -05:00
David Moreau Simard bb45af0f98
Use an if/else for returning the client in get_client
Attempting to do something more fancy lead the method to instanciate
both clients, let's not do that.

Change-Id: I0c8abc48ce146fe7dec592779b4cd07dedcc3bd8
2019-01-22 09:26:46 -05:00
David Moreau Simard 4a3f2b4418
Use import instead of sys.modules for verifying ara-server availability
If ara.server hasn't been imported already, it won't be there.

Change-Id: I6d9c79142b33882cf634db1c439c1df6f2c96c5c
2019-01-21 11:48:28 -05:00
Zuul f5edb8d609 Merge "Improve utils.get_client to supply sane defaults" 2019-01-21 15:41:21 +00:00
Zuul c75441cd53 Merge "Remove pep8 job, it'll be replaced by linters" 2019-01-21 15:41:21 +00:00
Zuul c28ab133d7 Merge "Do not attempt to load the offline client if ara-server isn't installed" 2019-01-21 15:37:21 +00:00
David Moreau Simard f460f76b7e
Improve utils.get_client to supply sane defaults
This will make it easier to get started.

Change-Id: I46a1944701f544db202b80871e01a382770e2148
2019-01-21 10:01:51 -05:00
David Moreau Simard b4e0ed4bec
Remove pep8 job, it'll be replaced by linters
This pep8 job is running py2 and is returning syntax errors on py3
f-strings. We'll standardize on the same linters job across ara
projects soon.

Change-Id: I2ef4578aeeb262c971fc18a6754c06cda95df67d
2019-01-21 10:01:51 -05:00
David Moreau Simard da4a03032a
Do not attempt to load the offline client if ara-server isn't installed
Handling this ahead of time instead of through exception handling
increases the odds of a friendlier error message.

Change-Id: Ie4c995e3b124d1f0ba51fb5f46c77179b03b6c26
2019-01-18 11:42:46 -05:00
Zuul 83979d6afa Merge "Readded support for keep-alive (better performance)." 2019-01-07 14:45:18 +00:00
Florian Apolloner 9dfa7441ab Readded support for keep-alive (better performance).
Details in:
934acf1126

Requires: https://review.openstack.org/#/c/628523/

Change-Id: If249cbd289cf3075f57101b3a7f0329446a00664
2019-01-04 17:16:22 +01:00
David Moreau Simard 051c4c92de
Fix usage of GET requests with query parameters
Python requests accepts GET query parameters (?foo=bar&bar=foo) inside
the "params" key of the request.

Change-Id: Ia493819c48ec907bb6fb9454dea95e4fe62ef03a
2018-12-18 11:28:46 -05:00
David Moreau Simard 6597aff444
Use 'ara-clients' instead of __name__ when determining client version
This resolves an exception by pbr when Ansible attempts to load the
client:
"""
Versioning for this project requires either an sdist tarball,
or access to an upstream git repository. It's also possible that
there is a mismatch between the package name in setup.cfg and
the argument given to pbr.version.VersionInfo. Project name
ara.clients.http was given, but was not able to be found.
"""

Change-Id: Id56bf0909d17259313307d433a6104fe02e0215e
2018-12-14 12:30:13 -05:00
melissaml 1c571dbd54 Change openstack-dev to openstack-discuss
Mailinglists have been updated. Openstack-discuss replaces openstack-dev.

Change-Id: I0850b5df4afd4ec5405be4a8e775d166980fbe87
2018-12-07 20:33:35 +08:00
David Moreau Simard 1e1fd3a4be
Remove debug line before initiating request
The debug log are already a bit chatty, we don't need this particular
line because we're getting the result right after with another debug
line.

Change-Id: I1d60f90cae9db896d4bceaf3f7211597ad8242f3
2018-11-14 14:19:55 -05:00
Florian Apolloner f9f75778e2 Switched the offline client to use an actual threaded http server.
Sadly it has no support for keep-alive, gotta see if we can use a
different server. Either way, this should be prefered over the usage of
Django's TestClient since it has the exact same request flow like a
normal client would have.

Change-Id: Ic7065ffbe260701728e9d01213fe3a0fd5f0a6d2
2018-11-04 15:34:08 +01:00
David Moreau Simard 001112df9f
Add zuul job to run tox-format environment for executing black and isort
This will allow us to have more consistent and clean code.

Change-Id: I8a49053d016c52b7b44136a6a8f36f9ad12675c3
2018-10-02 16:46:01 -05:00
David Moreau Simard b1dc3a0944
Run black/isort on ara-clients
There will be a follow up patch to add black/isort CI.

Change-Id: I8f16ad01d9a7c986b12a543ff351cbf17a0df70d
2018-10-02 16:44:24 -05:00
David Moreau Simard 8834105645
Add requests to requirements.txt
It was forgotten when adding in the http client
and ara-clients no longer worked when we started
not installing ara/ara-server for nothing.

Change-Id: I056d1a2822cddb2a6058a86fa5cccef8e810ee2e
2018-09-28 19:21:44 -04:00
Florian Apolloner 028010c9b0 Dropped hard dependency to ara-server.
It is only required for the offline client.

Change-Id: I80c66bcc097150cd23e48c2a2cfca7139e0c8e66
2018-09-28 15:32:27 +02:00
Florian Apolloner 6590ecdf45 Fixed namespacing to use python3 style namespace packages.
Note: the egg name is not allowed to have a dash, because that is
interpreted as version by at least pbr.
See https://pip.pypa.io/en/stable/reference/pip_install/#vcs-support

Change-Id: Ib6666e4aee84a54050a5788de1c12ca36aa130ce
2018-09-27 19:16:48 +02:00
David Moreau Simard 1e873cf9c9
Add version of the http agent to the user agent string
Change-Id: I61e85899be88788edc9091dd81f7cef3e8fa94a0
2018-09-20 14:01:47 -04:00
David Moreau Simard 96489515ac
Streamline how payloads are passed back and forth in the http client
- Set default headers through requests.session
- Set timeout explicitely
- GET parameters need to be passed as "params"
- Don't send empty GET parameters
- POST/PUT/PATCH parameters need to be passed as "data"
- DELETE doesn't expect any parameters

Change-Id: Icc1d821501a160be10975333accc6b791b6f058f
2018-09-20 14:00:10 -04:00
David Moreau Simard e4d2b27a0f
Move django import and initialization inside the offline client class
This allows to import the class without triggering the import and
initialization of django and instead deferring it to when (and if) the
class is instanciated.

Change-Id: I79be90eb877f21b5254f116e51cc78b310c8674c
2018-09-12 10:45:58 -04:00
David Moreau Simard ee86bb5cfe
Add first iteration of http client
The offline client is ideal for running offline and locally.
The http client uses requests to do actual http requests to an API
server.

Change-Id: I2b1ed6068ab547d55237b3f9ff7150935232caa6
2018-09-12 10:45:26 -04:00
David Moreau Simard 7310b6cea5 Handle HTTP errors >= 500 and handle HTTP 204 on delete
Change-Id: Ie39355274a75e31142920db3810ff2d78f53a48f
2018-06-25 15:01:22 +00:00
David Moreau Simard b6b4818987 Only run the Django bootstrapping once in the offline client
Change-Id: Idcf388a8dbeef418400546078a78d8d8620dc950
2018-06-25 15:01:13 +00:00
David Moreau Simard d54b3f8e59
Add helper method to retrieve client instance
Change-Id: I0efcf4a9272e70e34dc9c62a963484583628cacc
2018-06-25 10:59:44 -04:00
David Moreau Simard c9a08e7680
Don't pass kwargs to the client if there isn't any
This resolves an issue where doing a request (i.e, GET) without
kwargs would fail.

Change-Id: Iac5be67bd1a558701c0ac0dbca50e5284730bebe
2018-06-20 10:41:17 -04:00
David Moreau Simard c907258a61
Rename offline client class and fix django bootstrap
Wrong method name was used when bootstrapping django.

Change-Id: Iee112e465daaa7e108fb12999374f4da569411a8
2018-06-20 10:17:44 -04:00
David Moreau Simard d50ebdd1a3
Add ara-server to ara-clients requirements
The default offline client requires django and the rest of the
things.

Change-Id: Ice97247a20b0e49c155aac3fc27a67a969a5e570
2018-06-20 09:22:33 -04:00
David Moreau Simard 31c5af8d10
First iteration of the offline API client
This is the first iteration of an API client implementation for
interacting with the ARA API.

Change-Id: Ib64f6e535a70d9ec1cfec2cec0d37780fd509be4
2018-06-20 00:18:20 -04:00
David Moreau Simard 353293f1ad
Bootstrap the ara-clients repository
This is the basic machinery to make it installable and things like
that.

Change-Id: I618ae1a8680ec2275fcf813b1efca4fe180fae3f
2018-06-20 00:18:16 -04:00
OpenStack Project Creator d0c56cb6e6 Added .gitreview 2018-03-27 11:35:12 +00:00