Hello community, here is the log from the commit of package openstack-glance for openSUSE:Factory checked in at 2012-11-13 11:41:37 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/openstack-glance (Old) and /work/SRC/openSUSE:Factory/.openstack-glance.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "openstack-glance", Maintainer is "CThiel@suse.com" Changes: -------- --- /work/SRC/openSUSE:Factory/openstack-glance/openstack-glance.changes 2012-02-08 17:19:39.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.openstack-glance.new/openstack-glance.changes 2012-11-13 11:41:40.000000000 +0100 @@ -1,0 +2,175 @@ +Thu Nov 8 13:28:42 UTC 2012 - saschpe@suse.de + +- Drop from_vcs build flag + +------------------------------------------------------------------- +Tue Nov 6 09:42:31 UTC 2012 - saschpe@suse.de + +- Add glance-bnc787814_essex.patch: Authentication bypass for + image deletion (bnc#787814) + +------------------------------------------------------------------- +Wed Sep 26 09:55:46 UTC 2012 - bwiedemann@suse.com + +- make init script wait for postgresql (bnc#781798) + +------------------------------------------------------------------- +Wed Sep 12 11:05:40 UTC 2012 - vuntz@suse.com + +- Do not use a sed to modify /usr/bin/gensslcert in %post: this + file belongs to another package, and we actually don't do any + change with the sed... Fix bnc#779747. + +------------------------------------------------------------------- +Thu Aug 23 06:57:06 UTC 2012 - vuntz@suse.com + +- Add glance-utf8-headers.patch: make sure to encode to UTF-8 the + data we put in HTTP headers. By default, they're unicode and this + breaks if using mod_wsgi (like in our SSL setup). Fix bnc#776699. + +------------------------------------------------------------------- +Tue Aug 14 10:40:44 UTC 2012 - bwiedemann@suse.com + +- rename /usr/bin/glance => glance.essex + to no more conflict with python-glanceclient + +------------------------------------------------------------------- +Fri Aug 10 22:08:04 UTC 2012 - jenkins@suse.de + +- Update to latest git (120fcf4): + + Final versioning for 2012.1.2 + + Bump version to 2012.1.3 + +------------------------------------------------------------------- +Wed Aug 8 14:11:18 UTC 2012 - jenkins@suse.de + +- Update to latest git (e91ea80): + + Make image.upload notification send up2date metadata + + Include chunk_name in swift debug message + + Remove microseconds before time format conversion. + +------------------------------------------------------------------- +Tue Aug 7 22:06:20 UTC 2012 - jenkins@suse.de + +- Update to latest git (183ea45): + + Support zero-size image creation via the v1 API + + Stop revealing sensitive store info + + fix the qpid_heartbeat option so that it's effective + + Allow admins to share images regardless of owner. + + Fix swift dependency at 1.4.8. + +------------------------------------------------------------------- +Mon Jul 30 12:46:17 UTC 2012 - saschpe@suse.de + +- Provide glance-api WSGI skeleton + +------------------------------------------------------------------- +Fri Jul 27 12:46:40 UTC 2012 - saschpe@suse.de + +- Remove doc/source/_templates/.placeholder +- Provide self-signed SSL certificates to be used for non-production setups + (like openstack-quickstart) + +------------------------------------------------------------------- +Wed Jul 18 09:12:16 UTC 2012 - saschpe@suse.de + +- Add glance-insecure-cmdline-flag-for-auth.patch to fix authentication + against keystone with self-signed SSL certs + +------------------------------------------------------------------- +Tue Jul 3 12:34:39 UTC 2012 - saschpe@suse.de + +- Conflict on python-glanceclient, it also ships /usr/bin/glance + +------------------------------------------------------------------- +Wed Jun 27 10:16:57 UTC 2012 - saschpe@suse.de + +- Change versioning scheme to $release+git.$AUTHORDATE.$COMMITREV +- Simplify from_vcs macros + +------------------------------------------------------------------- +Tue Jun 26 12:58:18 UTC 2012 - saschpe@suse.de + +- Consistent package summaries +- Use upstream description +- Macro cleanup: + + Package is noarch except for SLE-11 + + No need to redefine %_initddir, SLE-11 works correctly + +------------------------------------------------------------------- +Tue Jun 12 10:38:16 UTC 2012 - saschpe@suse.de + +- Use 'openstack-glance' system user instead of 'glance' + +------------------------------------------------------------------- +Wed Jun 6 13:58:34 UTC 2012 - saschpe@suse.de + +- Add Should-Stop: lines to init scripts (LBS compliance) + +------------------------------------------------------------------- +Wed Jun 6 12:59:49 UTC 2012 - saschpe@suse.de + +- Add %restart_on_update to %post section for api and registry + (daemons should be restarted after package update) +- Fix some rpmlint warnings +- Added rpmlintrc for non-issues + +------------------------------------------------------------------- +Thu May 24 10:29:20 MDT 2012 - jfehlig@suse.com + +- Add 'Requires: python >= 2.6.8' to openstack-glance and + python-glance subpackage + +------------------------------------------------------------------- +Tue May 22 13:46:41 UTC 2012 - bwiedemann@suse.com + +- make *-paste.ini private + to not show the admin_token to everyone (bnc#750137) + +------------------------------------------------------------------- +Fri Apr 20 13:08:52 UTC 2012 - bwiedemann@suse.com + +- add bash completion for glance + +------------------------------------------------------------------- +Thu Apr 19 13:55:21 UTC 2012 - bwiedemann@suse.com + +- drop upstreamed patch +- add patch for https://bugs.launchpad.net/glance/+bug/978907 + +------------------------------------------------------------------- +Tue Feb 14 10:29:20 UTC 2012 - bwiedemann@suse.com + +- fix init scripts - startproc would not start/stop the second + glance-{api|registri} because it already saw a glance-control process. +- run as glance user instead of root + +------------------------------------------------------------------- +Mon Feb 6 17:11:20 UTC 2012 - rhafer@suse.de + +- Updated to latest git snapshot + +------------------------------------------------------------------- +Mon Feb 6 16:54:34 UTC 2012 - rhafer@suse.de + +- Split the init script up into separate ones for -registry and + -api. +- glance-control needs to be called with --config-file to have + the services started correctly + +------------------------------------------------------------------- +Fri Feb 3 16:49:06 UTC 2012 - cstender@suse.com + +- move *.ini files to /etc/glance/ + +------------------------------------------------------------------- +Thu Feb 2 15:28:03 UTC 2012 - rhafer@suse.de + +- glance requires python-crypto + +------------------------------------------------------------------- +Thu Jan 19 15:48:56 CET 2012 - mvidner@suse.cz + +- updated to today's git snapshot, adjusted the file list + +------------------------------------------------------------------- Old: ---- glance-2011.3.patch glance-2011.3.tar.gz lp_845788_glance_client_zero_length.patch lp_850425_remote_swift_image_streaming.patch openstack-glance.init New: ---- _service glance-2012.1+git.1344578005.120fcf4.tar.gz glance-bnc787814_essex.patch glance-insecure-cmdline-flag-for-auth.patch glance-utf8-headers.patch openstack-glance-api.init openstack-glance-api.wsgi openstack-glance-registry.init openstack-glance.sh rpmlintrc ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ openstack-glance.spec ++++++ --- /var/tmp/diff_new_pack.jHWGFK/_old 2012-11-13 11:41:41.000000000 +0100 +++ /var/tmp/diff_new_pack.jHWGFK/_new 2012-11-13 11:41:41.000000000 +0100 @@ -1,6 +1,7 @@ +# # spec file for package openstack-glance # -# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany. # Copyright (c) 2011 B1 Systems GmbH, Vohburg, Germany. # # All modifications and additions to the file contributed by third parties @@ -12,172 +13,238 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# options to forcefully build with/without vcs -%bcond_with from_vcs -%bcond_with no_from_vcs - -%if %{with from_vcs} -%define BUILD_FROM_VCS 1 -%endif -%if %{with no_from_vcs} -%define BUILD_FROM_VCS 0 -%endif - -%{!?python_sitelib: %global python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")} +# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# -%if 0%{?BUILD_FROM_VCS} -%define vcs_summary_warn -- Git Snapshot -%else -%define vcs_summary_warn %null -%endif -%define shortname glance -Name: openstack-glance -Version: 2011.3 -%if 0%{?BUILD_FROM_VCS} -%define _version git-master -%else -%define _version 2011.3 -%endif -Release: 1 -License: Apache-2.0 and GPL-3.0+ -Summary: Discover, Register and Retrieve virtual machine images %{vcs_summary_warn} -Url: http://glance.openstack.org/ +%define component glance +%define groupname openstack-%{component} +%define username openstack-%{component} + +Name: openstack-%{component} +Version: 2012.1+git.1344578005.120fcf4 +Release: 0 +Summary: OpenStack Image Service (Glance) +License: Apache-2.0 Group: Development/Libraries/Python -Source0: glance-%{_version}.tar.gz -Source1: openstack-glance.init -Patch0: glance-2011.3.patch -Patch1: lp_845788_glance_client_zero_length.patch -Patch2: lp_850425_remote_swift_image_streaming.patch +Url: http://glance.openstack.org/ +Source0: %{component}-%{version}.tar.gz +Source1: openstack-glance-api.init +Source2: openstack-glance-registry.init +Source3: openstack-glance.sh +# WSGI application skeleton for API app (for the SSL proxy): +Source4: openstack-glance-api.wsgi +# PATCH-FIX-UPSTREAM: Backport of https://review.openstack.org/#/c/9956 +Patch0: glance-insecure-cmdline-flag-for-auth.patch +# PATCH-FIX-UPSTREAM glance-utf8-headers.patch bnc#776699 vuntz@suse.com -- Encode HTTP headers to utf-8, https://review.openstack.org/#/c/11716/ +Patch1: glance-utf8-headers.patch +# PATCH-FIX-UPSTREAM glance-bnc787814_essex.patch saschpe@suse.de -- Authentication bypass for image deletion +Patch2: glance-bnc787814_essex.patch +BuildRequires: apache2 BuildRequires: fdupes BuildRequires: intltool BuildRequires: python-Sphinx BuildRequires: python-devel BuildRequires: python-distribute BuildRequires: python-distutils-extra -BuildRoot: %{_tmppath}/%{name}-%{version}-build - Requires: openstack-swift +Requires: python >= 2.6.8 Requires: python-PasteDeploy +Requires: python-SQLAlchemy +Requires: python-WebOb Requires: python-anyjson Requires: python-argparse Requires: python-boto +Requires: python-crypto Requires: python-eventlet +Requires: python-glance = %{version} Requires: python-greenlet Requires: python-httplib2 +Requires: python-iso8601 Requires: python-kombu Requires: python-routes -Requires: python-sqlalchemy Requires: python-sqlalchemy-migrate -Requires: python-webob Requires: python-wsgiref Requires: python-xattr - +#TODO/FIXME: python-glanceclient (2012.1) also ships /usr/bin/glance: +BuildRoot: %{_tmppath}/%{name}-%{version}-build +# To generate a self-signed certificate to be used in demo setups: +Requires(post): apache2-utils +Requires(post): openssl +Requires(post): sysconfig %if 0%{?suse_version} > 1110 Requires(pre): pwdutils %else Requires(pre): shadow-utils %endif - -%define sharedstatedir %{_localstatedir}/lib +%if 0%{?suse_version} && 0%{?suse_version} <= 1110 +%{!?python_sitelib: %global python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} +%else +BuildArch: noarch +%endif %description -The Glance project provides services for discovering, registering, and retrieving virtual machine images. Glance has a RESTful API that allows querying of VM image metadata as well as retrieval of the actual image. +The OpenStack Image Service provides discovery, registration and +delivery services for disk and server images. The ability to copy or +snapshot a server image and immediately store it away is a powerful +capability of the OpenStack cloud operating system. Stored images can +be used as a template to get new servers up and running quickly—and +more consistently if you are provisioning multiple servers—than +installing a server operating system and individually configuring +additional services. It can also be used to store and catalog an +unlimited number of backups. + +The Image Service can store disk and server images in a variety of +back-ends, including OpenStack Object Storage. The Image Service API +provides a standard REST interface for querying information about disk +images and lets clients stream the images to new servers. %package -n python-glance -Summary: OpenStack glance python files %{vcs_summary_warn} + +Summary: OpenStack Image Service (Glance) - Python module Group: Development/Languages/Python +Requires: python >= 2.6.8 %description -n python-glance -This package contains the python files for glance. +This package contains the core Python module of OpenStack Glance. + +%package test + +Summary: OpenStack Image Service (Glance) - Testsuite +Group: Development/Languages/Python +Requires: %{name} = %{version} +Requires: python-mox +# for tests/functional/v2/test_root.py : +Requires: python-requests + +%description test +The OpenStack Glance testsuite. It is used to verify the functionality +of OpenStack Glance. %prep -%setup -q -n %{shortname}-%{_version} -%if !(0%{?BUILD_FROM_VCS}) -%patch0 +%setup -q -n %{component}-%{version} +%patch0 -p1 %patch1 -p1 %patch2 -p1 -%endif +# Fix non-executable scripts in Python site-arch: +sed -i "s|!/usr/bin/env python||" glance/common/{crypt,config}.py glance/registry/db/migrate_repo/manage.py +rm doc/source/_templates/.placeholder # It's a git placeholder, we don't need that %build +# we copy these to where we want them installed, but keep them here for +# the -test subpackage mkdir etc/glance -mv etc/*.conf etc/glance/ -mv etc/*.sample etc/glance/ +cp etc/*.conf etc/glance/ +cp etc/*.ini etc/glance/ +cp etc/*.sample etc/glance/ +cp etc/policy.json etc/glance/ python setup.py build %install python setup.py install --prefix=%{_prefix} --root=%{buildroot} -mkdir -p %{buildroot}%{_initrddir} +mv %{buildroot}%{_bindir}/glance{,.essex} +mkdir -p %{buildroot}%{_initddir} mkdir -p %{buildroot}%{_sbindir} -install -m 755 %{SOURCE1} %{buildroot}%{_initrddir}/openstack-glance -ln -s ../..%{_initrddir}/openstack-glance %{buildroot}%{_sbindir}/rcopenstack-glance -install -d -m 755 %{buildroot}%{sharedstatedir}/glance +install -m 755 %{SOURCE1} %{buildroot}%{_initddir}/openstack-glance-api +install -m 755 %{SOURCE2} %{buildroot}%{_initddir}/openstack-glance-registry +ln -s ../..%{_initddir}/openstack-glance-api %{buildroot}%{_sbindir}/rcopenstack-glance-api +ln -s ../..%{_initddir}/openstack-glance-registry %{buildroot}%{_sbindir}/rcopenstack-glance-registry +install -d -m 755 %{buildroot}%{_localstatedir}/lib/glance install -d -m 755 %{buildroot}%{_localstatedir}/lib/glance install -d -m 755 %{buildroot}%{_localstatedir}/lib/glance/images install -d -m 755 %{buildroot}%{_localstatedir}/log/glance install -d -m 755 %{buildroot}%{_localstatedir}/run/glance +cp -a etc/glance %{buildroot}%{_sysconfdir} +mkdir -p %{buildroot}%{_sysconfdir}/bash_completion.d/ +cp -a %{SOURCE3} %{buildroot}%{_sysconfdir}/bash_completion.d/ rm -rf %{buildroot}%{_datadir}/doc/glance +# for test sub-package +install -d -m 755 %{buildroot}%{_localstatedir}/lib/openstack-glance-test +cp -av * %{buildroot}%{_localstatedir}/lib/openstack-glance-test/ +rm -rf %{buildroot}%{_localstatedir}/lib/openstack-glance-test/glance +ln -s %{python_sitelib}/glance %{buildroot}%{_localstatedir}/lib/openstack-glance-test/glance + +%fdupes %{buildroot}%{python_sitelib} +%fdupes %{buildroot}%{_localstatedir}/lib/openstack-glance-test/ + +# Apache2 SSL certificate stubs (generated in %%post) +install -d %{buildroot}%{_sysconfdir}/apache2/ssl.{crt,csr,key} +install -d %{buildroot}/srv/www/htdocs +touch %{buildroot}%{_sysconfdir}/apache2/ssl.key/openstack-glance-{ca,server}.key +touch %{buildroot}%{_sysconfdir}/apache2/ssl.csr/openstack-glance-server.csr +touch %{buildroot}%{_sysconfdir}/apache2/ssl.crt/openstack-glance-{ca,server}.crt + +# Apache2 WSGI apps +install -D %{SOURCE4} %{buildroot}%{_localstatedir}/lib/glance/wsgi/glance-api.wsgi + %pre -getent group glance >/dev/null || groupadd -r glance -getent passwd glance >/dev/null || useradd -r -g glance -d %{sharedstatedir}/glance -s /sbin/nologin -c "OpenStack glance Daemons" glance +getent group %{groupname} >/dev/null || groupadd -r %{groupname} +getent passwd %{username} >/dev/null || useradd -r -g %{groupname} -d %{_localstatedir}/lib/glance -s /sbin/nologin -c "OpenStack glance Daemons" %{username} exit 0 %post -%fillup_and_insserv openstack-glance -%restart_on_update openstack-glance +if [ ! -s %{_sysconfdir}/apache2/ssl.csr/openstack-glance-server.csr ] ; then + # Generate a self-signed certificate to be used in non-production setups: + (umask 377 ; /usr/bin/gensslcert -C openstack-glance -n glance.example.com) +fi +# Fix owner of glance paster configs manually (it's marked as 'config'): +chown %{username}:root %{_sysconfdir}/glance/glance-*-paste.ini +chown -R %{username}:%{groupname} /var/log/glance /var/lib/glance # for migration - TODO: drop later +%fillup_and_insserv openstack-glance-api openstack-glance-registry %preun -%stop_on_removal openstack-glance +%stop_on_removal openstack-glance-api openstack-glance-registry %postun +%restart_on_update openstack-glance-api openstack-glance-registry %insserv_cleanup -%clean -rm -rf %{buildroot} - %files %defattr(-,root,root) -%doc README -%{_initrddir}/openstack-glance -%{_sbindir}/rcopenstack-glance +%doc README.rst +%{_initddir}/openstack-glance-api +%{_initddir}/openstack-glance-registry +%{_sbindir}/rcopenstack-glance-api +%{_sbindir}/rcopenstack-glance-registry +%{_sysconfdir}/bash_completion.d/openstack-glance.sh %dir %{_sysconfdir}/glance %config(noreplace) %{_sysconfdir}/glance/glance-api.conf -%if 0%{?BUILD_FROM_VCS} +%config(noreplace) %attr(0600, %{username}, root) %{_sysconfdir}/glance/glance-api-paste.ini %config(noreplace) %{_sysconfdir}/glance/glance-cache.conf -%else -%config(noreplace) %{_sysconfdir}/glance/glance-prefetcher.conf -%config(noreplace) %{_sysconfdir}/glance/glance-pruner.conf -%config(noreplace) %{_sysconfdir}/glance/glance-reaper.conf -%endif +%config(noreplace) %{_sysconfdir}/glance/glance-cache-paste.ini %config(noreplace) %{_sysconfdir}/glance/glance-registry.conf +%config(noreplace) %attr(0600, %{username}, root) %{_sysconfdir}/glance/glance-registry-paste.ini %config(noreplace) %{_sysconfdir}/glance/glance-scrubber.conf +%config(noreplace) %{_sysconfdir}/glance/glance-scrubber-paste.ini %config(noreplace) %{_sysconfdir}/glance/logging.cnf.sample -%dir %attr(0755, glance, root) %{_localstatedir}/lib/glance -%dir %attr(0755, glance, root) %{_localstatedir}/lib/glance/images -%dir %attr(0755, glance, root) %{_localstatedir}/log/glance -%ghost %dir %attr(0755, glance, root) %{_localstatedir}/run/glance -%{_bindir}/glance +%config(noreplace) %{_sysconfdir}/glance/policy.json +%dir %attr(0755, %{username}, root) %{_localstatedir}/lib/glance +%dir %attr(0755, %{username}, root) %{_localstatedir}/lib/glance/images +%dir %attr(0755, %{username}, root) %{_localstatedir}/log/glance +%ghost %dir %attr(0755, %{username}, root) %{_localstatedir}/run/glance +%{_bindir}/glance.essex %{_bindir}/glance-api %{_bindir}/glance-cache-prefetcher %{_bindir}/glance-cache-pruner -%if 0%{?BUILD_FROM_VCS} %{_bindir}/glance-cache-cleaner %{_bindir}/glance-cache-manage -%{_bindir}/glance-cache-queue-image -%else -%{_bindir}/glance-cache-reaper -%endif %{_bindir}/glance-control %{_bindir}/glance-manage %{_bindir}/glance-registry %{_bindir}/glance-scrubber -%if !(0%{?BUILD_FROM_VCS}) -%{_bindir}/glance-upload -%endif +%ghost %{_sysconfdir}/apache2/ssl.key/openstack-glance-*.key +%ghost %{_sysconfdir}/apache2/ssl.csr/openstack-glance-server.csr +%ghost %{_sysconfdir}/apache2/ssl.crt/openstack-glance-*.crt +%dir %attr(0755, root, root) %{_localstatedir}/lib/glance/wsgi +%attr(0644, root, root) %{_localstatedir}/lib/glance/wsgi/*.wsgi %files -n python-glance %defattr(-,root,root,-) -%{python_sitelib} +%{python_sitelib}/* + +%files test +%defattr(-,root,root) +%{_localstatedir}/lib/openstack-glance-test %changelog ++++++ _service ++++++ <services> <service name="tar_scm" mode="disabled"> <param name="url">git://github.com/openstack/glance.git</param> <param name="scm">git</param> <param name="exclude">.git</param> <param name="version">git-master</param> <param name="versionformat">2012.1+git.%ct.%h</param> <!-- Use this if you want a specific revision. --> <param name="revision">stable/essex</param> </service> <service name="recompress" mode="disabled"> <param name="file">glance-*git*.tar</param> <param name="compression">gz</param> </service> <service name="set_version" mode="disabled"> <param name="basename">glance</param> </service> </services> ++++++ glance-bnc787814_essex.patch ++++++ diff --git a/glance/api/v1/images.py b/glance/api/v1/images.py index 9bedf20..2684454 100644 --- a/glance/api/v1/images.py +++ b/glance/api/v1/images.py @@ -738,10 +738,10 @@ class Controller(controller.BaseController): # to delete the image if the backend doesn't yet store it. # See https://bugs.launchpad.net/glance/+bug/747799 try: + registry.delete_image_metadata(req.context, id) if image['location']: schedule_delete_from_backend(image['location'], self.conf, req.context, id) - registry.delete_image_metadata(req.context, id) except exception.NotFound, e: msg = ("Failed to find image to delete: %(e)s" % locals()) for line in msg.split('\n'): ++++++ glance-insecure-cmdline-flag-for-auth.patch ++++++ diff --git a/glance/common/auth.py b/glance/common/auth.py index 7c38426..19866fc 100644 --- a/glance/common/auth.py +++ b/glance/common/auth.py @@ -76,8 +76,9 @@ class NoAuthStrategy(BaseStrategy): class KeystoneStrategy(BaseStrategy): MAX_REDIRECTS = 10 - def __init__(self, creds): + def __init__(self, creds, insecure=False): self.creds = creds + self.insecure = insecure super(KeystoneStrategy, self).__init__() def check_auth_params(self): @@ -260,20 +261,20 @@ class KeystoneStrategy(BaseStrategy): def strategy(self): return 'keystone' - @staticmethod - def _do_request(url, method, headers=None, body=None): + def _do_request(self, url, method, headers=None, body=None): headers = headers or {} conn = httplib2.Http() conn.force_exception_to_status_code = True + conn.disable_ssl_certificate_validation = self.insecure headers['User-Agent'] = 'glance-client' resp, resp_body = conn.request(url, method, headers=headers, body=body) return resp, resp_body -def get_plugin_from_strategy(strategy, creds=None): +def get_plugin_from_strategy(strategy, creds=None, insecure=False): if strategy == 'noauth': return NoAuthStrategy() elif strategy == 'keystone': - return KeystoneStrategy(creds) + return KeystoneStrategy(creds, insecure) else: raise Exception(_("Unknown auth strategy '%s'") % strategy) diff --git a/glance/common/client.py b/glance/common/client.py index 7ee8160..b5c1548 100644 --- a/glance/common/client.py +++ b/glance/common/client.py @@ -266,12 +266,12 @@ class BaseClient(object): # cannot simply do doc_root or self.DEFAULT_DOC_ROOT below. self.doc_root = (doc_root if doc_root is not None else self.DEFAULT_DOC_ROOT) - self.auth_plugin = self.make_auth_plugin(self.creds) self.key_file = key_file self.cert_file = cert_file self.ca_file = ca_file self.insecure = insecure + self.auth_plugin = self.make_auth_plugin(self.creds, self.insecure) self.connect_kwargs = self.get_connect_kwargs() def get_connect_kwargs(self): @@ -365,12 +365,12 @@ class BaseClient(object): # publicURL is parsed for potential SSL usage self.connect_kwargs = self.get_connect_kwargs() - def make_auth_plugin(self, creds): + def make_auth_plugin(self, creds, insecure): """ Returns an instantiated authentication plugin. """ strategy = creds.get('strategy', 'noauth') - plugin = auth.get_plugin_from_strategy(strategy, creds) + plugin = auth.get_plugin_from_strategy(strategy, creds, insecure) return plugin def get_connection_type(self): ++++++ glance-utf8-headers.patch ++++++
From 2da0f4d58570d44f783e96c500426ef05dc739b0 Mon Sep 17 00:00:00 2001 From: Vincent Untz
Date: Tue, 21 Aug 2012 17:17:22 +0200 Subject: [PATCH] Encode headers in v1 API to utf-8
We're getting data from the registry via JSON, which means the values are of the unicode type. We want to output utf-8, otherwise this won't work if we use glance through mod_wsgi. Change-Id: Iadb215003db57ab25d9919341e6aba195835531c --- glance/api/v1/images.py | 11 ++++++----- glance/tests/unit/test_api.py | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/glance/api/v1/images.py b/glance/api/v1/images.py index 9bedf20..afc4475 100644 --- a/glance/api/v1/images.py +++ b/glance/api/v1/images.py @@ -839,10 +839,11 @@ class ImageSerializer(wsgi.JSONResponseSerializer): def _inject_location_header(self, response, image_meta): location = self._get_image_location(image_meta) - response.headers['Location'] = location + response.headers['Location'] = location.encode('utf-8') def _inject_checksum_header(self, response, image_meta): - response.headers['ETag'] = image_meta['checksum'] + if image_meta['checksum'] is not None: + response.headers['ETag'] = image_meta['checksum'].encode('utf-8') def _inject_image_meta_headers(self, response, image_meta): """ @@ -859,7 +860,7 @@ class ImageSerializer(wsgi.JSONResponseSerializer): headers = utils.image_meta_to_http_headers(image_meta) for k, v in headers.items(): - response.headers[k] = v + response.headers[k.encode('utf-8')] = v.encode('utf-8') def _get_image_location(self, image_meta): """Build a relative url to reach the image defined by image_meta.""" @@ -935,11 +936,11 @@ class ImageSerializer(wsgi.JSONResponseSerializer): "image %(image_id)s") % locals()) image_iter = result['image_iterator'] - # image_meta['size'] is a str + # image_meta['size'] should be an int, but could possibly be a str expected_size = int(image_meta['size']) response.app_iter = checked_iter(image_id, expected_size, image_iter) # Using app_iter blanks content-length, so we set it here... - response.headers['Content-Length'] = image_meta['size'] + response.headers['Content-Length'] = str(image_meta['size']) response.headers['Content-Type'] = 'application/octet-stream' self._inject_image_meta_headers(response, image_meta) diff --git a/glance/tests/unit/test_api.py b/glance/tests/unit/test_api.py index 537b2c8..9a762b6 100644 --- a/glance/tests/unit/test_api.py +++ b/glance/tests/unit/test_api.py @@ -2991,7 +2991,7 @@ class TestImageSerializer(base.IsolatedUnitTest): 'updated_at': datetime.datetime.utcnow(), 'deleted_at': None, 'deleted': False, - 'checksum': None, + 'checksum': '06ff575a2856444fbe93100157ed74ab92eb7eff', 'size': 19, 'owner': _gen_uuid(), 'location': "file:///tmp/glance-tests/2", -- 1.7.10.4 ++++++ openstack-glance-api.init ++++++ #!/bin/sh # ### BEGIN INIT INFO # Provides: openstack-glance-api # Required-Start: $syslog $remote_fs # Should-Start: $time mysql postgresql # Should-Stop: $time mysql postgresql # Required-Stop: $syslog $remote_fs # Default-Start: 3 5 # Default-Stop: 0 1 2 6 # Short-Description: OpenStack Image Service (Glance) API # Description: The OpenStack glance service allows to # Discover, Register and Retrieve virtual machine images ### END INIT INFO GLANCE_CONTROL=/usr/bin/glance-control GLANCE_API_BIN=/usr/bin/glance-api GLANCE_API_CONFIG=/etc/glance/glance-api.conf GLANCE_RUN_DIR=/var/run/glance GLANCE_SYSTEM_USER=openstack-glance mkdir -p $GLANCE_RUN_DIR BAD=false for i in $GLANCE_CONTROL $GLANCE_API_BIN; do test -x $i && continue echo "$i not installed" BAD=true done # Special treatment of stop for LSB conformance if $BAD; then test "$1" = "stop" && exit 0 exit 5 fi # Check for existence of needed config file and read it if ! test -r $GLANCE_API_CONFIG; then echo "$GLANCE_API_CONFIG not existing" test "$1" = "stop" && exit 0 exit 6 fi . /etc/rc.status rc_reset # Return values acc. to LSB for all commands but status: # 0 - success # 1 - generic or unspecified error # 2 - invalid or excess argument(s) # 3 - unimplemented feature (e.g. "reload") # 4 - user had insufficient privileges # 5 - program is not installed # 6 - program is not configured # 7 - program is not running # 8--199 - reserved (8--99 LSB, 100--149 distrib, 150--199 appl) # # Note that starting an already running service, stopping # or restarting a not-running service as well as the restart # with force-reload (in case signaling is not supported) are # considered a success. case "$1" in start) echo -n "Starting Glance API" /sbin/startproc -q -s -u $GLANCE_SYSTEM_USER $GLANCE_API_BIN --config-file=$GLANCE_API_CONFIG rc_status -v ;; stop) echo -n "Shutting down Glance API" /sbin/killproc $GLANCE_API_BIN rc_status -v ;; try-restart|condrestart) if test "$1" = "condrestart"; then echo "${attn} Use try-restart ${done}(LSB)${attn} rather than condrestart ${warn}(RH)${norm}" fi $0 status if test $? = 0; then $0 restart else rc_reset # Not running is not a failure. fi rc_status ;; restart) $0 stop $0 start rc_status ;; force-reload) $0 try-restart rc_status ;; reload) echo -n "Reload service glance-api " rc_failed 3 rc_status -v ;; status) echo -n "Checking for service glance-api" /sbin/checkproc $GLANCE_API_BIN rc_status -v ;; *) echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload}" exit 1 ;; esac rc_exit ++++++ openstack-glance-api.wsgi ++++++ # # OpenStack Image (Glance) WSGI app skeleton # #import gettext import os #gettext.install('glance', unicode=1) from glance.common import config from glance.common import wsgi conf = config.GlanceConfigOpts(prog='glance-api') conf() application = config.load_paste_app(conf) ++++++ openstack-glance-registry.init ++++++ #!/bin/sh # ### BEGIN INIT INFO # Provides: openstack-glance-registry # Required-Start: $syslog $remote_fs # Should-Start: $time mysql postgresql # Should-Stop: $time mysql postgresql # Required-Stop: $syslog $remote_fs # Default-Start: 3 5 # Default-Stop: 0 1 2 6 # Short-Description: OpenStack Image Service (Glance) Registry # Description: The OpenStack glance service allows to # Discover, Register and Retrieve virtual machine images ### END INIT INFO GLANCE_CONTROL=/usr/bin/glance-control GLANCE_REG_BIN=/usr/bin/glance-registry GLANCE_REGISTRY_CONFIG=/etc/glance/glance-registry.conf GLANCE_RUN_DIR=/var/run/glance GLANCE_SYSTEM_USER=openstack-glance mkdir -p $GLANCE_RUN_DIR BAD=false for i in $GLANCE_CONTROL $GLANCE_REG_BIN; do test -x $i && continue echo "$i not installed" BAD=true done # Special treatment of stop for LSB conformance if $BAD; then test "$1" = "stop" && exit 0 exit 5 fi GLANCE_REGISTRY_CONFIG=/etc/glance/glance-registry.conf if ! test -r $GLANCE_REGISTRY_CONFIG; then echo "$GLANCE_REGISTRY_CONFIG not existing" test "$1" = "stop" && exit 0 exit 6 fi . /etc/rc.status rc_reset # Return values acc. to LSB for all commands but status: # 0 - success # 1 - generic or unspecified error # 2 - invalid or excess argument(s) # 3 - unimplemented feature (e.g. "reload") # 4 - user had insufficient privileges # 5 - program is not installed # 6 - program is not configured # 7 - program is not running # 8--199 - reserved (8--99 LSB, 100--149 distrib, 150--199 appl) # # Note that starting an already running service, stopping # or restarting a not-running service as well as the restart # with force-reload (in case signaling is not supported) are # considered a success. case "$1" in start) echo -n "Starting Glance registry" /sbin/startproc -q -s -u $GLANCE_SYSTEM_USER $GLANCE_REG_BIN --config-file=$GLANCE_REGISTRY_CONFIG rc_status -v ;; stop) echo -n "Shutting down Glance registry" /sbin/killproc $GLANCE_REG_BIN rc_status -v ;; try-restart|condrestart) if test "$1" = "condrestart"; then echo "${attn} Use try-restart ${done}(LSB)${attn} rather than condrestart ${warn}(RH)${norm}" fi $0 status if test $? = 0; then $0 restart else rc_reset # Not running is not a failure. fi rc_status ;; restart) $0 stop $0 start rc_status ;; force-reload) $0 try-restart rc_status ;; reload) echo -n "Reload service glance-registry " rc_failed 3 rc_status -v ;; status) echo -n "Checking for service glance-registry" /sbin/checkproc $GLANCE_REG_BIN rc_status -v ;; *) echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload}" exit 1 ;; esac rc_exit ++++++ openstack-glance.sh ++++++ # bash completion for openstack glance # by Dominik Heidler <dheidler suse.de> _glance_opts="" # lazy init _glance_opts_exp="" # lazy init _glance() { local cur prev COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" if [ "x$_glance_opts" == "x" ] ; then _glance_opts="`glance bash-completion 2>/dev/null | sed -e '/^\s\s\s\s\w/!d' -e "s/\s*\([a-z0-9_-]*\)\s.*/\1/"`" _glance_opts_exp="`echo $_glance_opts | sed -e "s/\s/|/g"`" fi if [[ ! " ${COMP_WORDS[@]} " =~ " "($_glance_opts_exp)" " || "$prev" == "help" ]] ; then COMPREPLY=($(compgen -W "${_glance_opts}" -- ${cur})) fi return 0 } complete -F _glance glance ++++++ rpmlintrc ++++++ # Bash completion files reside in /etc but are not meant to be configurable: addFilter("non-conffile-in-etc /etc/bash_completion.d/openstack-glance.sh") #TODO: Fix this later on (i.e. SLE-12), Python on SLE-11 is way beyond broken: addFilter("no-binary") # This symling is for the -test package and can be ignored: addFilter("dangling-symlink /var/lib/openstack-glance-test/glance") -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org