summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Grover <agrover@redhat.com>2014-11-13 11:44:11 -0800
committerAndy Grover <agrover@redhat.com>2014-11-13 11:44:11 -0800
commit83f435ba5c52611773a9d5f134c9f69f74f1f22a (patch)
tree8f04198ec181499ff84de5a11e8cb7ff08b5607c
parent1b23a7a8b48f176f749c075a793da1216c05d283 (diff)
downloadrtslib-fb-83f435ba5c52611773a9d5f134c9f69f74f1f22a.tar.gz
Use any() when testing for if an iterable is not empty
This prevents the effort of generating a full list of storage objects or targets just to see if 1 or more exists. Signed-off-by: Andy Grover <agrover@redhat.com>
-rw-r--r--rtslib/root.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/rtslib/root.py b/rtslib/root.py
index 89c515a..301c2b9 100644
--- a/rtslib/root.py
+++ b/rtslib/root.py
@@ -163,7 +163,7 @@ class RTSRoot(CFSNode):
'''
if clear_existing:
self.clear_existing(confirm=True)
- elif list(self.storage_objects) or list(self.targets):
+ elif any(self.storage_objects) or any(self.targets):
raise RTSLibError("storageobjects or targets present, not restoring")
errors = []