From 5326d7f76b48e93bd74d9539febe1f41bbf3f286 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Wed, 28 Jul 2010 22:41:49 -0700 Subject: Fix deprecation warning in AuthManager. __new__ isn't allowed to take args. --- nova/auth/manager.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'nova/auth') diff --git a/nova/auth/manager.py b/nova/auth/manager.py index 2da53a736..2360c1a5c 100644 --- a/nova/auth/manager.py +++ b/nova/auth/manager.py @@ -24,7 +24,6 @@ import logging import os import shutil import string -import sys import tempfile import uuid import zipfile @@ -322,11 +321,10 @@ class AuthManager(object): need to be more accessible, such as vpn ips and ports. """ _instance=None - def __new__(cls, *args, **kwargs): + def __new__(cls): """Returns the AuthManager singleton""" if not cls._instance: - cls._instance = super(AuthManager, cls).__new__( - cls, *args, **kwargs) + cls._instance = super(AuthManager, cls).__new__(cls) return cls._instance def __init__(self, driver=None, *args, **kwargs): -- cgit From f8e7f79833b545a2812d0161f769271621fdf33c Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Wed, 28 Jul 2010 23:19:07 -0700 Subject: oops retry and add extra exception check --- nova/auth/manager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'nova/auth') diff --git a/nova/auth/manager.py b/nova/auth/manager.py index 2360c1a5c..b690176bb 100644 --- a/nova/auth/manager.py +++ b/nova/auth/manager.py @@ -321,7 +321,7 @@ class AuthManager(object): need to be more accessible, such as vpn ips and ports. """ _instance=None - def __new__(cls): + def __new__(cls, *args, **kwargs): """Returns the AuthManager singleton""" if not cls._instance: cls._instance = super(AuthManager, cls).__new__(cls) -- cgit From fc433987e6adbca086bd2fa3d416658e9d3f04ba Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Thu, 29 Jul 2010 17:10:28 -0700 Subject: boto.utils import doesn't work with new boto, import boto instead --- nova/auth/signer.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'nova/auth') diff --git a/nova/auth/signer.py b/nova/auth/signer.py index 7d7471575..3b9bc8f2c 100644 --- a/nova/auth/signer.py +++ b/nova/auth/signer.py @@ -34,7 +34,7 @@ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- # ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT -# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # IN THE SOFTWARE. @@ -48,7 +48,7 @@ import hashlib import hmac import logging import urllib -import boto.utils +import boto from nova.exception import Error -- cgit From 1934cbb0413f074213b1aeeda605d9b49055c581 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Fri, 30 Jul 2010 15:19:41 -0700 Subject: Fixes access key passing in curl statement. --- nova/auth/manager.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'nova/auth') diff --git a/nova/auth/manager.py b/nova/auth/manager.py index 2da53a736..ca9f4fc86 100644 --- a/nova/auth/manager.py +++ b/nova/auth/manager.py @@ -419,6 +419,10 @@ class AuthManager(object): raise exception.NotAuthorized('Signature does not match') return (user, project) + def get_access_key(self, user, project): + """Get an access key that includes user and project""" + return "%s:%s" % (User.safe_id(user), Project.safe_id(project)) + def is_superuser(self, user): """Checks for superuser status, allowing user to bypass rbac -- cgit From 490a97783b97c5753692099c4d7f609e29a8f74e Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Fri, 30 Jul 2010 15:36:11 -0700 Subject: use user.access instead of user.id --- nova/auth/manager.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'nova/auth') diff --git a/nova/auth/manager.py b/nova/auth/manager.py index ca9f4fc86..bf3a3556d 100644 --- a/nova/auth/manager.py +++ b/nova/auth/manager.py @@ -421,7 +421,9 @@ class AuthManager(object): def get_access_key(self, user, project): """Get an access key that includes user and project""" - return "%s:%s" % (User.safe_id(user), Project.safe_id(project)) + if not isinstance(user, User): + user = self.get_user(user) + return "%s:%s" % (user.access, Project.safe_id(project)) def is_superuser(self, user): """Checks for superuser status, allowing user to bypass rbac -- cgit From 04d6595d9b4c77f1fcaf01a7763caf11046ab164 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Fri, 30 Jul 2010 16:15:09 -0700 Subject: another try on fix boto --- nova/auth/signer.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'nova/auth') diff --git a/nova/auth/signer.py b/nova/auth/signer.py index 3b9bc8f2c..634f22f0d 100644 --- a/nova/auth/signer.py +++ b/nova/auth/signer.py @@ -48,7 +48,8 @@ import hashlib import hmac import logging import urllib -import boto +import boto # NOTE(vish): for new boto +import boto.utils # NOTE(vish): for old boto from nova.exception import Error -- cgit