Skip to content

SEP20: Avoid false positives in diffs of ctrl extra properties

Zbigniew Reszela requested to merge fix_ctrl_extra_props_in_config into develop

Controller extra properties are stored in Tango DB as strings. In order to allow using python data types and not force users to use strings in YAML use json.loads() to cast the value from the Tango DB into python data type.

Tested with the following YAML:

macro_servers:
  foo:
    doors:
      Door_foo_1:
pools:
  foo:
    controllers:
      bar:
        type: Motor
        python_class: DummyMotorController
        python_module: DummyMotorController.py
        properties:
          Prop2: 123
          Prop3:
            - 456
            - 789
        elements: {}

Before this MR:

╰─>$ sardana config load foo.yaml --write
Could not find current configuration for MacroServer/foo/1. This appears to be a new config.

╰─>$ sardana config load foo.yaml
Pool: foo
- REPLACE /pools/foo/controllers/bar/properties/Prop3/0 456 => 456
- REPLACE /pools/foo/controllers/bar/properties/Prop3/1 789 => 789
- REPLACE /pools/foo/controllers/bar/properties/Prop2 123 => 123
Nothing was written to the Tango DB. Try '--write'.

With this MR:

╰─>$ sardana config load foo.yaml --write
Could not find current configuration for MacroServer/foo/1. This appears to be a new config.

╰─>$ sardana config load foo.yaml
No differences!
Nothing was written to the Tango DB. Try '--write'.

Merge request reports