Virtualization Plugins

 View Only
  • 1.  SDK source_config_discovery return error

    Posted 12-23-2019 10:01:00 AM
    I'm trying to do basic discovery where I return a single instance.
    I'm using the same return that I had used in the Summer that had worked, but is now giving error: The required parameter 'name' must not be 'None
    I'm using the syntax as described on the SDK web site:

      source_config = SourceConfigDefinition() = "my_name"
      source_config.path = "/var/lib/mysql"
      return [source_config]
    Where the schema.json is

    It almost looks like it is expecting a different format, perhaps embedded to support 1-Many configs, but that is not what the documentation says?
    Is this the latest format/syntax for returning source configs?
    We are on

    Paul Jauquet
    Senior Data Services Consultant
    Axis Technology, LLC

  • 2.  RE: SDK source_config_discovery return error
    Best Answer

    Posted 12-23-2019 12:03:00 PM

    Hi Paul,

    The key difference between your example, and the one in the documentation, is that your schema has required properties.

    So, the problem is happening when you construct the SourceConfigDefinition object:

    source_config = SourceConfigDefinition()​
    Your schema says that this object must always have a `name` property and a `path` property. But, this newly-constructed Python object does not have any such fields set yet. Thus, this line errors out.  (With the schema in the doc, all properties are optional, so it's okay to leave them unset, so this line would not error out)

    To fix this, you can set these properties at construction time:
    source_config = SourceConfigDefinition( name="mysql1", path=datadir )

    I'll file a ticket for us to change the documentation so we're a bit clearer on this.

    Oh, also, you didn't ask this explicitly, but the quoted code has a question about how to return multiple source configs. The last line of your code snippet returns an array with one object, and so if you want multiple source configs, you'd just add them to that array. Something like this:
    return [source_config1, source_config2, source_config3]​


    Tom Walsh
    Software Engineer