]> git.apps.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, 2 Oct 2020 07:46:25 +0000 (09:46 +0200)
Signed-off-by: Jan Fajerski <jfajerski@suse.com>
(cherry picked from commit e7cdeab9dee2684c06b3543a482dd44a1db83c16)

src/ceph-volume/ceph_volume/util/disk.py

index 9874a2dc35850d731a91e7eafbb82904b28af63f..7325a25580ce902cb44a8cb083e72809cc3bfcea 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