Make resource registration conditional

If client libraries are not present for Swift or Quantum, don't register
the corresponding resource types.

Change-Id: I95a42973775b7f4c1d82caa47dc0660dfe54bb21
Signed-off-by: Zane Bitter <zbitter@redhat.com>
This commit is contained in:
Zane Bitter 2012-12-14 11:05:59 +01:00
parent 19402ffe80
commit d9105f57e1
6 changed files with 23 additions and 0 deletions

View File

@ -13,6 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from heat.engine import clients
from heat.openstack.common import log as logging
from heat.engine.resources.quantum import quantum
@ -72,6 +73,9 @@ class FloatingIPAssociation(quantum.QuantumResource):
def resource_mapping():
if clients.quantumclient is None:
return {}
return {
'OS::Quantum::FloatingIP': FloatingIP,
'OS::Quantum::FloatingIPAssociation': FloatingIPAssociation,

View File

@ -13,6 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from heat.engine import clients
from heat.openstack.common import log as logging
from heat.engine.resources.quantum import quantum
@ -46,6 +47,9 @@ class Net(quantum.QuantumResource):
def resource_mapping():
if clients.quantumclient is None:
return {}
return {
'OS::Quantum::Net': Net,
}

View File

@ -13,6 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from heat.engine import clients
from heat.openstack.common import log as logging
from heat.engine.resources.quantum import quantum
@ -59,6 +60,9 @@ class Port(quantum.QuantumResource):
def resource_mapping():
if clients.quantumclient is None:
return {}
return {
'OS::Quantum::Port': Port,
}

View File

@ -13,6 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from heat.engine import clients
from heat.engine.resources.quantum import quantum
from heat.openstack.common import log as logging
@ -94,6 +95,9 @@ class RouterGateway(quantum.QuantumResource):
def resource_mapping():
if clients.quantumclient is None:
return {}
return {
'OS::Quantum::Router': Router,
'OS::Quantum::RouterInterface': RouterInterface,

View File

@ -13,6 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from heat.engine import clients
from heat.openstack.common import log as logging
from heat.engine.resources.quantum import quantum
@ -65,6 +66,9 @@ class Subnet(quantum.QuantumResource):
def resource_mapping():
if clients.quantumclient is None:
return {}
return {
'OS::Quantum::Subnet': Subnet,
}

View File

@ -123,6 +123,9 @@ class S3Bucket(resource.Resource):
def resource_mapping():
if clients.swiftclient is None:
return {}
return {
'AWS::S3::Bucket': S3Bucket,
}