SFUAnime / Ren

As a mascot for the SFU Anime Club, Ren is our in-house Discord bot. Includes first/third party modules that are in use.
GNU General Public License v3.0
19 stars 21 forks source link

[Tags] `PermissionsError` when Ren runs in Docker container #638

Closed quachtridat closed 1 year ago

quachtridat commented 1 year ago

Summary

Upon invocation of [p]tag add test https://www.google.com, Docker Compose logger prints:

ren  | discord.ext.commands.errors.CommandInvokeError: Command raised an exception: PermissionError: [Errno 13] Permission denied: '84f4e12f-9800-4e24-a760-f2b487f19409-tags.json.tmp'

Reproduction

  1. Set up Docker with Ren as instructed by https://github.com/SFUAnime/docker-ren.git
  2. Load cog tags.
  3. Do the command above (or basically any command that invokes creating/updating/deleting a tag).

Proposed fix

Instead of https://github.com/SFUAnime/Ren/blob/249f5ea30a85f566e5c2ee0405f615820f038bb0/cogs/tags/config.py#L39 we should make sure this file is written to self.directory (i.e., the cog data path managed by the bot) which is always writable by cogs).

Note

This issue was known during the previous Ren bot Docker preparation session and a fix was already posted (#637). This was also noted in https://u.sfuani.me/rendockermigration.