Hello community,

here is the log from the commit of package python-glareclient for 
openSUSE:Factory checked in at 2018-01-24 15:26:48
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-glareclient (Old)
 and      /work/SRC/openSUSE:Factory/.python-glareclient.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-glareclient"

Wed Jan 24 15:26:48 2018 rev:4 rq:567261 version:0.4.2

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-glareclient/python-glareclient.changes    
2017-08-28 15:30:22.957264282 +0200
+++ 
/work/SRC/openSUSE:Factory/.python-glareclient.new/python-glareclient.changes   
    2018-01-24 15:26:49.264698513 +0100
@@ -1,0 +2,10 @@
+Wed Dec 20 09:59:13 UTC 2017 - [email protected]
+
+- update to version 0.4.2
+  - Allow to delete blobs with external urls
+  - Add content_length to header in upload_blob
+  - Updated from global requirements
+  - Add ssl options to keycloak auth module
+  - Add ssl options to glare cli
+
+-------------------------------------------------------------------

Old:
----
  python-glareclient-0.4.1.tar.gz

New:
----
  python-glareclient-0.4.2.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-glareclient.spec ++++++
--- /var/tmp/diff_new_pack.BwNxzc/_old  2018-01-24 15:26:50.028662780 +0100
+++ /var/tmp/diff_new_pack.BwNxzc/_new  2018-01-24 15:26:50.028662780 +0100
@@ -18,37 +18,38 @@
 
 %global sname python-glareclient
 Name:           python-glareclient
-Version:        0.4.1
+Version:        0.4.2
 Release:        0
 Summary:        Python API and CLI for OpenStack Glare
 License:        Apache-2.0
 Group:          Development/Languages/Python
 Url:            https://launchpad.net/%{sname}
-Source0:        
https://pypi.io/packages/source/p/%{sname}/%{sname}-%{version}.tar.gz
+Source0:        
https://files.pythonhosted.org/packages/source/p/%{sname}/%{sname}-%{version}.tar.gz
 BuildRequires:  openstack-macros
+BuildRequires:  python-PyYAML >= 3.10
 BuildRequires:  python-coverage >= 4.0
 BuildRequires:  python-devel
 BuildRequires:  python-fixtures >= 3.0.0
-BuildRequires:  python-mock >= 2.0
-BuildRequires:  python-os-client-config >= 1.27.0
-BuildRequires:  python-osc-lib >= 1.5.1
-BuildRequires:  python-oslo.log >= 3.22.0
-BuildRequires:  python-oslo.utils >= 3.20.0
-BuildRequires:  python-reno >= 1.8.0
-BuildRequires:  python-requests-mock >= 1.1
+BuildRequires:  python-mock >= 2.0.0
+BuildRequires:  python-os-client-config >= 1.28.0
+BuildRequires:  python-osc-lib >= 1.7.0
+BuildRequires:  python-oslo.log >= 3.30.0
+BuildRequires:  python-oslo.utils >= 3.31.0
+BuildRequires:  python-reno >= 2.5.0
+BuildRequires:  python-requests-mock >= 1.1.0
 BuildRequires:  python-testrepository >= 0.0.18
 BuildRequires:  python-testscenarios >= 0.4
-BuildRequires:  python-testtools >= 1.4.0
+BuildRequires:  python-testtools >= 2.2.0
 Requires:       python-Babel >= 2.3.4
 Requires:       python-PrettyTable >= 0.7.1
-Requires:       python-keystoneauth1 >= 2.21.0
-Requires:       python-osc-lib >= 1.5.1
-Requires:       python-oslo.i18n >= 2.1.0
-Requires:       python-oslo.log >= 3.22.0
-Requires:       python-oslo.utils >= 3.20.0
+Requires:       python-keystoneauth1 >= 3.2.0
+Requires:       python-osc-lib >= 1.7.0
+Requires:       python-oslo.i18n >= 3.15.3
+Requires:       python-oslo.log >= 3.30.0
+Requires:       python-oslo.utils >= 3.31.0
 Requires:       python-pbr >= 2.0.0
 Requires:       python-requests >= 2.14.2
-Requires:       python-six >= 1.9.0
+Requires:       python-six >= 1.10.0
 BuildArch:      noarch
 
 %description
@@ -56,7 +57,7 @@
 
 %package doc
 Summary:        Documentation for OpenStack Glare API Client
-Group:          Documentation
+Group:          Documentation/HTML
 BuildRequires:  python-Sphinx
 BuildRequires:  python-oslosphinx >= 4.7.0
 

++++++ _service ++++++
--- /var/tmp/diff_new_pack.BwNxzc/_old  2018-01-24 15:26:50.060661283 +0100
+++ /var/tmp/diff_new_pack.BwNxzc/_new  2018-01-24 15:26:50.060661283 +0100
@@ -1,8 +1,8 @@
 <services>
   <service mode="disabled" name="renderspec">
-    <param 
name="input-template">https://raw.githubusercontent.com/openstack/rpm-packaging/stable/pike/openstack/python-glareclient/python-glareclient.spec.j2</param>
+    <param 
name="input-template">https://raw.githubusercontent.com/openstack/rpm-packaging/master/openstack/python-glareclient/python-glareclient.spec.j2</param>
     <param name="output-name">python-glareclient.spec</param>
-    <param 
name="requirements">https://raw.githubusercontent.com/openstack/rpm-packaging/stable/pike/global-requirements.txt</param>
+    <param 
name="requirements">https://raw.githubusercontent.com/openstack/rpm-packaging/master/requirements.txt</param>
     <param name="changelog-email">[email protected]</param>
     <param name="changelog-provider">gh,openstack,python-glareclient</param>
   </service>

++++++ python-glareclient-0.4.1.tar.gz -> python-glareclient-0.4.2.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-glareclient-0.4.1/AUTHORS 
new/python-glareclient-0.4.2/AUTHORS
--- old/python-glareclient-0.4.1/AUTHORS        2017-06-28 00:56:27.000000000 
+0200
+++ new/python-glareclient-0.4.2/AUTHORS        2017-09-06 19:55:52.000000000 
+0200
@@ -1,5 +1,6 @@
 Andreas Jaeger <[email protected]>
 Darja Malyavkina <[email protected]>
+Idan Narotzki <[email protected]>
 IlyaMenkov <[email protected]>
 Mike Fedosin <[email protected]>
 Mike Fedosin <[email protected]>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-glareclient-0.4.1/ChangeLog 
new/python-glareclient-0.4.2/ChangeLog
--- old/python-glareclient-0.4.1/ChangeLog      2017-06-28 00:56:27.000000000 
+0200
+++ new/python-glareclient-0.4.2/ChangeLog      2017-09-06 19:55:52.000000000 
+0200
@@ -1,10 +1,19 @@
 CHANGES
 =======
 
+0.4.2
+-----
+
+* Add content\_length to header in upload\_blob
+* Allow to delete blobs with external urls
+* Add ssl options to keycloak auth module
+* Add ssl options to glare cli
+
 0.4.1
 -----
 
 * Return missing 'return' in build\_option\_parser
+* Updated from global requirements
 
 0.4.0
 -----
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-glareclient-0.4.1/PKG-INFO 
new/python-glareclient-0.4.2/PKG-INFO
--- old/python-glareclient-0.4.1/PKG-INFO       2017-06-28 00:56:27.000000000 
+0200
+++ new/python-glareclient-0.4.2/PKG-INFO       2017-09-06 19:55:53.000000000 
+0200
@@ -1,11 +1,12 @@
 Metadata-Version: 1.1
 Name: python-glareclient
-Version: 0.4.1
+Version: 0.4.2
 Summary: Glare Artifact Repository
 Home-page: http://docs.openstack.org/developer/python-glareclient
 Author: OpenStack
 Author-email: [email protected]
 License: Apache License, Version 2.0
+Description-Content-Type: UNKNOWN
 Description: Python bindings to the Glare Artifact Repository
         ================================================
         
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-glareclient-0.4.1/glareclient/common/http.py 
new/python-glareclient-0.4.2/glareclient/common/http.py
--- old/python-glareclient-0.4.1/glareclient/common/http.py     2017-06-28 
00:54:56.000000000 +0200
+++ new/python-glareclient-0.4.2/glareclient/common/http.py     2017-09-06 
19:53:26.000000000 +0200
@@ -15,7 +15,6 @@
 
 import copy
 import hashlib
-import os
 import socket
 
 from keystoneauth1 import adapter
@@ -28,30 +27,13 @@
 
 from glareclient.common import exceptions as exc
 from glareclient.common import keycloak_auth
+from glareclient.common import utils
 
 LOG = logging.getLogger(__name__)
 USER_AGENT = 'python-glareclient'
 CHUNKSIZE = 1024 * 64  # 64kB
 
 
-def get_system_ca_file():
-    """Return path to system default CA file."""
-    # Standard CA file locations for Debian/Ubuntu, RedHat/Fedora,
-    # Suse, FreeBSD/OpenBSD, MacOSX, and the bundled ca
-    ca_path = ['/etc/ssl/certs/ca-certificates.crt',
-               '/etc/pki/tls/certs/ca-bundle.crt',
-               '/etc/ssl/ca-bundle.pem',
-               '/etc/ssl/cert.pem',
-               '/System/Library/OpenSSL/certs/cacert.pem',
-               requests.certs.where()]
-    for ca in ca_path:
-        LOG.debug("Looking for ca file %s", ca)
-        if os.path.exists(ca):
-            LOG.debug("Using ca file %s", ca)
-            return ca
-    LOG.warning("System ca file could not be found.")
-
-
 def _handle_response(resp):
         content_type = resp.headers.get('Content-Type')
         if not content_type:
@@ -113,7 +95,8 @@
             if kwargs.get('insecure'):
                 self.verify_cert = False
             else:
-                self.verify_cert = kwargs.get('cacert', get_system_ca_file())
+                self.verify_cert = kwargs.get(
+                    'cacert', utils.get_system_ca_file())
 
     def _safe_header(self, name, value):
         if name in ['X-Auth-Token', 'X-Subject-Token']:
@@ -332,14 +315,14 @@
         parameters.update(kwargs)
         return SessionClient(**parameters)
     elif endpoint:
-        realm_name = kwargs.pop('keycloak_realm_name', None)
         if keycloak_auth_url:
             kwargs['auth_token'] = keycloak_auth.authenticate(
                 auth_url=keycloak_auth_url,
                 client_id=kwargs.pop('openid_client_id', None),
                 username=kwargs.pop('keycloak_username', None),
                 password=kwargs.pop('keycloak_password', None),
-                realm_name=realm_name
+                realm_name=kwargs.pop('keycloak_realm_name', None),
+                **kwargs
             )
         else:
             kwargs['auth_token'] = auth_token
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/python-glareclient-0.4.1/glareclient/common/keycloak_auth.py 
new/python-glareclient-0.4.2/glareclient/common/keycloak_auth.py
--- old/python-glareclient-0.4.1/glareclient/common/keycloak_auth.py    
2017-06-28 00:54:56.000000000 +0200
+++ new/python-glareclient-0.4.2/glareclient/common/keycloak_auth.py    
2017-09-06 19:53:26.000000000 +0200
@@ -15,6 +15,9 @@
 import logging
 import pprint
 import requests
+from six.moves import urllib
+
+from glareclient.common import utils
 
 LOG = logging.getLogger(__name__)
 
@@ -29,8 +32,8 @@
     :param username: User name (Optional, if None then access_token must be
             provided).
     :param password: Password (Optional).
+    :param cacert: SSL certificate file (Optional).
     :param insecure: If True, SSL certificate is not verified (Optional).
-
     """
     auth_url = kwargs.get('auth_url')
     client_id = kwargs.get('client_id')
@@ -38,6 +41,7 @@
     username = kwargs.get('username')
     password = kwargs.get('password')
     insecure = kwargs.get('insecure', False)
+    cacert = kwargs.get('cacert', utils.get_system_ca_file())
 
     if not auth_url:
         raise ValueError('Base authentication url is not provided.')
@@ -59,6 +63,10 @@
         (auth_url, realm_name)
     )
 
+    verify = None
+    if urllib.parse.urlparse(access_token_endpoint).scheme == "https":
+        verify = False if insecure else cacert
+
     body = {
         'grant_type': 'password',
         'username': username,
@@ -70,7 +78,7 @@
     resp = requests.post(
         access_token_endpoint,
         data=body,
-        verify=not insecure
+        verify=verify
     )
 
     try:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-glareclient-0.4.1/glareclient/common/utils.py 
new/python-glareclient-0.4.2/glareclient/common/utils.py
--- old/python-glareclient-0.4.1/glareclient/common/utils.py    2017-06-28 
00:54:56.000000000 +0200
+++ new/python-glareclient-0.4.2/glareclient/common/utils.py    2017-09-06 
19:53:26.000000000 +0200
@@ -25,12 +25,16 @@
 else:
     msvcrt = None
 
+from oslo_log import log as logging
 from oslo_utils import encodeutils
 from oslo_utils import importutils
 import requests
 
 from glareclient import exc
 
+LOG = logging.getLogger(__name__)
+
+
 SENSITIVE_HEADERS = ('X-Auth-Token', )
 
 
@@ -173,3 +177,21 @@
             type_name=parsed_args.type_name)['id']
     except exc.BadRequest as e:
         exit(msg=e.details)
+
+
+def get_system_ca_file():
+    """Return path to system default CA file."""
+    # Standard CA file locations for Debian/Ubuntu, RedHat/Fedora,
+    # Suse, FreeBSD/OpenBSD, MacOSX, and the bundled ca
+    ca_path = ['/etc/ssl/certs/ca-certificates.crt',
+               '/etc/pki/tls/certs/ca-bundle.crt',
+               '/etc/ssl/ca-bundle.pem',
+               '/etc/ssl/cert.pem',
+               '/System/Library/OpenSSL/certs/cacert.pem',
+               requests.certs.where()]
+    for ca in ca_path:
+        LOG.debug("Looking for ca file %s", ca)
+        if os.path.exists(ca):
+            LOG.debug("Using ca file %s", ca)
+            return ca
+    LOG.warning("System ca file could not be found.")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-glareclient-0.4.1/glareclient/osc/v1/blobs.py 
new/python-glareclient-0.4.2/glareclient/osc/v1/blobs.py
--- old/python-glareclient-0.4.1/glareclient/osc/v1/blobs.py    2017-06-28 
00:54:56.000000000 +0200
+++ new/python-glareclient-0.4.2/glareclient/osc/v1/blobs.py    2017-09-06 
19:53:26.000000000 +0200
@@ -275,3 +275,52 @@
         else:
             data_to_display.update(data[parsed_args.blob_property])
         return self.dict2columns(data_to_display)
+
+
+class RemoveLocation(command.ShowOne):
+    """Remove external location"""
+
+    def get_parser(self, prog_name):
+        parser = super(RemoveLocation, self).get_parser(prog_name)
+        parser.add_argument(
+            'type_name',
+            metavar='<TYPE_NAME>',
+            action=TypeMapperAction,
+            help='Name of artifact type.',
+        ),
+        parser.add_argument(
+            'name',
+            metavar='<NAME>',
+            help='Name or id of the artifact to download.',
+        ),
+        parser.add_argument(
+            '--artifact-version', '-V',
+            metavar='<VERSION>',
+            default='latest',
+            help='Version of the artifact.',
+        ),
+        parser.add_argument(
+            '--id', '-i',
+            action='store_true',
+            help='The specified id of the artifact.',
+        ),
+        parser.add_argument(
+            '--blob-property', '-p',
+            metavar='<BLOB_PROPERTY>',
+            help='Name of the blob field.'
+        )
+        return parser
+
+    def take_action(self, parsed_args):
+        LOG.debug('take_action({0})'.format(parsed_args))
+        client = self.app.client_manager.artifact
+        af_id = utils.get_artifact_id(client, parsed_args)
+
+        if not parsed_args.blob_property:
+            parsed_args.blob_property = _default_blob_property(
+                parsed_args.type_name)
+
+        client.artifacts.remove_external_location(
+            af_id,
+            parsed_args.blob_property,
+            type_name=parsed_args.type_name)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-glareclient-0.4.1/glareclient/shell.py 
new/python-glareclient-0.4.2/glareclient/shell.py
--- old/python-glareclient-0.4.1/glareclient/shell.py   2017-06-28 
00:54:56.000000000 +0200
+++ new/python-glareclient-0.4.2/glareclient/shell.py   2017-09-06 
19:53:26.000000000 +0200
@@ -225,6 +225,35 @@
             dest='keycloak_password',
             default=utils.env('KEYCLOAK_PASSWORD'),
             help='Keycloak user password (Env: KEYCLOAK_PASSWORD)')
+        parser.add_argument(
+            '--cert',
+            action='store',
+            dest='cert_file',
+            default=utils.env('OS_GLARE_CERT'),
+            help='Client Certificate (Env: OS_GLARE_CERT)'
+        )
+        parser.add_argument(
+            '--key',
+            action='store',
+            dest='key_file',
+            default=utils.env('OS_GLARE_KEY'),
+            help='Client Key (Env: OS_GLARE_KEY)'
+        )
+        parser.add_argument(
+            '--cacert',
+            action='store',
+            dest='cacert',
+            default=utils.env('OS_GLARE_CACERT'),
+            help='Authentication CA Certificate (Env: OS_GLARE_CACERT)'
+        )
+        parser.add_argument(
+            '--insecure',
+            action='store_true',
+            dest='insecure',
+            default=utils.env('GLARECLIENT_INSECURE', default=False),
+            help='Disables SSL/TLS certificate verification '
+                 '(Env: GLARELCLIENT_INSECURE)'
+        )
 
         return parser
 
@@ -250,6 +279,10 @@
             keycloak_realm_name=self.options.keycloak_realm_name,
             keycloak_username=self.options.keycloak_username,
             keycloak_password=self.options.keycloak_password,
+            cert_file=self.options.cert_file,
+            key_file=self.options.key_file,
+            cacert=self.options.cacert,
+            insecure=self.options.insecure
         )
 
         # Adding client_manager variable to make glare client work with
@@ -293,7 +326,8 @@
             'schema': glareclient.osc.v1.artifacts.TypeSchema,
             'upload': glareclient.osc.v1.blobs.UploadBlob,
             'download': glareclient.osc.v1.blobs.DownloadBlob,
-            'location': glareclient.osc.v1.blobs.AddLocation
+            'location': glareclient.osc.v1.blobs.AddLocation,
+            'remove-location': glareclient.osc.v1.blobs.RemoveLocation
         }
 
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/python-glareclient-0.4.1/glareclient/tests/unit/osc/v1/test_blob.py 
new/python-glareclient-0.4.2/glareclient/tests/unit/osc/v1/test_blob.py
--- old/python-glareclient-0.4.1/glareclient/tests/unit/osc/v1/test_blob.py     
2017-06-28 00:54:56.000000000 +0200
+++ new/python-glareclient-0.4.2/glareclient/tests/unit/osc/v1/test_blob.py     
2017-09-06 19:53:26.000000000 +0200
@@ -221,3 +221,31 @@
         columns, data = self.cmd.take_action(parsed_args)
         self.app.client_manager.artifact.artifacts.get = fakes.mock_get
         self.assertEqual(self.COLUMNS, columns)
+
+
+class TestRemoveLocation(TestBlobs):
+    def setUp(self):
+        super(TestRemoveLocation, self).setUp()
+        self.blob_mock.call.return_value = \
+            api_art.Controller(self.http, type_name='images')
+
+        # Command to test
+        self.cmd = osc_blob.RemoveLocation(self.app, None)
+
+    def test_remove_location(self):
+        arglist = ['images',
+                   'fc15c365-d4f9-4b8b-a090-d9e230f1f6ba', '--id']
+        verify = [('type_name', 'images'),
+                  ('name', 'fc15c365-d4f9-4b8b-a090-d9e230f1f6ba'),
+                  ('id', True)]
+        parsed_args = self.check_parser(self.cmd, arglist, verify)
+        self.assertIsNone(self.cmd.take_action(parsed_args))
+
+    def test_remove_dict_location(self):
+        arglist = ['images', '--blob-property', 'nested_templates/blob',
+                   'fc15c365-d4f9-4b8b-a090-d9e230f1f6ba', '--id']
+        verify = [('type_name', 'images'),
+                  ('name', 'fc15c365-d4f9-4b8b-a090-d9e230f1f6ba'),
+                  ('id', True)]
+        parsed_args = self.check_parser(self.cmd, arglist, verify)
+        self.assertIsNone(self.cmd.take_action(parsed_args))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/python-glareclient-0.4.1/glareclient/tests/unit/test_common_http.py 
new/python-glareclient-0.4.2/glareclient/tests/unit/test_common_http.py
--- old/python-glareclient-0.4.1/glareclient/tests/unit/test_common_http.py     
2017-06-28 00:54:56.000000000 +0200
+++ new/python-glareclient-0.4.2/glareclient/tests/unit/test_common_http.py     
2017-09-06 19:53:26.000000000 +0200
@@ -19,6 +19,7 @@
 
 from glareclient.common import exceptions as exc
 from glareclient.common import http
+from glareclient.common import utils
 from glareclient.tests.unit import fakes
 
 
@@ -420,7 +421,7 @@
         with mock.patch('os.path.exists') as mock_os:
             mock_os.return_value = chosen
 
-            ca = http.get_system_ca_file()
+            ca = utils.get_system_ca_file()
             self.assertEqual(chosen, ca)
 
             mock_os.assert_called_once_with(chosen)
@@ -433,7 +434,7 @@
         client = http.HTTPClient('https://foo', cacert="NOWHERE")
         self.assertEqual("NOWHERE", client.verify_cert)
 
-        with mock.patch('glareclient.common.http.get_system_ca_file') as gsf:
+        with mock.patch('glareclient.common.utils.get_system_ca_file') as gsf:
             gsf.return_value = "SOMEWHERE"
             client = http.HTTPClient('https://foo')
             self.assertEqual("SOMEWHERE", client.verify_cert)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/python-glareclient-0.4.1/glareclient/tests/unit/v1/test_artifacts.py 
new/python-glareclient-0.4.2/glareclient/tests/unit/v1/test_artifacts.py
--- old/python-glareclient-0.4.1/glareclient/tests/unit/v1/test_artifacts.py    
2017-06-28 00:54:56.000000000 +0200
+++ new/python-glareclient-0.4.2/glareclient/tests/unit/v1/test_artifacts.py    
2017-09-06 19:53:26.000000000 +0200
@@ -13,6 +13,10 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
+import io
+import os
+import tempfile
+
 import mock
 from oslo_serialization import jsonutils
 import testtools
@@ -110,13 +114,38 @@
         self.mock_http_client.delete.assert_called_once_with(
             '/artifacts/checked_name/test-id')
 
-    def test_upload_blob(self):
+    def test_upload_blob_str(self):
         self.c.upload_blob('test-id', 'blob-prop', 'data',
                            type_name='test-type',
                            content_type='application/test')
         self.mock_http_client.put.assert_called_once_with(
             '/artifacts/checked_name/test-id/blob-prop',
-            data='data', headers={'Content-Type': 'application/test'})
+            data='data', headers={'Content-Length': '4',
+                                  'Content-Type': 'application/test'})
+
+    def test_upload_blob_file(self):
+        tfd, path = tempfile.mkstemp()
+        try:
+            os.write(tfd, b'data')
+            tfile = open(path, "rb")
+            self.c.upload_blob('test-id', 'blob-prop', tfile,
+                               type_name='test-type',
+                               content_type='application/test')
+            self.mock_http_client.put.assert_called_once_with(
+                '/artifacts/checked_name/test-id/blob-prop',
+                data=tfile, headers={'Content-Length': '4',
+                                     'Content-Type': 'application/test'})
+        finally:
+            os.remove(path)
+
+    def test_upload_blob_stream(self):
+        data = io.BytesIO(b'data')
+        self.c.upload_blob('test-id', 'blob-prop', data,
+                           type_name='test-type',
+                           content_type='application/test')
+        self.mock_http_client.put.assert_called_once_with(
+            '/artifacts/checked_name/test-id/blob-prop',
+            data=data, headers={'Content-Type': 'application/test'})
 
     def test_get_type_list(self):
         schemas = {'schemas': {'a': {'version': 1}, 'b': {'version': 2}}}
@@ -151,6 +180,16 @@
                      'application/vnd+openstack.glare-custom-location+json'})
         self.assertIsNone(resp)
 
+    def test_remove_external_location(self):
+        art_id = '3a4560a1-e585-443e-9b39-553b46ec92a8'
+        resp = self.c.remove_external_location(
+            art_id, 'image',
+            type_name='images')
+        self.c.http_client.delete.assert_called_once_with(
+            '/artifacts/checked_name/'
+            '3a4560a1-e585-443e-9b39-553b46ec92a8/image')
+        self.assertIsNone(resp)
+
     def test_add_tag(self):
         art_id = '07a679d8-d0a8-45ff-8d6e-2f32f2097b7c'
         d = {'tags': ['a', 'b', 'c']}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-glareclient-0.4.1/glareclient/v1/artifacts.py 
new/python-glareclient-0.4.2/glareclient/v1/artifacts.py
--- old/python-glareclient-0.4.1/glareclient/v1/artifacts.py    2017-06-28 
00:54:56.000000000 +0200
+++ new/python-glareclient-0.4.2/glareclient/v1/artifacts.py    2017-09-06 
19:53:26.000000000 +0200
@@ -12,6 +12,8 @@
 # License for the specific language governing permissions and limitations
 # under the License.
 
+import os
+
 from oslo_serialization import jsonutils
 from oslo_utils import encodeutils
 import six
@@ -244,8 +246,22 @@
         :param blob_property: blob property name
         """
         content_type = content_type or 'application/octet-stream'
-        type_name = self._check_type_name(type_name)
         hdrs = {'Content-Type': content_type}
+        type_name = self._check_type_name(type_name)
+
+        content_length = None
+        if isinstance(data, six.string_types):
+            content_length = len(data)
+        else:
+            try:
+                content_length = os.path.getsize(data.name)
+            except Exception:
+                # if for some reason we can't get the file size, then we just
+                # ignore it.
+                pass
+        if content_length is not None:
+            hdrs['Content-Length'] = str(content_length)
+
         url = '/artifacts/%s/%s/%s' % (type_name, artifact_id, blob_property)
         self.http_client.put(url, headers=hdrs, data=data)
 
@@ -267,6 +283,18 @@
             raise exc.HTTPBadRequest("json is malformed.")
         self.http_client.put(url, headers=hdrs, data=data)
 
+    def remove_external_location(self, artifact_id, blob_property,
+                                 type_name=None):
+        """Remove external location.
+
+        :param artifact_id: ID of the artifact with external location
+         to be removed
+        :param blob_property: blob property name
+        """
+        type_name = self._check_type_name(type_name)
+        url = '/artifacts/%s/%s/%s' % (type_name, artifact_id, blob_property)
+        self.http_client.delete(url)
+
     def download_blob(self, artifact_id, blob_property, type_name=None,
                       do_checksum=True):
         """Get blob data.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/python-glareclient-0.4.1/python_glareclient.egg-info/PKG-INFO 
new/python-glareclient-0.4.2/python_glareclient.egg-info/PKG-INFO
--- old/python-glareclient-0.4.1/python_glareclient.egg-info/PKG-INFO   
2017-06-28 00:56:27.000000000 +0200
+++ new/python-glareclient-0.4.2/python_glareclient.egg-info/PKG-INFO   
2017-09-06 19:55:52.000000000 +0200
@@ -1,11 +1,12 @@
 Metadata-Version: 1.1
 Name: python-glareclient
-Version: 0.4.1
+Version: 0.4.2
 Summary: Glare Artifact Repository
 Home-page: http://docs.openstack.org/developer/python-glareclient
 Author: OpenStack
 Author-email: [email protected]
 License: Apache License, Version 2.0
+Description-Content-Type: UNKNOWN
 Description: Python bindings to the Glare Artifact Repository
         ================================================
         
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/python-glareclient-0.4.1/python_glareclient.egg-info/entry_points.txt 
new/python-glareclient-0.4.2/python_glareclient.egg-info/entry_points.txt
--- old/python-glareclient-0.4.1/python_glareclient.egg-info/entry_points.txt   
2017-06-28 00:56:27.000000000 +0200
+++ new/python-glareclient-0.4.2/python_glareclient.egg-info/entry_points.txt   
2017-09-06 19:55:52.000000000 +0200
@@ -12,6 +12,7 @@
 artifact_location = glareclient.osc.v1.blobs:AddLocation
 artifact_publish = glareclient.osc.v1.artifacts:PublishArtifact
 artifact_reactivate = glareclient.osc.v1.artifacts:ReactivateArtifact
+artifact_remove-location = glareclient.osc.v1.blobs:RemoveLocation
 artifact_remove_tag = glareclient.osc.v1.artifacts:RemoveTag
 artifact_schema = glareclient.osc.v1.artifacts:TypeSchema
 artifact_show = glareclient.osc.v1.artifacts:ShowArtifact
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/python-glareclient-0.4.1/python_glareclient.egg-info/pbr.json 
new/python-glareclient-0.4.2/python_glareclient.egg-info/pbr.json
--- old/python-glareclient-0.4.1/python_glareclient.egg-info/pbr.json   
2017-06-28 00:56:27.000000000 +0200
+++ new/python-glareclient-0.4.2/python_glareclient.egg-info/pbr.json   
2017-09-06 19:55:52.000000000 +0200
@@ -1 +1 @@
-{"git_version": "3644d2d", "is_release": true}
\ No newline at end of file
+{"git_version": "016653c", "is_release": true}
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/python-glareclient-0.4.1/python_glareclient.egg-info/requires.txt 
new/python-glareclient-0.4.2/python_glareclient.egg-info/requires.txt
--- old/python-glareclient-0.4.1/python_glareclient.egg-info/requires.txt       
2017-06-28 00:56:27.000000000 +0200
+++ new/python-glareclient-0.4.2/python_glareclient.egg-info/requires.txt       
2017-09-06 19:55:52.000000000 +0200
@@ -1,10 +1,10 @@
-pbr>=1.8
-Babel>=2.3.4
+pbr!=2.1.0,>=2.0.0
+Babel!=2.4.0,>=2.3.4
 PrettyTable<0.8,>=0.7.1
-keystoneauth1>=2.18.0
-requests!=2.12.2,!=2.13.0,>=2.10.0
+keystoneauth1>=2.21.0
+requests>=2.14.2
 six>=1.9.0
-oslo.utils>=3.18.0
-oslo.i18n>=2.1.0
-oslo.log>=3.11.0
-osc-lib>=1.2.0
+oslo.utils>=3.20.0
+oslo.i18n!=3.15.2,>=2.1.0
+oslo.log>=3.22.0
+osc-lib>=1.5.1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-glareclient-0.4.1/requirements.txt 
new/python-glareclient-0.4.2/requirements.txt
--- old/python-glareclient-0.4.1/requirements.txt       2017-06-28 
00:54:56.000000000 +0200
+++ new/python-glareclient-0.4.2/requirements.txt       2017-09-06 
19:53:26.000000000 +0200
@@ -1,13 +1,13 @@
 # The order of packages is significant, because pip processes them in the order
 # of appearance. Changing the order has an impact on the overall integration
 # process, which may cause wedges in the gate later.
-pbr>=1.8 # Apache-2.0
-Babel>=2.3.4 # BSD
+pbr!=2.1.0,>=2.0.0 # Apache-2.0
+Babel!=2.4.0,>=2.3.4 # BSD
 PrettyTable<0.8,>=0.7.1 # BSD
-keystoneauth1>=2.18.0 # Apache-2.0
-requests!=2.12.2,!=2.13.0,>=2.10.0 # Apache-2.0
+keystoneauth1>=2.21.0 # Apache-2.0
+requests>=2.14.2 # Apache-2.0
 six>=1.9.0 # MIT
-oslo.utils>=3.18.0 # Apache-2.0
-oslo.i18n>=2.1.0 # Apache-2.0
-oslo.log>=3.11.0 # Apache-2.0
-osc-lib>=1.2.0 # Apache-2.0
+oslo.utils>=3.20.0 # Apache-2.0
+oslo.i18n!=3.15.2,>=2.1.0 # Apache-2.0
+oslo.log>=3.22.0 # Apache-2.0
+osc-lib>=1.5.1 # Apache-2.0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-glareclient-0.4.1/setup.cfg 
new/python-glareclient-0.4.2/setup.cfg
--- old/python-glareclient-0.4.1/setup.cfg      2017-06-28 00:56:27.000000000 
+0200
+++ new/python-glareclient-0.4.2/setup.cfg      2017-09-06 19:55:53.000000000 
+0200
@@ -47,6 +47,7 @@
        artifact_publish = glareclient.osc.v1.artifacts:PublishArtifact
        artifact_upload = glareclient.osc.v1.blobs:UploadBlob
        artifact_location = glareclient.osc.v1.blobs:AddLocation
+       artifact_remove-location = glareclient.osc.v1.blobs:RemoveLocation
        artifact_download = glareclient.osc.v1.blobs:DownloadBlob
        artifact_type-list = glareclient.osc.v1.artifacts:TypeList
        artifact_schema = glareclient.osc.v1.artifacts:TypeSchema
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-glareclient-0.4.1/setup.py 
new/python-glareclient-0.4.2/setup.py
--- old/python-glareclient-0.4.1/setup.py       2017-06-28 00:54:56.000000000 
+0200
+++ new/python-glareclient-0.4.2/setup.py       2017-09-06 19:53:26.000000000 
+0200
@@ -25,5 +25,5 @@
     pass
 
 setuptools.setup(
-    setup_requires=['pbr>=1.8'],
+    setup_requires=['pbr>=2.0.0'],
     pbr=True)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-glareclient-0.4.1/test-requirements.txt 
new/python-glareclient-0.4.2/test-requirements.txt
--- old/python-glareclient-0.4.1/test-requirements.txt  2017-06-28 
00:54:56.000000000 +0200
+++ new/python-glareclient-0.4.2/test-requirements.txt  2017-09-06 
19:53:26.000000000 +0200
@@ -1,15 +1,15 @@
 # The order of packages is significant, because pip processes them in the order
 # of appearance. Changing the order has an impact on the overall integration
 # process, which may cause wedges in the gate later.
-hacking>=0.12.0,!=0.13.0,<0.14  # Apache-2.0
+hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0
 
-coverage>=4.0 # Apache-2.0
+coverage!=4.4,>=4.0 # Apache-2.0
 mock>=2.0 # BSD
 ordereddict # MIT
-os-client-config>=1.22.0 # Apache-2.0
+os-client-config>=1.27.0 # Apache-2.0
 oslosphinx>=4.7.0 # Apache-2.0
-reno>=1.8.0 # Apache-2.0
-sphinx>=1.5.1 # BSD
+reno!=2.3.1,>=1.8.0 # Apache-2.0
+sphinx>=1.6.2 # BSD
 testrepository>=0.0.18 # Apache-2.0/BSD
 testtools>=1.4.0 # MIT
 testscenarios>=0.4 # Apache-2.0/BSD


Reply via email to