configuration: fix glitch when changing versions
This commit is contained in:
parent
6cbd45a1c0
commit
ff24947321
|
@ -84,7 +84,8 @@ def _parse_config(loaded_config, config_path):
|
|||
loaded_version = loaded_config[0]
|
||||
discard_derived_properties = loaded_version != current_version
|
||||
if discard_derived_properties:
|
||||
_log.warning(
|
||||
if _log.isEnabledFor(_INFO):
|
||||
_log.info(
|
||||
'config file \'%s\' was generated by another version of solaar '
|
||||
'(config: %s, current: %s). refreshing detected device capabilities', config_path, loaded_version,
|
||||
current_version
|
||||
|
@ -112,8 +113,8 @@ def _device_entry_from_config_dict(data, discard_derived_properties):
|
|||
# remove any string entries (from bad conversions)
|
||||
data['divert-keys'] = {k: v for k, v in divert.items() if isinstance(k, int)}
|
||||
if discard_derived_properties:
|
||||
data.pop('_absent')
|
||||
data.pop('_battery')
|
||||
data.pop('_absent', None)
|
||||
data.pop('_battery', None)
|
||||
return _DeviceEntry(**data)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue