diff options
-rw-r--r-- | cli/cli.py | 4 | ||||
-rw-r--r-- | cli/objects/center.py | 10 |
2 files changed, 13 insertions, 1 deletions
@@ -196,7 +196,7 @@ class OgCLI(): OgImage.update_image(self.rest, args[1:]) def delete(self, args): - choices = ['server'] + choices = ['server', 'center'] parser = argparse.ArgumentParser(prog='ogcli delete') parser.add_argument('delete_obj', choices=choices) @@ -208,6 +208,8 @@ class OgCLI(): parsed_args = parser.parse_args([args[0]]) if parsed_args.delete_obj == 'server': OgServer.delete_server(self.rest, args[1:]) + elif parsed_args.delete_obj == 'center': + OgCenter.delete_center(self.rest, args[1:]) def add(self, args): choices = ['server', 'repo', 'center'] diff --git a/cli/objects/center.py b/cli/objects/center.py index 9275703..1869efd 100644 --- a/cli/objects/center.py +++ b/cli/objects/center.py @@ -18,3 +18,13 @@ class OgCenter(): payload['comment'] = parsed_args.comment rest.post('/center/add', payload=payload) + @staticmethod + def delete_center(rest, args): + parser = argparse.ArgumentParser(prog='ogcli delete center') + parser.add_argument('--id', + nargs='?', + required=True, + help='center id in database') + parsed_args = parser.parse_args(args) + payload = {'id': parsed_args.id} + rest.post('/center/delete', payload=payload) |