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
This commit is contained in:
Chris Behrens 2012-03-07 22:43:12 -08:00
parent 0193d1253c
commit 1e551c06bc
1 changed files with 11 additions and 6 deletions

View File

@ -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)