From e7cdeab9dee2684c06b3543a482dd44a1db83c16 Mon Sep 17 00:00:00 2001 From: Jan Fajerski Date: Mon, 27 Apr 2020 11:45:26 +0200 Subject: [PATCH] ceph-volume: disk.Size - add cast to bool Signed-off-by: Jan Fajerski --- src/ceph-volume/ceph_volume/util/disk.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/ceph-volume/ceph_volume/util/disk.py b/src/ceph-volume/ceph_volume/util/disk.py index 329915b32944e..e022c9e5126e6 100644 --- a/src/ceph-volume/ceph_volume/util/disk.py +++ b/src/ceph-volume/ceph_volume/util/disk.py @@ -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 -- 2.39.5