Browse Source

Add an unregister repair option

Added a parser and function to unregister repair scripts. Remove
the repair script from the backend repair cfg, and watchdog will
catch it in the engine.

Change-Id: I7b93ca7e5eb4430b7c9502c8dd84af75b2a9fae3
Pranesh Pandurangan 4 years ago
parent
commit
7a6999c9eb
1 changed files with 17 additions and 0 deletions
  1. 17
    0
      entropy/__main__.py

+ 17
- 0
entropy/__main__.py View File

@@ -105,6 +105,14 @@ def register_repair(args):
105 105
         LOG.info('Registered repair script %s', args.name)
106 106
 
107 107
 
108
+def unregister_repair(args):
109
+    LOG.info('Unregistering repair script %s', args.name)
110
+    if not args.name and args.engine:
111
+        LOG.error('Need a repair name and engine to unregister')
112
+        return
113
+    _remove_from_list(args.engine, 'repair', args.name)
114
+
115
+
108 116
 def start_engine(args):
109 117
     if not (args.name and args.engine_cfg):
110 118
         LOG.error('Need name and engine cfg')
@@ -188,6 +196,15 @@ def parse():
188 196
                                         help='Engine')
189 197
     register_repair_parser.set_defaults(func=register_repair)
190 198
 
199
+    unregister_repair_parser = \
200
+        subparsers.add_parser('unregister-repair',
201
+                              help='Unregister a repair script')
202
+    unregister_repair_parser.add_argument('-n', dest='name', action='store',
203
+                                          help='Repair script name')
204
+    unregister_repair_parser.add_argument('-e', dest='engine', action='store',
205
+                                          help='Engine')
206
+    unregister_repair_parser.set_defaults(func=unregister_repair)
207
+
191 208
     start_engine_parser = subparsers.add_parser('start-engine',
192 209
                                                 help='Start an entropy engine')
193 210
     start_engine_parser.add_argument('-n', dest='name', help='Name')

Loading…
Cancel
Save