]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-volume: disk.Size - add cast to bool
authorJan Fajerski <jfajerski@suse.com>
Mon, 27 Apr 2020 09:45:26 +0000 (11:45 +0200)
committerJan Fajerski <jfajerski@suse.com>
Fri, 25 Sep 2020 09:48:34 +0000 (11:48 +0200)
Signed-off-by: Jan Fajerski <jfajerski@suse.com>
src/ceph-volume/ceph_volume/util/disk.py

index 329915b32944ed3a9ab5c5424429ffa0f92373d8..e022c9e5126e644683d1582d888e93c73149f1b1 100644 (file)
@@ -603,6 +603,12 @@ class Size(object):
         _b = self._b / other
         return Size(b=_b)
 
+    def __bool__(self):
+        return self.b != 0
+
+    def __nonzero__(self):
+        return self.__bool__()
+
     def __getattr__(self, unit):
         """
         Calculate units on the fly, relies on the fact that ``bytes`` has been