smartd icon indicating copy to clipboard operation
smartd copied to clipboard

smartd_devices should be a list not dict

Open sebcmp opened this issue 4 years ago • 0 comments

It's not possible to specify a 3ware raid controller with the current config definition since the device path is always the same

given

      smartd_devices:
        /dev/twa0:
          type: "3ware,0"
        /dev/twa0:
          type: "3ware,1"

will create a warning

[WARNING]: While constructing a mapping from play.example.yml, line x, column y, found a duplicate dict
key (/dev/twa0). Using last defined value only.

i would suggest a list instead

      smartd_devices:
        - name: "/dev/twa0"
          type: "3ware,0"
        - name: "/dev/twa0"
          type: "3ware,1"

so the template code would become

{% for config in smartd_devices | d([]) %}
        {{- config.name -}}

i know this breaks backward compatibility but maybe with an extra check in the template both variants could be supported?

thanks for the role. i might submit a patch when i find a minute

sebcmp avatar Sep 22 '20 13:09 sebcmp