summaryrefslogtreecommitdiffstats
path: root/ogcli.py
diff options
context:
space:
mode:
authorRoberto Hueso Gómez <rhueso@soleta.eu>2020-06-30 12:51:51 +0200
committerRoberto Hueso Gómez <rhueso@soleta.eu>2020-06-30 12:51:51 +0200
commitdbf0f00650200b8b4817274953f2e0b684bd622d (patch)
tree1bf085f2502e9704a7e1bf46cfc44aa039da5292 /ogcli.py
parentf41b5f8f9dd5672864b2dfe995e73f259741fa8b (diff)
Rename files to remove 'og' prefix
This prefix is redundant on almost every file, so the prefix is removed from filenames and imports.
Diffstat (limited to 'ogcli.py')
-rwxr-xr-xogcli.py41
1 files changed, 0 insertions, 41 deletions
diff --git a/ogcli.py b/ogcli.py
deleted file mode 100755
index 4672a3a..0000000
--- a/ogcli.py
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/usr/bin/python
-
-from ogcli.ogcli import OgCLI
-import argparse
-import json
-import sys
-
-OG_CLI_CFG_PATH="/opt/opengnsys/etc/ogcli.json"
-
-class CLI():
- def __init__(self):
- try:
- with open(OG_CLI_CFG_PATH, 'r') as json_file:
- self.cfg = json.load(json_file)
- except json.JSONDecodeError:
- sys.exit(f'ERROR: Failed parse malformed JSON file '
- f'{OG_CLI_CFG_PATH}')
- except:
- sys.exit(f'ERROR: cannot open {OG_CLI_CFG_PATH}')
-
- required_cfg_params = {'api_token', 'ip', 'port'}
- difference_cfg_params = required_cfg_params - self.cfg.keys()
- if len(difference_cfg_params) > 0:
- sys.exit(f'Missing {difference_cfg_params} key in '
- f'json config file')
-
- self.ogcli = OgCLI(self.cfg)
-
- parser = argparse.ArgumentParser(prog='ogcli')
- parser.add_argument('command', help='Subcommand to run')
- args = parser.parse_args(sys.argv[1:2])
-
- if not hasattr(self.ogcli, args.command):
- parser.print_help()
- sys.exit('Unknown command')
-
- # Call the command with the same name.
- getattr(self.ogcli, args.command)(sys.argv[2:])
-
-if __name__ == "__main__":
- CLI()