diff --git a/plogical/Backupsv2.py b/plogical/Backupsv2.py index 36fe6ce1d..8f7d848ae 100644 --- a/plogical/Backupsv2.py +++ b/plogical/Backupsv2.py @@ -1141,29 +1141,12 @@ team_drive = @staticmethod def DeleteRepoScheduleV2(website, repo, eu): - import shutil try: finalConfigPath = f'/home/{website}/.config/rclone/rclone.conf' if os.path.exists(finalConfigPath): - command = f'cat {finalConfigPath}' - result = ProcessUtilities.outputExecutioner(command, eu) - new_lines = [] - skip_section = False - - for line in result.split('\n'): - if line.strip().startswith('[') and line.strip().endswith(']'): - if line.strip() == f'[{repo}]': - skip_section = True - else: - skip_section = False - - if not skip_section: - new_lines.append(line) - - cmd = f'echo "{new_lines}" > {finalConfigPath}' - result = ProcessUtilities.outputExecutioner(cmd, eu, True) - + command = f"sed -i '/\[{repo}\]/,/^$/d' {finalConfigPath}" + ProcessUtilities.outputExecutioner(command, eu, True) return 1, 'Done'