From d9105f57e1c5dc27c5cd21efa20932cdc9df37fe Mon Sep 17 00:00:00 2001 From: Zane Bitter Date: Fri, 14 Dec 2012 11:05:59 +0100 Subject: [PATCH] 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 --- heat/engine/resources/quantum/floatingip.py | 4 ++++ heat/engine/resources/quantum/net.py | 4 ++++ heat/engine/resources/quantum/port.py | 4 ++++ heat/engine/resources/quantum/router.py | 4 ++++ heat/engine/resources/quantum/subnet.py | 4 ++++ heat/engine/resources/s3.py | 3 +++ 6 files changed, 23 insertions(+) diff --git a/heat/engine/resources/quantum/floatingip.py b/heat/engine/resources/quantum/floatingip.py index 3dbe08d5..298a5a72 100644 --- a/heat/engine/resources/quantum/floatingip.py +++ b/heat/engine/resources/quantum/floatingip.py @@ -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, diff --git a/heat/engine/resources/quantum/net.py b/heat/engine/resources/quantum/net.py index d6efc6e6..d592f5c8 100644 --- a/heat/engine/resources/quantum/net.py +++ b/heat/engine/resources/quantum/net.py @@ -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, } diff --git a/heat/engine/resources/quantum/port.py b/heat/engine/resources/quantum/port.py index a6d65511..abceb95e 100644 --- a/heat/engine/resources/quantum/port.py +++ b/heat/engine/resources/quantum/port.py @@ -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, } diff --git a/heat/engine/resources/quantum/router.py b/heat/engine/resources/quantum/router.py index bebe388d..d7184183 100644 --- a/heat/engine/resources/quantum/router.py +++ b/heat/engine/resources/quantum/router.py @@ -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, diff --git a/heat/engine/resources/quantum/subnet.py b/heat/engine/resources/quantum/subnet.py index ab882419..e00ba2f1 100644 --- a/heat/engine/resources/quantum/subnet.py +++ b/heat/engine/resources/quantum/subnet.py @@ -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, } diff --git a/heat/engine/resources/s3.py b/heat/engine/resources/s3.py index 97bd847e..4ca070f5 100644 --- a/heat/engine/resources/s3.py +++ b/heat/engine/resources/s3.py @@ -123,6 +123,9 @@ class S3Bucket(resource.Resource): def resource_mapping(): + if clients.swiftclient is None: + return {} + return { 'AWS::S3::Bucket': S3Bucket, } -- 2.45.2