Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

buildarr sonarr dump-config does not output the type field for some resource types #62

Open
Callum027 opened this issue Apr 21, 2024 · 2 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@Callum027
Copy link
Member

Callum027 commented Apr 21, 2024

Discussed in buildarr/buildarr#195.

This is happening because the type field is not being explicitly defined on remotely fetched Indexer objects.

buildarr_sonarr/config/indexers.py:195-207

Confirmed broken for:

  • Indexers
  • Notification connections
@Callum027 Callum027 added the bug Something isn't working label Apr 21, 2024
@Callum027 Callum027 added this to the v0.7.0 milestone Apr 21, 2024
@Callum027 Callum027 self-assigned this Apr 21, 2024
@Callum027 Callum027 changed the title buildarr sonarr dump-config does not output the type field for indexers buildarr sonarr dump-config does not output the type field for some resource types Apr 21, 2024
@EnjoyBacon7
Copy link

This is also an issue for download clients and connections ("connect"). Sadly, I suppose this makes Buildarr unusable here.

@skwort
Copy link

skwort commented Feb 23, 2025

I ran into this issue today. I ran my patched dump-config for my Sonarr instance and it did not output a type field for my indexer or download client settings resulting in the error message below.

pydantic.error_wrappers.ValidationError: 4 validation errors for Config
sonarr -> settings -> indexers -> definitions -> Anidex (Prowlarr)
  Discriminator 'type' is missing in value (type=value_error.discriminated_union.missing_discriminator; discriminator_key=type)
sonarr -> settings -> indexers -> definitions -> Nyaa.si (Prowlarr)
  Discriminator 'type' is missing in value (type=value_error.discriminated_union.missing_discriminator; discriminator_key=type)
sonarr -> settings -> indexers -> definitions -> TheRARBG (Prowlarr)
  Discriminator 'type' is missing in value (type=value_error.discriminated_union.missing_discriminator; discriminator_key=type)
sonarr -> settings -> download_clients -> definitions -> qBittorrent
  Discriminator 'type' is missing in value (type=value_error.discriminated_union.missing_discriminator; discriminator_key=type)

I was able to mitigate this for the Indexer and DownloadClient types by patching the code as follows:

diff --git a/buildarr_sonarr/config/download_clients/download_clients.py b/buildarr_sonarr/config/download_clients/download_clients.py
index 5243e51..8e72735 100644
--- a/buildarr_sonarr/config/download_clients/download_clients.py
+++ b/buildarr_sonarr/config/download_clients/download_clients.py
@@ -323,6 +323,7 @@ class DownloadClient(SonarrConfigBase):
                 cls._get_base_remote_map(tag_ids) + cls._remote_map,
                 remote_attrs,
             ),
+            type=cls._implementation_name.lower()
         )
 
     def _create_remote(
diff --git a/buildarr_sonarr/config/indexers.py b/buildarr_sonarr/config/indexers.py
index a873fa5..08e885f 100644
--- a/buildarr_sonarr/config/indexers.py
+++ b/buildarr_sonarr/config/indexers.py
@@ -204,6 +204,7 @@ class Indexer(SonarrConfigBase):
                 cls._get_base_remote_map(download_client_ids, tag_ids) + cls._remote_map,
                 remote_attrs,
             ),
+            type=cls._implementation_name.lower()
         )
 
     def _create_remote(

This ensures that the outputted yaml contains the type field. I will submit a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants