Skip to content

Yaml/DSL Thing provider didn't check for existence of a Thing before adding one #4810

Open
@jimtng

Description

@jimtng

The Yaml Thing provider doesn't check if a Thing with the same ID already exists in the Thing Registry (i.e. registered by another provider) before adding one to its "provider".

Steps:

  • Create a Thing in Main UI, e.g. astro:moon:test1
  • Create a yaml file and create the same UID (thus duplicating it)
version: 2
things:
  astro:moon:test1:
    config:
      geolocation: "1,2"

Save this file. This is the step where the problem occurred. It "thinks" that it had registered this UID when in fact it failed (or did create a duplicate uid?)

  • Edit the yaml file, and change the uid to astro:moon:test2
    At this point it tried to remove the previous "test1" but failed with the following error

You'll see

Provider 'YamlThingProvider' is not allowed to remove element 'ThingImpl' with key 'astro:moon:test1' from the registry because it was added by provider 'ManagedThingProvider'.

It should've logged a warning and refuse to add an existing thing id in the first place.

Originally posted by @jimtng in #4793 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions