Cog-Creators / Red-DiscordBot

A multi-function Discord bot
https://docs.discord.red
GNU General Public License v3.0
4.72k stars 2.3k forks source link

Backup does not include list of repos #6288

Open palmtree5 opened 7 months ago

palmtree5 commented 7 months ago

What Red version are you using?

3.5.5

What were you trying to do?

I was in the process of working on #5703 and created a backup in order to work on the restore process

What did you expect to happen?

The repos.json file to be present in the backup

What actually happened?

I opened up the backup to look at the repos file generated to work on restoring the repos and cogs that the repos.json file being created during the backup process was not present in the specified folder

How can we reproduce this error?

  1. Create a backup
  2. Open the backup in something like 7-zip
  3. Navigate to the directory and see the file is missing ...

Anything else?

I believe this to be due to the exclusions, as I ran the code that pulls the list of files to add in an eval and found that the file was not present when I listed the files to be backed up, but was present when listing excluded files.

from pathlib import Path
import os
from redbot.core import data_manager

data_path = Path(data_manager.core_data_path().parent)

exclusions = [
    "__pycache__",
    "Lavalink.jar",
    os.path.join("Downloader", "lib"),
    os.path.join("CogManager", "cogs"),
    os.path.join("RepoManager", "repos"),
    os.path.join("Audio", "logs"),
]

out_list = []
for f in data_path.glob("**/*"):
    if not any(ex in str(f) for ex in exclusions) and f.is_file():
        out_list.append(str(f))
print("\n".join(out_list))

the exclusion in particular of RepoManager/repos is having the effect of excluding RepoManager/repos (the thing intended to be excluded), AND RepoManager/repos.json (which needs to be in the backup)