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