Browse Source

Merge "move repair-related code to backend"

Jenkins 4 years ago
parent
commit
e4a6dc64de
2 changed files with 15 additions and 5 deletions
  1. 10
    0
      entropy/backends/file_backend.py
  2. 5
    5
      entropy/engine.py

+ 10
- 0
entropy/backends/file_backend.py View File

@@ -36,8 +36,18 @@ class FileBackend(base.Backend):
36 36
         audits = utils.load_yaml(self._audit_cfg)
37 37
         return audits
38 38
 
39
+    def get_repairs(self):
40
+        repairs = utils.load_yaml(self._repair_cfg)
41
+        return repairs
42
+
39 43
     def audit_cfg_from_name(self, name):
40 44
         audits = self.get_audits()
41 45
         conf = audits[name]['cfg']
42 46
         audit_cfg = dict(utils.load_yaml(conf))
43 47
         return audit_cfg
48
+
49
+    def repair_cfg_from_name(self, name):
50
+        repairs = self.get_repairs()
51
+        conf = repairs[name]['cfg']
52
+        repair_cfg = dict(utils.load_yaml(conf))
53
+        return repair_cfg

+ 5
- 5
entropy/engine.py View File

@@ -214,12 +214,12 @@ class Engine(object):
214 214
                           audit_list, execution_time)
215 215
 
216 216
     def start_react_scripts(self):
217
-        scripts = utils.load_yaml(self.repair_cfg)
217
+        repairs = self._backend_driver.get_repairs()
218 218
         futures = []
219
-        if scripts:
220
-            for script in scripts:
219
+        if repairs:
220
+            for script in repairs:
221 221
                 if script not in self.running_repairs:
222
-                    future = self.setup_react(script, **scripts[script])
222
+                    future = self.setup_react(script, **repairs[script])
223 223
                     if future is not None:
224 224
                         futures.append(future)
225 225
         LOG.info('Running repair scripts %s', ', '.join(self.running_repairs))
@@ -229,7 +229,7 @@ class Engine(object):
229 229
         LOG.info('Setting up reactor %s', script)
230 230
 
231 231
         # Pick out relevant info
232
-        data = dict(utils.load_yaml(script_args['cfg']))
232
+        data = self._backend_driver.repair_cfg_from_name(script)
233 233
         react_script = data['script']
234 234
         search_path, reactor = utils.get_filename_and_path(react_script)
235 235
         available_modules = imp.find_module(reactor, [search_path])

Loading…
Cancel
Save