[node-patches] Change in ovirt-node[master]: utils_fs: fix _add_path_entry not to add duplicates
asegurap at redhat.com
asegurap at redhat.com
Thu Jul 3 19:55:56 UTC 2014
Antoni Segura Puimedon has uploaded a new change for review.
Change subject: utils_fs: fix _add_path_entry not to add duplicates
......................................................................
utils_fs: fix _add_path_entry not to add duplicates
_del_path_entry correctly strips the entries in /config/files to do
the matching against the path to persist. However, _add_path_entry
was missing this step, resulting in never matching. This patch
addresses the issue.
Change-Id: Ic3806ef126e1445853938c383d16cc116c553309
Signed-off-by: Antoni S. Puimedon <asegurap at redhat.com>
---
M src/ovirt/node/utils/fs/__init__.py
1 file changed, 4 insertions(+), 5 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/71/29571/1
diff --git a/src/ovirt/node/utils/fs/__init__.py b/src/ovirt/node/utils/fs/__init__.py
index 0f357ad..10dca29 100644
--- a/src/ovirt/node/utils/fs/__init__.py
+++ b/src/ovirt/node/utils/fs/__init__.py
@@ -496,7 +496,7 @@
"""
with open(self.path_entries) as path_entries:
for entry in path_entries:
- yield entry
+ yield entry.strip()
def _add_path_entry(self, abspath):
"""Adds abspath to /config/files
@@ -513,11 +513,10 @@
def _del_path_entry(self, abspath):
"""Removes a path entry from the /config/files entries
"""
- matches = (entry for entry in [e.strip() for e in
- self._persisted_path_entries()] if
- entry != abspath)
+ filtered = '\n'.join(entry for entry in self._persisted_path_entries()
+ if entry != abspath)
with open(self.path_entries, 'w') as path_entries:
- print('\n'.join(matches), file=path_entries)
+ print(filtered, file=path_entries)
def unpersist(self, path):
"""Remove the persistent version of a file and remove the bind mount
--
To view, visit http://gerrit.ovirt.org/29571
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic3806ef126e1445853938c383d16cc116c553309
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Antoni Segura Puimedon <asegurap at redhat.com>
More information about the node-patches
mailing list