SEP20: false positives in measurement group configuration
This issue can be easilty reproduced by changing the mntgrp01 configuration in the sar_demo.yaml
file into something like this:
mntgrp01:
channels:
- ct01:
synchronizer: software
synchronization: Trigger
Then you just need:
╰─>$ sardana config load src/sardana/config/test/sar_demo.yaml --write
Could not find current configuration for MacroServer/demo1/1. This appears to be a new config.
╰─>$ sardana config load src/sardana/config/test/sar_demo.yaml
Pool: demo1
- REPLACE /pools/demo1/measurement_groups/mntgrp01/channels/0 ct01 => {'ct01': {'synchronizer': 'software', 'synchronization': 'Trigger'}}
Nothing was written to the Tango DB. Try '--write'.
We can see a false positive change of ct01 configuration.
This is because when we dump the current configuration from the Tango DB it is only considered and dumped if this is different from the default values. When loading configuration the first thing which takes place is the dump of the current configuration so it could be compared with the new configuration. Since the new configuration explicitelly contains the default values of synchronizer and synchronization they are different with respect to the dump which does not contain them.
I wonder what is the best fix for this:
- When we dump we dump all measurement group channels configurations even if these are default values and prints them on the stdout?
- When we dump we dump all measurement group channels configurations even if these are default values but just before printing them on the stdout we filter them out?
- Making the diff intelligent to not cosider the lack of default values in new configuration?
What I think is very important is that when writing YAML files by hand it should not be mandatory to write all the measurement group channels configuration default values and it should be possible to omit them as it is done now. Then going for option 1 would mean that the roundtripping will produce a different file, right? So, probably not good.