Skip to content

Commit

Permalink
fix _safe_stat()
Browse files Browse the repository at this point in the history
It needs to return the stat, and we need to continue if it returns
None.
  • Loading branch information
xylar committed Nov 13, 2024
1 parent 6237841 commit 4a30ebf
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion deploy/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -1181,6 +1181,8 @@ def _update_permissions(options, directories): # noqa: C901
# os.walk()
for directory in directories:
dir_stat = _safe_stat(directory)
if dir_stat is None:
continue

perm = dir_stat.st_mode & mask

Expand Down Expand Up @@ -1220,6 +1222,8 @@ def _update_permissions(options, directories): # noqa: C901
directory = os.path.join(root, directory)

dir_stat = _safe_stat(directory)
if dir_stat is None:
continue

if dir_stat.st_uid != new_uid:
# current user doesn't own this dir so let's move on
Expand All @@ -1244,6 +1248,8 @@ def _update_permissions(options, directories): # noqa: C901
pass
file_name = os.path.join(root, file_name)
file_stat = _safe_stat(file_name)
if file_stat is None:
continue

if file_stat.st_uid != new_uid:
# current user doesn't own this file so let's move on
Expand Down Expand Up @@ -1341,7 +1347,7 @@ def _safe_rmtree(path):

@_ignore_file_errors
def _safe_stat(path):
os.stat(path)
return os.stat(path)


def _discover_machine(quiet=False):
Expand Down

0 comments on commit 4a30ebf

Please sign in to comment.