From 985eae66ce5a56c7086ec43edfc71979b4be47de Mon Sep 17 00:00:00 2001 From: Chris Behrens Date: Wed, 7 Mar 2012 22:43:12 -0800 Subject: [PATCH] boto shouldn't be required for production deploys ... if you're not using ec2/s3. Fixes bug 949631 bin/nova-manage imports auth.manager which imports auth.signer which tries to import boto... but nova-manage doesn't try to authenticate. This patch allows bin/nova-manage to work if you don't have boto installed. Change-Id: I9b7929a15b991498ab0491821521ec20ed0da65c --- nova/auth/signer.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/nova/auth/signer.py b/nova/auth/signer.py index cd4c7e253..1b351457b 100644 --- a/nova/auth/signer.py +++ b/nova/auth/signer.py @@ -48,12 +48,15 @@ import hashlib import hmac import urllib -# NOTE(vish): for new boto -import boto -# for boto.utils -import boto.provider -# NOTE(vish): for old boto -import boto.utils +try: + # NOTE(vish): for new boto + import boto + # for boto.utils + import boto.provider + # NOTE(vish): for old boto + import boto.utils +except ImportError: + boto = None from nova import exception from nova import log as logging @@ -74,6 +77,8 @@ class Signer(object): def s3_authorization(self, headers, verb, path): """Generate S3 authorization string.""" + if not boto: + raise exception.Error('boto is not installed') c_string = boto.utils.canonical_string(verb, path, headers) hmac_copy = self.hmac.copy() hmac_copy.update(c_string)