summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Grover <agrover@redhat.com>2014-11-20 15:54:11 -0800
committerAndy Grover <agrover@redhat.com>2014-11-20 15:54:11 -0800
commitaa1cb2d5e5852e4a2bc63b66cc8aee18ae062c92 (patch)
tree89e5476133c2b46be84a73f78a22eb675734a739
parent8388ada59fed8c18ce622901d3b4590cc4162d16 (diff)
downloadrtslib-fb-aa1cb2d5e5852e4a2bc63b66cc8aee18ae062c92.tar.gz
Add equality operators for CFSNode
Two rtslib objects can point to the same underlying configfs directory yet be different Python objects. We should consider these equal. Implement __eq__(). Also implement __ne__() because Python does not assume this is the inverse of __eq__(). Signed-off-by: Andy Grover <agrover@redhat.com>
-rw-r--r--rtslib/node.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/rtslib/node.py b/rtslib/node.py
index ed1e10a..3b56486 100644
--- a/rtslib/node.py
+++ b/rtslib/node.py
@@ -33,6 +33,12 @@ class CFSNode(object):
def __init__(self):
self._path = self.configfs_dir
+ def __eq__(self, other):
+ return self._path == other._path
+
+ def __ne__(self, other):
+ return self._path != other._path
+
def _get_path(self):
return self._path