Skip to content

request: a way to filter which module types are created #176

@kquinsland

Description

@kquinsland

Right now, the importer script checks to see if you have netbox 4.3. If yes, module support is enabled.

Later, a check for modules=True is done and if yes, module types are imported.
The problem is that you can't use --slug to filter modules because those files do not have a slug.

Your only option is to make a small change to the code (which effectively negates the "if not module, skip") and thus installs all the module types or filter by vendor, only.

I can think of a few ways around this:

  • use regex instead of slug. Match on the file path. This would be the most powerful method since you can specify the manufacturer name as part of the path and might not require that much refactoring... especially if you remove the --slug filter altogether. If slug: for module-types does not come to netbox in future versions,
  • introduce a slug: to the module-type yaml files and remove it from the parsed dict before sending it to the server
  • do nothing / keep the existing functionality (or apply the patch from KeyError: 'slug' if you specify an argument in '--slugs' #117) and require that users delete all the module type files that they don't want to create inadvertently/

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