drove-cli 0.0.1__py3-none-any.whl

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.py ADDED
@@ -0,0 +1,53 @@
1
+ #!/usr/bin/python3 -u
2
+
3
+ import argparse
4
+ import drovecli
5
+ import droveclient
6
+ import droveutils
7
+ import traceback
8
+
9
+ def build_parser() -> argparse.ArgumentParser:
10
+
11
+ parser = argparse.ArgumentParser(prog="drove")
12
+
13
+ parser.add_argument("--file", "-f", help="Configuration file for drove client")
14
+ parser.add_argument("--cluster", "-c", help="Cluster name as specified in config file")
15
+ parser.add_argument("--endpoint", "-e", help="Drove endpoint. (For example: https://drove.test.com)")
16
+ parser.add_argument("--auth-header", "-t", dest="auth_header", help="Authorization header value for the provided drove endpoint")
17
+ parser.add_argument("--insecure", "-i", help="Do not verify SSL cert for server")
18
+ parser.add_argument("--username", "-u", help="Drove cluster username")
19
+ parser.add_argument("--password", "-p", help="Drove cluster password")
20
+ parser.add_argument("--debug", "-d", help="Print details of errors", default=False, action="store_true")
21
+ return parser
22
+
23
+ def get_parser():
24
+ parser = build_parser()
25
+ client = None
26
+ client = drovecli.DroveCli(parser)
27
+ return client.parser
28
+
29
+
30
+ def run():
31
+ parser = build_parser()
32
+ client = None
33
+ try:
34
+ client = drovecli.DroveCli(parser)
35
+ client.run()
36
+ except (BrokenPipeError, IOError, KeyboardInterrupt):
37
+ pass
38
+ except droveclient.DroveException as e:
39
+ debug = True if client != None and client.debug else False
40
+ droveutils.print_drove_error(e, debug)
41
+ if debug:
42
+ traceback.print_exc()
43
+
44
+ except Exception as e:
45
+ print("Drove CLI error: " + str(e))
46
+ debug = True if client != None and client.debug else False
47
+ if debug:
48
+ traceback.print_exc()
49
+ else:
50
+ parser.print_help()
51
+
52
+ if __name__ == '__main__':
53
+ run()