components/openstack/keystone/patches/02-launchpad-1178740.patch
author Drew Fisher <drew.fisher@oracle.com>
Fri, 13 Jun 2014 09:10:23 -0700
branchs11-update
changeset 3178 77584387a894
permissions -rw-r--r--
PSARC/2014/207 OpenStack Glance Update to Havana PSARC/2014/208 OpenStack Cinder Update to Havana PSARC/2014/209 OpenStack Keystone Update to Havana PSARC/2014/210 OpenStack Nova Update to Havana 18416146 Neutron agents (L3 and DHCP) should cleanup resources when they are disabled 18562372 Failed to create a new project under Horizon 18645763 ZFSSA Cinder Driver support 18686327 evs agent silently ignores user-specified pool allocation ranges 18702697 fibre channel volumes should be supported in the cinder volume driver 18734289 nova won't terminate failed kz deployments 18738371 cinder-volume:setup should account for commented-out zfs_volume_base 18738374 cinder-volume:setup should check for existence of configuration file 18826190 nova-compute fails due to nova.utils.to_bytes 18855698 Update OpenStack to Havana 2013.2.3 18855710 Update python-cinderclient to 1.0.9 18855743 Update python-keystoneclient to 0.8.0 18855754 Update python-neutronclient to 2.3.4 18855764 Update python-novaclient to 2.17.0 18855793 Update python-swiftclient to 2.1.0 18856992 External networks can be deleted even when floating IP addresses are in use 18857784 bake in some more openstack configuration 18884923 Incorrect locale facets in python modules for openstack 18913890 the error in _get_view_and_lun may cause the failure of deleting volumes 18943044 Disable 'Security Groups' tab in Horizon dashboard 18969275 problem in SERVICE/KEYSTONE
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3178
77584387a894 PSARC/2014/207 OpenStack Glance Update to Havana
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
     1
This upstream patch addresses Launchpad bug 1178740. Although it's been
77584387a894 PSARC/2014/207 OpenStack Glance Update to Havana
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
     2
addressed in Icehouse 2014.1, the patch below is still not yet released
77584387a894 PSARC/2014/207 OpenStack Glance Update to Havana
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
     3
for Havana.
77584387a894 PSARC/2014/207 OpenStack Glance Update to Havana
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
     4
77584387a894 PSARC/2014/207 OpenStack Glance Update to Havana
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
     5
commit 4f800bbe7f5ba07895a4cb32c14007e2f1818bd7
77584387a894 PSARC/2014/207 OpenStack Glance Update to Havana
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
     6
Author: Lei Zhang <[email protected]>
77584387a894 PSARC/2014/207 OpenStack Glance Update to Havana
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
     7
Date:   Tue Oct 8 17:40:37 2013 +0800
77584387a894 PSARC/2014/207 OpenStack Glance Update to Havana
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
     8
77584387a894 PSARC/2014/207 OpenStack Glance Update to Havana
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
     9
    remove the nova dependency in the ec2_token middleware
77584387a894 PSARC/2014/207 OpenStack Glance Update to Havana
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    10
    
77584387a894 PSARC/2014/207 OpenStack Glance Update to Havana
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    11
    Change-Id: I34812522b55e38d3ea030638bbae75d65f507c90
77584387a894 PSARC/2014/207 OpenStack Glance Update to Havana
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    12
    Closes-Bug: #1178740
77584387a894 PSARC/2014/207 OpenStack Glance Update to Havana
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    13
77584387a894 PSARC/2014/207 OpenStack Glance Update to Havana
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    14
diff --git a/keystone/middleware/ec2_token.py b/keystone/middleware/ec2_token.py
77584387a894 PSARC/2014/207 OpenStack Glance Update to Havana
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    15
index 0cd5841..4e58eac 100644
77584387a894 PSARC/2014/207 OpenStack Glance Update to Havana
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    16
--- a/keystone/middleware/ec2_token.py
77584387a894 PSARC/2014/207 OpenStack Glance Update to Havana
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    17
+++ b/keystone/middleware/ec2_token.py
77584387a894 PSARC/2014/207 OpenStack Glance Update to Havana
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    18
@@ -25,18 +25,22 @@ Starting point for routing EC2 requests.
77584387a894 PSARC/2014/207 OpenStack Glance Update to Havana
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    19
 import urlparse
77584387a894 PSARC/2014/207 OpenStack Glance Update to Havana
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    20
 
77584387a894 PSARC/2014/207 OpenStack Glance Update to Havana
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    21
 from eventlet.green import httplib
77584387a894 PSARC/2014/207 OpenStack Glance Update to Havana
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    22
+from oslo.config import cfg
77584387a894 PSARC/2014/207 OpenStack Glance Update to Havana
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    23
 import webob.dec
77584387a894 PSARC/2014/207 OpenStack Glance Update to Havana
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    24
 import webob.exc
77584387a894 PSARC/2014/207 OpenStack Glance Update to Havana
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    25
 
77584387a894 PSARC/2014/207 OpenStack Glance Update to Havana
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    26
-from nova import flags
77584387a894 PSARC/2014/207 OpenStack Glance Update to Havana
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    27
-from nova import utils
77584387a894 PSARC/2014/207 OpenStack Glance Update to Havana
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    28
-from nova import wsgi
77584387a894 PSARC/2014/207 OpenStack Glance Update to Havana
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    29
+from keystone.common import config
77584387a894 PSARC/2014/207 OpenStack Glance Update to Havana
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    30
+from keystone.common import wsgi
77584387a894 PSARC/2014/207 OpenStack Glance Update to Havana
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    31
+from keystone.openstack.common import jsonutils
77584387a894 PSARC/2014/207 OpenStack Glance Update to Havana
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    32
 
77584387a894 PSARC/2014/207 OpenStack Glance Update to Havana
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    33
+keystone_ec2_opts = [
77584387a894 PSARC/2014/207 OpenStack Glance Update to Havana
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    34
+    cfg.StrOpt('keystone_ec2_url',
77584387a894 PSARC/2014/207 OpenStack Glance Update to Havana
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    35
+               default='http://localhost:5000/v2.0/ec2tokens',
77584387a894 PSARC/2014/207 OpenStack Glance Update to Havana
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    36
+               help='URL to get token from ec2 request.'),
77584387a894 PSARC/2014/207 OpenStack Glance Update to Havana
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    37
+]
77584387a894 PSARC/2014/207 OpenStack Glance Update to Havana
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    38
 
77584387a894 PSARC/2014/207 OpenStack Glance Update to Havana
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    39
-FLAGS = flags.FLAGS
77584387a894 PSARC/2014/207 OpenStack Glance Update to Havana
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    40
-flags.DEFINE_string('keystone_ec2_url',
77584387a894 PSARC/2014/207 OpenStack Glance Update to Havana
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    41
-                    'http://localhost:5000/v2.0/ec2tokens',
77584387a894 PSARC/2014/207 OpenStack Glance Update to Havana
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    42
-                    'URL to get token from ec2 request.')
77584387a894 PSARC/2014/207 OpenStack Glance Update to Havana
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    43
+CONF = config.CONF
77584387a894 PSARC/2014/207 OpenStack Glance Update to Havana
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    44
+CONF.register_opts(keystone_ec2_opts)
77584387a894 PSARC/2014/207 OpenStack Glance Update to Havana
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    45
 
77584387a894 PSARC/2014/207 OpenStack Glance Update to Havana
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    46
 
77584387a894 PSARC/2014/207 OpenStack Glance Update to Havana
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    47
 class EC2Token(wsgi.Middleware):
77584387a894 PSARC/2014/207 OpenStack Glance Update to Havana
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    48
@@ -67,13 +71,13 @@ class EC2Token(wsgi.Middleware):
77584387a894 PSARC/2014/207 OpenStack Glance Update to Havana
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    49
                 'params': auth_params,
77584387a894 PSARC/2014/207 OpenStack Glance Update to Havana
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    50
             }
77584387a894 PSARC/2014/207 OpenStack Glance Update to Havana
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    51
         }
77584387a894 PSARC/2014/207 OpenStack Glance Update to Havana
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    52
-        creds_json = utils.dumps(creds)
77584387a894 PSARC/2014/207 OpenStack Glance Update to Havana
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    53
+        creds_json = jsonutils.dumps(creds)
77584387a894 PSARC/2014/207 OpenStack Glance Update to Havana
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    54
         headers = {'Content-Type': 'application/json'}
77584387a894 PSARC/2014/207 OpenStack Glance Update to Havana
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    55
 
77584387a894 PSARC/2014/207 OpenStack Glance Update to Havana
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    56
         # Disable 'has no x member' pylint error
77584387a894 PSARC/2014/207 OpenStack Glance Update to Havana
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    57
         # for httplib and urlparse
77584387a894 PSARC/2014/207 OpenStack Glance Update to Havana
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    58
         # pylint: disable-msg=E1101
77584387a894 PSARC/2014/207 OpenStack Glance Update to Havana
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    59
-        o = urlparse.urlparse(FLAGS.keystone_ec2_url)
77584387a894 PSARC/2014/207 OpenStack Glance Update to Havana
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    60
+        o = urlparse.urlparse(CONF.keystone_ec2_url)
77584387a894 PSARC/2014/207 OpenStack Glance Update to Havana
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    61
         if o.scheme == 'http':
77584387a894 PSARC/2014/207 OpenStack Glance Update to Havana
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    62
             conn = httplib.HTTPConnection(o.netloc)
77584387a894 PSARC/2014/207 OpenStack Glance Update to Havana
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    63
         else:
77584387a894 PSARC/2014/207 OpenStack Glance Update to Havana
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    64
@@ -86,7 +90,7 @@ class EC2Token(wsgi.Middleware):
77584387a894 PSARC/2014/207 OpenStack Glance Update to Havana
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    65
         #             having keystone return token, tenant,
77584387a894 PSARC/2014/207 OpenStack Glance Update to Havana
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    66
         #             user, and roles from this call.
77584387a894 PSARC/2014/207 OpenStack Glance Update to Havana
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    67
 
77584387a894 PSARC/2014/207 OpenStack Glance Update to Havana
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    68
-        result = utils.loads(response)
77584387a894 PSARC/2014/207 OpenStack Glance Update to Havana
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    69
+        result = jsonutils.loads(response)
77584387a894 PSARC/2014/207 OpenStack Glance Update to Havana
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    70
         try:
77584387a894 PSARC/2014/207 OpenStack Glance Update to Havana
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    71
             token_id = result['access']['token']['id']
77584387a894 PSARC/2014/207 OpenStack Glance Update to Havana
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    72
         except (AttributeError, KeyError):