[Audio] Rename current_build to current_version in Config #2219

Merged
Tobotimus merged 2 commits from V3/bugfix/audio_build_config into V3/release/3.0.0 2018-10-11 03:02:02 +02:00
Tobotimus commented 2018-10-10 04:09:56 +02:00 (Migrated from github.com)

The change introduced in #2201 caused the following traceback for users who hadn't previously loaded audio whilst on 3.0.0rc1.post1.

Exception during loading of cog
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/redbot/core/core_commands.py", line 104, in _load
    await bot.load_extension(spec)
  File "/usr/local/lib/python3.7/dist-packages/redbot/core/bot.py", line 228, in load_extension
    await lib.setup(self)
  File "/usr/local/lib/python3.7/dist-packages/redbot/cogs/audio/__init__.py", line 52, in setup
    await maybe_download_lavalink(bot.loop, cog)
  File "/usr/local/lib/python3.7/dist-packages/redbot/cogs/audio/__init__.py", line 37, in maybe_download_lavalink
    current_build = redbot.core.VersionInfo.from_json(await cog.config.current_build())
  File "/usr/local/lib/python3.7/dist-packages/redbot/core/config.py", line 195, in _get
    return self.nested_update(raw, default)
  File "/usr/local/lib/python3.7/dist-packages/redbot/core/config.py", line 418, in nested_update
    for key, value in current.items():
AttributeError: 'list' object has no attribute 'items'

As a fix, I've simply renamed the current_build key to current_version. This means the current_version key will always be a dict and never a list, and current_build having no defaults means it won't mess with [p]audioset settings.

The change introduced in #2201 caused the following traceback for users who hadn't previously loaded audio whilst on 3.0.0rc1.post1. ```py Exception during loading of cog Traceback (most recent call last): File "/usr/local/lib/python3.7/dist-packages/redbot/core/core_commands.py", line 104, in _load await bot.load_extension(spec) File "/usr/local/lib/python3.7/dist-packages/redbot/core/bot.py", line 228, in load_extension await lib.setup(self) File "/usr/local/lib/python3.7/dist-packages/redbot/cogs/audio/__init__.py", line 52, in setup await maybe_download_lavalink(bot.loop, cog) File "/usr/local/lib/python3.7/dist-packages/redbot/cogs/audio/__init__.py", line 37, in maybe_download_lavalink current_build = redbot.core.VersionInfo.from_json(await cog.config.current_build()) File "/usr/local/lib/python3.7/dist-packages/redbot/core/config.py", line 195, in _get return self.nested_update(raw, default) File "/usr/local/lib/python3.7/dist-packages/redbot/core/config.py", line 418, in nested_update for key, value in current.items(): AttributeError: 'list' object has no attribute 'items' ``` As a fix, I've simply renamed the `current_build` key to `current_version`. This means the `current_version` key will always be a dict and never a list, and `current_build` having no defaults means it won't mess with `[p]audioset settings`.
tekulvw (Migrated from github.com) reviewed 2018-10-10 04:09:56 +02:00
Tobotimus commented 2018-10-10 04:24:36 +02:00 (Migrated from github.com)

Also included, is a change to config.Group.__call__ (and, by extension, Group.config.all()) so that the retrieved value is not updated with defaults if it is not a dict.

Also included, is a change to `config.Group.__call__` (and, by extension, `Group.config.all()`) so that the retrieved value is not updated with defaults if it is not a dict.
mikeshardmind commented 2018-10-11 02:01:06 +02:00 (Migrated from github.com)

Can confirm this fixes the issue.

For anyone not content to wait who is impacted:

[p]eval
from redbot.core.config import Config
aconfig = Config.get_conf(None, identifier=2711759130, cog_name="Audio")
await aconfig.current_build.clear()

Will resolve this for RC1, but requires eval enabled.

Can confirm this fixes the issue. For anyone not content to wait who is impacted: ``` [p]eval from redbot.core.config import Config aconfig = Config.get_conf(None, identifier=2711759130, cog_name="Audio") await aconfig.current_build.clear() ``` Will resolve this for RC1, but requires eval enabled.
Sign in to join this conversation.
No reviewers
No labels
Automated PR
Blocked
Blocked By: Damage Control
Blocked By: Dependency
Blocked By: Other PR
Breaking Change
Category: CI
Category: Cogs - Admin
Category: Cogs - Alias
Category: Cogs - Audio
Category: Cogs - Bank
Category: Cogs - Cleanup
Category: Cogs - CustomCommands
Category: Cogs - Dev
Category: Cogs - Downloader
Category: Cogs - Economy
Category: Cogs - Filter
Category: Cogs - General
Category: Cogs - Image
Category: Cogs - Mod
Category: Cogs - Modlog
Category: Cogs - Mutes
Category: Cogs - Permissions
Category: Cogs - Reports
Category: Cogs - Streams
Category: Cogs - Trivia
Category: Cogs - Trivia - Lists
Category: Cogs - Warnings
Category: Core - API - App Commands Package
Category: Core - API - Audio
Category: Core - API - Bank
Category: Core - API - Commands Package
Category: Core - API - Config
Category: Core - API - Other
Category: Core - API - Utils Package
Category: Core - Bot Class
Category: Core - Bot Commands
Category: Core - Command-line Interfaces
Category: Core - Downloader
Category: Core - Help
Category: Core - i18n
Category: Core - Modlog
Category: Core - Other Internals
Category: Core - RPC/ZMQ
Category: Docker
Category: Docs - Changelogs
Category: Docs - For Developers
Category: Docs - Install Guides
Category: Docs - Other
Category: Docs - User Guides
Category: Meta
Category: RPC/ZMQ methods
Category: Vendored Packages
Changelog Entry: Added
Changelog Entry: Pending
Changelog Entry: Skipped
Closed: Duplicate
Closed: External
Closed: Invalid
Closed: User Error
Closed: Won't Fix
Complex Issue
Docs-only
Feature Branch
Good First Issue
Help Wanted
High Priority
Needs Backport To stable-docs
No Activity
No Repro
QA: Bypassed
QA: Changes Requested
QA: Passed
Release Blocker
Status: Accepted
Status: Frozen
Status: In Progress
Status: Needs Discussion
Status: Needs Info
Status: Needs Triage
Status: PRs Welcome
Type: Bug
Type: Dependency Update
Type: Deprecation
Type: Enhancement
Type: Feature
Type: Informational
Type: Merge
Type: Optimisation
Type: Question
Type: Removal
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Mrcoolgamer11/Red-DiscordBot!2219
No description provided.