simplify cluster existence check in register_container_instance
This commit is contained in:
parent
137791e960
commit
b652256c43
@ -251,10 +251,8 @@ class EC2ContainerServiceBackend(BaseBackend):
|
|||||||
|
|
||||||
def register_container_instance(self, cluster_str, ec2_instance_id):
|
def register_container_instance(self, cluster_str, ec2_instance_id):
|
||||||
cluster_name = cluster_str.split('/')[-1]
|
cluster_name = cluster_str.split('/')[-1]
|
||||||
if cluster_name in self.clusters:
|
if cluster_name not in self.clusters:
|
||||||
cluster = self.clusters[cluster_name]
|
raise Exception("{0} is not a cluster".format(cluster_name))
|
||||||
else:
|
|
||||||
raise Exception("{0} is not a cluster".format(cluster.name))
|
|
||||||
container_instance = ContainerInstance(ec2_instance_id)
|
container_instance = ContainerInstance(ec2_instance_id)
|
||||||
if not self.container_instances.get(cluster_name):
|
if not self.container_instances.get(cluster_name):
|
||||||
self.container_instances[cluster_name] = {}
|
self.container_instances[cluster_name] = {}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user