22 Commits

Author SHA1 Message Date
Corey Bryant
b1364646f7 python3 compatibility for failing unit tests
Handle StopIteration for Py3.7. PEP 0479,
https://www.python.org/dev/peps/pep-0479/, makes the following
change: "when StopIteration is raised inside a generator, it is
replaced it with RuntimeError". And states: "If raise StopIteration
occurs directly in a generator, simply replace it with return."

Also fix test cases that make assumptions about the ordering of
**kwargs. Python, up to 3.6, doesn't preserve any ordering for those.
And the behavior differs between various Python versions.
For details see PEP 0468 (https://www.python.org/dev/peps/pep-0468/)

Change-Id: I9847053534ffd47c4559d504be647be0de25b651
Closes-Bug: #1784714
Closes-Bug: #1711469
2019-09-10 11:32:23 +02:00
Kushal Agrawal
98d2a4deb7 Marker support for next page in list command
Marker is required to get the next page in list api
in case there are more records available either because of
custom limit provided in request or because of default limit
configured in system (client and server).

ex: glare list all --limit=5 --marker=<artifact_id>

Change-Id: I9f5c890c46b7f1f1e6fefdb7320c4fe00a2b0972
Closes-bug: #1755995
2018-04-11 07:57:47 +00:00
Mike Fedosin
6da299f345 Adopt new api for artifact listing
In change Ic0762f7a379754d19147a4f41a6d5a98abdc86b0
we renamed <type_name> section to unified 'artifacts'.

We need to reflect this changes in the client, otherwise
it doesn't work.

Change-Id: I10e5b5678180586d6f09b8dd4d83fb3f45e1f569
2018-01-17 10:19:47 +00:00
Mike Fedosin
8348e98224 Look the list of artifacts in 'artifacts' section
Now when user requests a list of artifacts glare returns
a json dict that has a section called after the type name,
which contains the list of the artifacts.
Example:
GET /artifacts/my_artifacts

{"my_artifacts": [...]}

It's not really a resful approach, so it's suggested to create a
unified section 'artifacts' for all cases, i.e. return
{"artifacts": [...]}

Change-Id: I2afb80fc7285bb8111a45a88d03f8ea21052f871
2017-12-12 13:48:20 +01:00
Jenkins
016653cbdc Merge "Allow to delete blobs with external urls" 2017-08-15 11:02:05 +00:00
Idan Narotzki
95f569fc70 Add content_length to header in upload_blob
Complementary update to glare server commit:
"Allocate blob size before starting the upload"

Co-Authored-By: Mike Fedosin <mikhail.fedosin.ext@nokia.com>

Change-Id: If3ad1bc69fd0a68b5c03abe163b76ba166245b81
2017-08-15 12:02:22 +03:00
Idan Narotzki
abedb2836d Allow to delete blobs with external urls
This patch support new API request to delete blobs from
artifact:
DELETE /artifacts/{type_name}/{artifact_id}/{blob_name}

if user wants to delete internal blob glare raises 403 error.

Co-Authored-By: Mike Fedosin <mikhail.fedosin.ext@nokia.com>

Change-Id: I8daa686df3a05158f59b33546397b23a494d5ab1
2017-08-12 12:39:11 +03:00
Mike Fedosin
f79904c3f2 Raise error if there are more than 1 artifact with same name/version
Change-Id: Ifa69a12de15b854c6b27d2b3edd37d0eb47eabf8
2017-04-05 23:55:44 +03:00
Sergey Skripnick
5e85f0fc3c HTTP Client refactoring
Library `requests` can handle files, pipes, dictionaries and iterators
as `data` argument.

Use 'json' argument to send json requests.

Rewrite some unittests using mock.

Change-Id: I95b71eb2716dc57708ed105659ffece376bd8344
2017-01-17 16:35:26 +03:00
Mike Fedosin
847615851c Add tag support for Glare client
Change-Id: I08bdfe3260e68bff3955e6dc39941a90c262c112
2017-01-15 17:53:51 +03:00
Mike Fedosin
6ed07b9320 Update CLI options for blobs
This patch
 * changes artifact version option from -v to -V for all blob commands
 * adds option -C for setting custom content-type for blob uploading
 * removes unnecessary possibility for setting content-type for
   external locations

Change-Id: I2f51ce588db3f88d9309081a3d52541a45746d88
2016-12-28 15:13:12 +03:00
Darja Malyavkina
6abe210de2 Allowed to use the artifacts by name
Added the ability to access by name of the artifact.
To access the artifacts by 'id' must specify the appropriate flag.

Change-Id: I776cd8cb0c15fb58891ae7f06d1c1272a4f3478c
2016-10-14 14:09:26 +03:00
Darja Malyavkina
be89f7fe22 Add setting of external locations
Change-Id: Icf0e336d82f8165d63c637fefd7679427ca2e806
2016-10-06 14:24:23 +03:00
Darja Malyavkina
5b30efba6f Add column 'glareType' in show artifact
Change-Id: Id36a627cdd086f40fc79c18b06a77f56c4bad81a
2016-10-03 19:34:23 +03:00
Darja Malyavkina
f1ca943608 Add command 'type-list'
Change-Id: I513f05667a76f2837efb527f112cff3e5509af68
2016-10-01 13:46:09 +00:00
Jenkins
cfc48043c1 Merge "Allow to set content-type for uploading blobs" 2016-10-01 13:06:03 +00:00
Jenkins
6160ea318c Merge "Allow to remove non-compound properties" 2016-10-01 11:32:01 +00:00
Mike Fedosin
ffbb953c3e Allow to remove non-compound properties
If user wants to remove(reset) non-compound properties,
then client sets value None to the property and sends
PATCH request with 'replace' operator.

Compound properties are processed as well as before.

Change-Id: Ib3469cf125beaca0e3c7041bc1e198e1ef7f2c19
2016-10-01 11:24:15 +00:00
Mike Fedosin
b3394f4b52 Allow to set content-type for uploading blobs
Change-Id: I97446773544c05cb700385ab60ca7bd5f0a611b5
2016-09-28 20:36:57 +03:00
Darja Malyavkina
cb049588f8 Fix small typos and remove unused code
Change-Id: I4d07b285b781e99d5a233f1525b136e7e857b92f
2016-09-28 18:21:05 +03:00
Mike Fedosin
3b6cc7eee7 Rename 'active' method to 'activate'
Change-Id: Ic026a6059fc296243e63339bb6b9070af5c04ff2
2016-09-26 15:31:56 +03:00
Darja Malyavkina
6005eb8b3b Glare client code
Taken from https://github.com/dshakhray/python-glareclient

Change-Id: If0e7e5cd0e39281f725df21308a18ed6caa8a009
2016-09-12 14:24:03 +03:00