Skip to content

Commit

Permalink
Fix - Unpublish idempotency and recursive remove_dir
Browse files Browse the repository at this point in the history
*makes Unpublish idempotent by not failing if the target_path does not exists
*changed remove_dir to be non-recursive and the call will fail if there are any files / sub-directories under the path.

Change-Id: I286d27576b81901e0a57566e591686ffa5649c8b
Signed-off-by: Gil <gvitzinger@nvidia.com>
  • Loading branch information
nvgvitzi committed Jun 12, 2023
1 parent 94acf6b commit 842927d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions driver/filesystem_manager.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import logging
import shutil
import os

from grpc import StatusCode

Expand Down Expand Up @@ -126,7 +126,7 @@ def get_fs_type(target_path):

@staticmethod
def remove_dir(dir_path):
return shutil.rmtree(dir_path)
return os.rmdir(dir_path)

@staticmethod
def format_block_device(block_device_path, fs_type, mkfs_options_str):
Expand Down

0 comments on commit 842927d

Please sign in to comment.