Skip to content

[FEATURE REQUEST] Salt's Entry Points should not need to be a callable #58939

Closed

Description

@s0undt3ch

The way salt supports extensions is by means of entry-points, for example, on setup.cfg:

[options.entry_points]
salt.loader=
  runner_dirs = thirpartypackage.loader:func_to_get_list_of_dirs
  module_dirs = thirpartypackage.loader:func_to_get_list_of_dirs

This forces 3rd-party extensions to define a function which will return a list of paths from where the salt loader can then load modules.

Commonly, these 3rd-party extensions define all their loader related modules under a single package, to there's really no need for the entry point
to return a function, it can just return the module.
For example, on setup.cfg:

[options.entry_points]
salt.loader=
  runner_dirs = thirpartypackage.modules
  module_dirs = thirpartypackage.runners

This new approach reduces the amount of code to extend salt by a 3rd-party package.

Activity

  1. added
    Feature
    on Nov 13, 2020
  2. added this to the Aluminium milestone on Nov 13, 2020
  3. self-assigned this
    on Nov 13, 2020
  4. dwoz commented on Nov 17, 2020

    @dwoz
    Contributor

    Something seems weird about this to me. Generally when I've seen entrypoint used they pass the name of the plugin.

    [options.entry_points]
    salt.loader=
      <name of my plugin> = thirpartypackage
    

    The way I saw this pan out was just use conventions to find the directories

    thirdpartypackage/modules/
    thirdpartypackage/utils/
    thirdpartypackage/runners/
    
  5. s0undt3ch commented on Nov 17, 2020

    @s0undt3ch
    ContributorAuthor

    @max-arnold the current entrypoints is not going away. Worst case it will be on a deprecation path for a long time.

    @dwoz your suggestion forces each loader to know the entrypoint name and at least an os.path.exists for each loader against the 3rd-party package. It also forces a directory layout for the 3rd-party package.

    What's really the problem with the new way of defining entrypoints?
    It's something you do and usually are done with it....

    I think that your approach will likely make it harder to support both sintaxes, but I could be wrong.

  6. s0undt3ch commented on Nov 17, 2020

    @s0undt3ch
    ContributorAuthor

    I'll see what changes are required to get a better opinion on your approach

  7. added a commit that references this issue on Mar 5, 2021
    65e40ca
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

AluminiumFeature

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions