Fixed: Prevent unknown settings implementation from failing to deserialize
(cherry picked from commit 0e2cc7851f556e928e52bb2886c7d60c13b0741e) Log removal of invalid definitions as warnings (cherry picked from commit 3d61719a2cc9c87ac3c92b5358bb5034aed4c2ff)
This commit is contained in:
parent
eacb619cfb
commit
498722b240
|
@ -169,14 +169,13 @@ namespace NzbDrone.Core.ThingiProvider
|
||||||
definition.Message = provider.Message;
|
definition.Message = provider.Message;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Remove providers even if the ConfigContract can't be deserialized (this will fail to remove providers if the settings can't be deserialized).
|
|
||||||
private void RemoveMissingImplementations()
|
private void RemoveMissingImplementations()
|
||||||
{
|
{
|
||||||
var storedProvider = _providerRepository.All();
|
var storedProvider = _providerRepository.All();
|
||||||
|
|
||||||
foreach (var invalidDefinition in storedProvider.Where(def => GetImplementation(def) == null))
|
foreach (var invalidDefinition in storedProvider.Where(def => GetImplementation(def) == null))
|
||||||
{
|
{
|
||||||
_logger.Debug("Removing {0} ", invalidDefinition.Name);
|
_logger.Warn("Removing {0}", invalidDefinition.Name);
|
||||||
_providerRepository.Delete(invalidDefinition);
|
_providerRepository.Delete(invalidDefinition);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,7 @@ namespace NzbDrone.Core.ThingiProvider
|
||||||
var item = parser(reader);
|
var item = parser(reader);
|
||||||
var impType = typeof(IProviderConfig).Assembly.FindTypeByName(item.ConfigContract);
|
var impType = typeof(IProviderConfig).Assembly.FindTypeByName(item.ConfigContract);
|
||||||
|
|
||||||
if (body.IsNullOrWhiteSpace())
|
if (body.IsNullOrWhiteSpace() || impType == null)
|
||||||
{
|
{
|
||||||
item.Settings = NullConfig.Instance;
|
item.Settings = NullConfig.Instance;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue