framework icon indicating copy to clipboard operation
framework copied to clipboard

Build something generic to expose python code to the cli

Open JeffreyDevloo opened this issue 8 years ago • 7 comments

Problem description

All cli calls have to manually added to a bash file and it is becoming a bit dirty. There should be something more generic to use to make our life a bit easier.

(potential inspiration: https://github.com/openvstorage/openvstorage-health-check/blob/master/ovs/extensions/healthcheck/expose_to_cli.py#L57 + https://github.com/openvstorage/openvstorage-health-check/blob/master/ovs/extensions/healthcheck/expose_to_cli.py#L44)

JeffreyDevloo avatar Nov 07 '17 16:11 JeffreyDevloo

Can't we leverage Swagger (and its toolset) for this? Also see https://github.com/openvstorage/home/issues/28.

Exposing python code should always be done through the API.

wimpers avatar Nov 07 '17 16:11 wimpers

Swagger is a just a description for our API. None of the CLI calls do something that the current API is capable of. All current CLI calls execute some python code in the background (ovs config get returns Configuration.get etc) The idea is just decorating these methods and allow the cli to provide the functions arguments.

JeffreyDevloo avatar Nov 07 '17 16:11 JeffreyDevloo

Eventually we will want to turn our API into a CLI also. So for the long run it might be an option to turn the current CLI options into an action that can be executed by the API.

wimpers avatar Nov 07 '17 17:11 wimpers

Yes, that would be nice to have, but there should still be something to expose additional, non-api stuff through the cli

JeffreyDevloo avatar Nov 08 '17 07:11 JeffreyDevloo

What do you see as use case for calls which should be doable through CLI but not through the API?

wimpers avatar Nov 08 '17 08:11 wimpers

Most of these: https://github.com/openvstorage/framework/blob/develop/scripts/system/ovs#L24

JeffreyDevloo avatar Nov 08 '17 08:11 JeffreyDevloo

The integration of the CLI in the Healthcheck might be a solution here. Related PR: https://github.com/openvstorage/openvstorage-health-check/pull/447

JeffreyDevloo avatar May 03 '18 16:05 JeffreyDevloo