Lint fixes

ticket-769
Vadim vtroshchinskiy 2024-10-08 13:54:22 +02:00
parent 2d40e2fb93
commit 4f4ad2cfd7
1 changed files with 9 additions and 10 deletions

View File

@ -419,7 +419,7 @@ class OpengnsysGitLibrary:
def _write_ignore_list(self, base_path): def _write_ignore_list(self, base_path):
ignore_file = base_path + "/.gitignore" ignore_file = base_path + "/.gitignore"
self.logger.debug("Creating ignore list: " + ignore_file) self.logger.debug("Creating ignore list: %s", ignore_file)
with open(ignore_file, 'w', encoding='utf-8') as f: with open(ignore_file, 'w', encoding='utf-8') as f:
f.write("\n".join(self.default_ignore_list)) f.write("\n".join(self.default_ignore_list))
f.write("\n") f.write("\n")
@ -587,7 +587,6 @@ class OpengnsysGitLibrary:
elif os.path.exists("/usr/sbin/grub-install"): elif os.path.exists("/usr/sbin/grub-install"):
self.logger.debug("Installing Grub 1.x") self.logger.debug("Installing Grub 1.x")
root = ""
result = subprocess.run(["/usr/sbin/grub-install", "--force", "--root-directory", root_directory, boot_device], check = True, capture_output=True) result = subprocess.run(["/usr/sbin/grub-install", "--force", "--root-directory", root_directory, boot_device], check = True, capture_output=True)
self.logger.debug(f"retorno: {result.returncode}") self.logger.debug(f"retorno: {result.returncode}")
self.logger.debug(f"stdout: {result.stdout}") self.logger.debug(f"stdout: {result.stdout}")
@ -723,7 +722,7 @@ class OpengnsysGitLibrary:
# Run the temporary file # Run the temporary file
command = [temp_file.name] + arguments command = [temp_file.name] + arguments
self.logger.debug(f"Running: {command} {arguments}") self.logger.debug(f"Running: {command} {arguments}")
result = subprocess.run(command, shell=False, capture_output=True, text=True) result = subprocess.run(command, shell=False, capture_output=True, text=True, check=True)
output = result.stdout.strip() output = result.stdout.strip()
self.logger.debug(f"STDOUT: {output}") self.logger.debug(f"STDOUT: {output}")
@ -1320,7 +1319,7 @@ class OpengnsysGitLibrary:
self._mount(device, path) self._mount(device, path)
self.logger.info("Initializing repository: " + path) self.logger.info("Initializing repository: %s", path)
git_dir = os.path.join(path, ".git") git_dir = os.path.join(path, ".git")
real_git_dir = os.path.join(self.cache_dir, f"git-{repo_name}") real_git_dir = os.path.join(self.cache_dir, f"git-{repo_name}")
@ -1393,7 +1392,7 @@ class OpengnsysGitLibrary:
add_files = add_files_new add_files = add_files_new
self.logger.info("Adding %d files" % len(add_files)) self.logger.info("Adding %d files", len(add_files))
with OperationTimer(self, "add all files"): with OperationTimer(self, "add all files"):
#subprocess.run(["git", "add"] + add_files, check=True, cwd=path) #subprocess.run(["git", "add"] + add_files, check=True, cwd=path)
repo.index.add(items = add_files, force=True ) repo.index.add(items = add_files, force=True )
@ -1406,7 +1405,7 @@ class OpengnsysGitLibrary:
untracked_list = repo.untracked_files untracked_list = repo.untracked_files
if untracked_list: if untracked_list:
self.logger.warning(f"Untracked files: {untracked_list}") self.logger.warning(f"Untracked files: {untracked_list}")
self.logger.warning("Adding %d untracked files" % len(untracked_list)) self.logger.warning("Adding %d untracked files", len(untracked_list))
#repo.index.add(items = untracked_list, force=True) #repo.index.add(items = untracked_list, force=True)
subprocess.run(["git", "add"] + untracked_list, check=True, cwd=path) subprocess.run(["git", "add"] + untracked_list, check=True, cwd=path)
@ -1663,13 +1662,13 @@ if __name__ == '__main__':
with OperationTimer(og_git, "git pull"): with OperationTimer(og_git, "git pull"):
og_git.pullRepo(args.pull) og_git.pullRepo(args.pull)
elif args.test_metadata: elif args.test_metadata:
og_git._create_metadata(args.test_metadata) og_git._create_metadata(args.test_metadata) # pylint: disable=protected-access
elif args.test_restore_metadata: elif args.test_restore_metadata:
og_git._restore_metadata(args.test_restore_metadata) og_git._restore_metadata(args.test_restore_metadata) # pylint: disable=protected-access
elif args.test_restore_metadata_destructive: elif args.test_restore_metadata_destructive:
og_git._restore_metadata(path = args.test_restore_metadata_destructive, destructive_only=True) og_git._restore_metadata(path = args.test_restore_metadata_destructive, destructive_only=True) # pylint: disable=protected-access
elif args.test_clone_metadata: elif args.test_clone_metadata:
og_git._get_repo_metadata(args.test_clone_metadata) og_git._get_repo_metadata(args.test_clone_metadata) # pylint: disable=protected-access
else: else:
print("Debe especificar una acción") print("Debe especificar una acción")
# #