from novaclient.v1_1 import client as nc
from keystoneclient.v2_0 import client as kc
-from swiftclient import client as swiftclient
+
+# swiftclient not available in all distributions - make s3 an optional
+# feature
+try:
+ from swiftclient import client as swiftclient
+ swiftclient_present = True
+except:
+ swiftclient_present = False
from heat.common import exception
from heat.common import config
return self._nova[service_type]
def swift(self):
+ if swiftclient_present == False:
+ return None
if self._swift:
return self._swift
from heat.common import exception
from heat.engine.resources import Resource
from heat.openstack.common import log as logging
-from swiftclient.client import ClientException
+try:
+ from swiftclient.client import ClientException
+ swiftclient_present = True
+except:
+ swiftclient_present = False
logger = logging.getLogger('heat.engine.s3')
def __init__(self, name, json_snippet, stack):
super(S3Bucket, self).__init__(name, json_snippet, stack)
+ def validate(self):
+ '''
+ Validate any of the provided params
+ '''
+ #check if swiftclient is installed
+ if swiftclient_present == False:
+ return {'Error':
+ 'S3 services unavaialble because of missing swiftclient.'}
+
def handle_create(self):
"""Create a bucket."""
container = 'heat-%s-%s' % (self.name,