summaryrefslogtreecommitdiffstats
path: root/deploy/post/glance.py
diff options
context:
space:
mode:
authorSerenaFeng <feng.xiaowei@zte.com.cn>2017-03-16 16:59:48 +0800
committerSerena Feng <feng.xiaowei@zte.com.cn>2017-03-23 06:26:26 +0000
commit84b0be2e12d83a48ac15b3e4f457b7e7fb465735 (patch)
tree420116aae0aa45dd6864b29da96b7be7838b0ae9 /deploy/post/glance.py
parent8eeced263cd35000623a69243766f0970055da69 (diff)
simplify get_xx process using query.find()
Change-Id: I2a911fc15c1456b409db840b9ae76c04a23d449d Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>
Diffstat (limited to 'deploy/post/glance.py')
-rw-r--r--deploy/post/glance.py7
1 files changed, 2 insertions, 5 deletions
diff --git a/deploy/post/glance.py b/deploy/post/glance.py
index 7ea4b51d..4171c8a8 100644
--- a/deploy/post/glance.py
+++ b/deploy/post/glance.py
@@ -10,6 +10,7 @@ import os
import glanceclient
+from deploy.common import query
import keystoneauth
@@ -35,11 +36,7 @@ class Glance(keystoneauth.Keystoneauth):
return id
def get_by_name(self, name):
- for image in self.list():
- if image.name == name:
- return image.id
-
- return None
+ return query.find(lambda image: image.name == name, self.list())
def list(self):
return self.controller.list()