drove-cli 0.0.7__tar.gz → 0.0.9__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {drove_cli-0.0.7 → drove_cli-0.0.9}/PKG-INFO +1 -1
- {drove_cli-0.0.7 → drove_cli-0.0.9}/drove.py +2 -1
- {drove_cli-0.0.7 → drove_cli-0.0.9}/drovecli.py +15 -5
- {drove_cli-0.0.7 → drove_cli-0.0.9}/plugins/__init__.py +4 -6
- {drove_cli-0.0.7 → drove_cli-0.0.9}/plugins/appinstances.py +4 -1
- {drove_cli-0.0.7 → drove_cli-0.0.9}/plugins/applications.py +4 -1
- {drove_cli-0.0.7 → drove_cli-0.0.9}/plugins/cluster.py +4 -1
- {drove_cli-0.0.7 → drove_cli-0.0.9}/plugins/config.py +4 -1
- {drove_cli-0.0.7 → drove_cli-0.0.9}/plugins/describe.py +4 -1
- {drove_cli-0.0.7 → drove_cli-0.0.9}/plugins/executors.py +3 -1
- {drove_cli-0.0.7 → drove_cli-0.0.9}/plugins/localserviceinstances.py +4 -1
- {drove_cli-0.0.7 → drove_cli-0.0.9}/plugins/localservices.py +4 -1
- {drove_cli-0.0.7 → drove_cli-0.0.9}/plugins/tasks.py +4 -1
- {drove_cli-0.0.7 → drove_cli-0.0.9}/pyproject.toml +1 -1
- {drove_cli-0.0.7 → drove_cli-0.0.9}/README.md +0 -0
- {drove_cli-0.0.7 → drove_cli-0.0.9}/droveclient.py +0 -0
- {drove_cli-0.0.7 → drove_cli-0.0.9}/droveutils.py +0 -0
|
@@ -18,6 +18,7 @@ def build_parser() -> argparse.ArgumentParser:
|
|
|
18
18
|
parser.add_argument("--username", "-u", help="Drove cluster username")
|
|
19
19
|
parser.add_argument("--password", "-p", help="Drove cluster password")
|
|
20
20
|
parser.add_argument("--debug", "-d", help="Print details of errors", default=False, action="store_true")
|
|
21
|
+
parser.add_argument("--print-completion", choices=["bash", "zsh", "tcsh"], help="Print shell completion script for the given shell")
|
|
21
22
|
return parser
|
|
22
23
|
|
|
23
24
|
def get_parser():
|
|
@@ -25,7 +26,7 @@ def get_parser():
|
|
|
25
26
|
client = None
|
|
26
27
|
client = drovecli.DroveCli(parser)
|
|
27
28
|
return client.parser
|
|
28
|
-
|
|
29
|
+
|
|
29
30
|
|
|
30
31
|
def run():
|
|
31
32
|
parser = build_parser()
|
|
@@ -2,21 +2,21 @@ import argparse
|
|
|
2
2
|
import droveclient
|
|
3
3
|
from plugins import DrovePlugin
|
|
4
4
|
from types import SimpleNamespace
|
|
5
|
-
|
|
5
|
+
import shtab
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
class DroveCli:
|
|
9
9
|
def __init__(self, parser: argparse.ArgumentParser):
|
|
10
10
|
self.parser = parser
|
|
11
|
-
self.plugins:
|
|
11
|
+
self.plugins: dict[str, DrovePlugin] = {}
|
|
12
12
|
self.debug = False
|
|
13
|
-
subparsers = parser.add_subparsers(help="Available plugins")
|
|
13
|
+
subparsers = parser.add_subparsers(help="Available plugins", dest="plugin")
|
|
14
14
|
drove_client = droveclient.DroveClient()
|
|
15
15
|
for plugin_class in DrovePlugin.plugins:
|
|
16
16
|
plugin = plugin_class()
|
|
17
17
|
# print("Loading plugin: " + str(plugin))
|
|
18
18
|
plugin.populate_options(drove_client=drove_client, subparser=subparsers)
|
|
19
|
-
self.plugins.
|
|
19
|
+
self.plugins[plugin.name()] = plugin
|
|
20
20
|
parser.set_defaults(func=self.show_help)
|
|
21
21
|
|
|
22
22
|
|
|
@@ -24,8 +24,18 @@ class DroveCli:
|
|
|
24
24
|
args = self.parser.parse_args()
|
|
25
25
|
self.debug = args.debug
|
|
26
26
|
|
|
27
|
+
if args.print_completion:
|
|
28
|
+
print(shtab.complete(self.parser, shell=args.print_completion))
|
|
29
|
+
exit(0)
|
|
30
|
+
|
|
27
31
|
# Load plugins
|
|
28
|
-
|
|
32
|
+
if args.debug:
|
|
33
|
+
print("Selected plugin: " + args.plugin)
|
|
34
|
+
|
|
35
|
+
if args.plugin:
|
|
36
|
+
plugin = self.plugins.get(args.plugin)
|
|
37
|
+
if plugin and plugin.needs_client():
|
|
38
|
+
droveclient.build_drove_client(plugin.drove_client, args)
|
|
29
39
|
args.func(args)
|
|
30
40
|
|
|
31
41
|
def show_help(self, options: SimpleNamespace) -> None:
|
|
@@ -18,19 +18,17 @@ class DrovePlugin:
|
|
|
18
18
|
self.drove_client: droveclient.DroveClient = None
|
|
19
19
|
self.parser: argparse.ArgumentParser = None
|
|
20
20
|
|
|
21
|
+
def name(self) -> str:
|
|
22
|
+
raise NotImplementedError("Looks like plugin did not implement name() method")
|
|
23
|
+
|
|
21
24
|
def needs_client(self) -> bool:
|
|
22
25
|
return True
|
|
23
26
|
|
|
24
27
|
def populate_options(self, drove_client: droveclient.DroveClient, subparser: argparse.ArgumentParser):
|
|
25
28
|
self.drove_client = drove_client
|
|
26
|
-
subparser.set_defaults(func=self.
|
|
29
|
+
subparser.set_defaults(func=self.process)
|
|
27
30
|
self.parser = subparser
|
|
28
31
|
|
|
29
|
-
def run_plugin(self, options: SimpleNamespace):
|
|
30
|
-
if self.needs_client():
|
|
31
|
-
droveclient.build_drove_client(self.drove_client, options)
|
|
32
|
-
self.process(options)
|
|
33
|
-
|
|
34
32
|
def process(self, options: SimpleNamespace):
|
|
35
33
|
self.parser.print_help()
|
|
36
34
|
exit(-1)
|
|
@@ -12,8 +12,11 @@ class Applications(plugins.DrovePlugin):
|
|
|
12
12
|
def __init__(self) -> None:
|
|
13
13
|
pass
|
|
14
14
|
|
|
15
|
+
def name(self) -> str:
|
|
16
|
+
return "appinstances"
|
|
17
|
+
|
|
15
18
|
def populate_options(self, drove_client: droveclient.DroveClient, subparser: argparse.ArgumentParser):
|
|
16
|
-
parser = subparser.add_parser(
|
|
19
|
+
parser = subparser.add_parser(self.name(), help="Drove application instance related commands")
|
|
17
20
|
|
|
18
21
|
commands = parser.add_subparsers(help="Available commands for application management")
|
|
19
22
|
|
|
@@ -13,8 +13,11 @@ class Applications(plugins.DrovePlugin):
|
|
|
13
13
|
def __init__(self) -> None:
|
|
14
14
|
pass
|
|
15
15
|
|
|
16
|
+
def name(self) -> str:
|
|
17
|
+
return "apps"
|
|
18
|
+
|
|
16
19
|
def populate_options(self, drove_client: droveclient.DroveClient, subparser: argparse.ArgumentParser):
|
|
17
|
-
parser = subparser.add_parser(
|
|
20
|
+
parser = subparser.add_parser(self.name(), help="Drove application related commands")
|
|
18
21
|
|
|
19
22
|
commands = parser.add_subparsers(help="Available commands for application management")
|
|
20
23
|
|
|
@@ -9,11 +9,14 @@ import time
|
|
|
9
9
|
from types import SimpleNamespace
|
|
10
10
|
|
|
11
11
|
class Cluster(plugins.DrovePlugin):
|
|
12
|
+
def name(self):
|
|
13
|
+
return "cluster"
|
|
14
|
+
|
|
12
15
|
def __init__(self) -> None:
|
|
13
16
|
pass
|
|
14
17
|
|
|
15
18
|
def populate_options(self, drove_client: droveclient.DroveClient, subparser: argparse.ArgumentParser):
|
|
16
|
-
parser = subparser.add_parser(
|
|
19
|
+
parser = subparser.add_parser(self.name(), help="Drove cluster related commands")
|
|
17
20
|
|
|
18
21
|
commands = parser.add_subparsers(help="Available commands for cluster management")
|
|
19
22
|
|
|
@@ -85,11 +85,14 @@ class Config(plugins.DrovePlugin):
|
|
|
85
85
|
def __init__(self) -> None:
|
|
86
86
|
pass
|
|
87
87
|
|
|
88
|
+
def name(self) -> str:
|
|
89
|
+
return "config"
|
|
90
|
+
|
|
88
91
|
def needs_client(self) -> bool:
|
|
89
92
|
return False
|
|
90
93
|
|
|
91
94
|
def populate_options(self, drove_client, subparser: argparse.ArgumentParser):
|
|
92
|
-
parser = subparser.add_parser(
|
|
95
|
+
parser = subparser.add_parser(self.name(), help="Manage drove cluster configurations")
|
|
93
96
|
commands = parser.add_subparsers(help="Available config commands")
|
|
94
97
|
|
|
95
98
|
# get-clusters: List all available clusters
|
|
@@ -33,8 +33,11 @@ class Describe(plugins.DrovePlugin):
|
|
|
33
33
|
def __init__(self) -> None:
|
|
34
34
|
pass
|
|
35
35
|
|
|
36
|
+
def name(self) -> str:
|
|
37
|
+
return "describe"
|
|
38
|
+
|
|
36
39
|
def populate_options(self, drove_client: droveclient.DroveClient, subparser: argparse.ArgumentParser):
|
|
37
|
-
parser = subparser.add_parser(
|
|
40
|
+
parser = subparser.add_parser(self.name(), help="Show detailed information about a resource")
|
|
38
41
|
commands = parser.add_subparsers(help="Available describe commands")
|
|
39
42
|
|
|
40
43
|
# describe executor
|
|
@@ -10,9 +10,11 @@ from urllib.parse import urlencode
|
|
|
10
10
|
class Executors(plugins.DrovePlugin):
|
|
11
11
|
def __init__(self) -> None:
|
|
12
12
|
pass
|
|
13
|
+
def name(self) -> str:
|
|
14
|
+
return "executor"
|
|
13
15
|
|
|
14
16
|
def populate_options(self, drove_client: droveclient.DroveClient, subparser: argparse.ArgumentParser):
|
|
15
|
-
parser = subparser.add_parser(
|
|
17
|
+
parser = subparser.add_parser(self.name(), help="Drove cluster executor related commands")
|
|
16
18
|
|
|
17
19
|
commands = parser.add_subparsers(help="Available commands for cluster executor management")
|
|
18
20
|
|
|
@@ -12,8 +12,11 @@ class LocalServices(plugins.DrovePlugin):
|
|
|
12
12
|
def __init__(self) -> None:
|
|
13
13
|
pass
|
|
14
14
|
|
|
15
|
+
def name(self) -> str:
|
|
16
|
+
return "lsinstances"
|
|
17
|
+
|
|
15
18
|
def populate_options(self, drove_client: droveclient.DroveClient, subparser: argparse.ArgumentParser):
|
|
16
|
-
parser = subparser.add_parser(
|
|
19
|
+
parser = subparser.add_parser(self.name(), help="Drove local service instance related commands")
|
|
17
20
|
|
|
18
21
|
commands = parser.add_subparsers(help="Available commands for local service management")
|
|
19
22
|
|
|
@@ -13,8 +13,11 @@ class LocalServices(plugins.DrovePlugin):
|
|
|
13
13
|
def __init__(self) -> None:
|
|
14
14
|
super().__init__()
|
|
15
15
|
|
|
16
|
+
def name(self) -> str:
|
|
17
|
+
return "localservices"
|
|
18
|
+
|
|
16
19
|
def populate_options(self, drove_client: droveclient.DroveClient, subparser: argparse.ArgumentParser):
|
|
17
|
-
parser = subparser.add_parser(
|
|
20
|
+
parser = subparser.add_parser(self.name(), help="Drove local service related commands")
|
|
18
21
|
|
|
19
22
|
commands = parser.add_subparsers(help="Available commands for local services management")
|
|
20
23
|
|
|
@@ -12,8 +12,11 @@ class Tasks(plugins.DrovePlugin):
|
|
|
12
12
|
def __init__(self) -> None:
|
|
13
13
|
pass
|
|
14
14
|
|
|
15
|
+
def name(self) -> str:
|
|
16
|
+
return "tasks"
|
|
17
|
+
|
|
15
18
|
def populate_options(self, drove_client: droveclient.DroveClient, subparser: argparse.ArgumentParser):
|
|
16
|
-
parser = subparser.add_parser(
|
|
19
|
+
parser = subparser.add_parser(self.name(), help="Drove task related commands")
|
|
17
20
|
|
|
18
21
|
commands = parser.add_subparsers(help="Available commands for task management")
|
|
19
22
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|