Catch directories we can not change ownership
When there is a directory where the owner can not be changed, we
fail and do not proceed to check the remaining directories. This
has been seen where netapp creates a special .snapshot directory
which is protected and visible when useing NFSv3, not visible
when using NFSv4.
This change catches the error and proceeds.
Change-Id: I2e61030c863041cd73cb204e31e423da3c6f6944
Resolves-Bug: 1814260
(cherry picked from commit 8981548575
)
This commit is contained in:
parent
ea6fc8f95d
commit
11b135e7d3
|
@ -64,8 +64,12 @@ class PathManager(object):
|
|||
self.gid,
|
||||
self.uid if target_uid == -1 else target_uid,
|
||||
self.gid if target_gid == -1 else target_gid)
|
||||
os.chown(self.path, target_uid, target_gid)
|
||||
self._update()
|
||||
try:
|
||||
os.chown(self.path, target_uid, target_gid)
|
||||
self._update()
|
||||
except Exception:
|
||||
LOG.exception('Could not change ownership of %s:',
|
||||
self.path)
|
||||
else:
|
||||
LOG.info('Ownership of %s already %d:%d',
|
||||
self.path,
|
||||
|
|
Loading…
Reference in New Issue