From c7aef57f897ae09b99f16eaf6552b390524ddbbd Mon Sep 17 00:00:00 2001 From: Vadim Troshchinskiy Date: Wed, 9 Oct 2024 16:23:38 +0200 Subject: [PATCH] Pylint fixes --- gitlib/gitlib.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/gitlib/gitlib.py b/gitlib/gitlib.py index 7346d94..d02be55 100755 --- a/gitlib/gitlib.py +++ b/gitlib/gitlib.py @@ -219,7 +219,7 @@ class NTFSLibrary: self.logger.info(f"Changing UUID on {device} to {uuid}") with open(device, 'r+b') as ntfs_dev: ntfs_dev.seek(ntfs_uuid_offset) - prev_uuid = ntfs_dev.read(ntfs_uuid_length) + #prev_uuid = ntfs_dev.read(ntfs_uuid_length) #prev_uuid_hex = self._bin_to_hex(prev_uuid) #self.logger.debug(f"Previous UUID: {prev_uuid_hex}") @@ -525,7 +525,7 @@ class OpengnsysGitLibrary: self.logger.debug(f"Re-creating lost+found in {path}") os.chdir(path) result = subprocess.run(["/usr/sbin/mklost+found"], check=True, capture_output=True) - except Exception as e: + except subprocess.SubprocessError as e: self.logger.warning(f"Error running mklost+found: {e}") if result: @@ -567,7 +567,7 @@ class OpengnsysGitLibrary: fs_type = data["type"] fs_uuid = data["uuid"] - self.logger.debug(f"Creating filesystem {fs_type} with UUID {fs_uuid} in {dest_device}") + self.logger.info(f"Creating filesystem {fs_type} with UUID {fs_uuid} in {dest_device}") if fs_type == "ntfs" or fs_type == "ntfs3": self.logger.debug("Creating NTFS filesystem") @@ -705,7 +705,7 @@ class OpengnsysGitLibrary: os.unlink(file_path) elif os.path.isdir(file_path): shutil.rmtree(file_path) - except Exception as e: + except OSError as e: self.logger.warning('Failed to delete %s. Error: %s', file_path, e) @@ -1142,7 +1142,7 @@ class OpengnsysGitLibrary: """ self.logger.debug("Initializing") - mounts = self._parse_mounts() + self.mounts = self._parse_mounts() self.logger.info(f"Restoring metadata in {path}") meta_dir = os.path.join(path, ".opengnsys-metadata") @@ -1360,7 +1360,7 @@ class OpengnsysGitLibrary: self._mount(device, path) self.logger.debug("Successfully mounted at %s", path) - return path + return path def initRepo(self, device, repo_name): """ @@ -1566,7 +1566,7 @@ class OpengnsysGitLibrary: self.logger.info("Cloning repository from %s", repo_url) - repo = git.Repo.clone_from(repo_url, destination_dir, multi_options = [f"--separate-git-dir={real_git_dir}"]) + repo = git.Repo.clone_from(repo_url, destination_dir, multi_options = [f"--separate-git-dir={real_git_dir}"], progress=OgProgressPrinter(self.logger)) if repo_is_efi: self._efi_install(boot_device, destination_dir)