Docker-in-Docker (DinD) capabilities of public runners deactivated. More info

Commit f09dca85 authored by Betoule Marc's avatar Betoule Marc
Browse files

correct bugs in the hooking system introduced when working on Task #1263

parent 5e733fab
......@@ -21,6 +21,15 @@ import re
import logging
from directive import Depend
logger = logging.getLogger('scheduler')
class RepositoryError(Exception):
""" To avoid catching Exception
"""
def __init__(self, value):
self.parameter = value
def __str__(self):
return repr(self.parameter)
class Repository:
""" Location of the segment's source code.
......@@ -68,10 +77,10 @@ class Repository:
for s in range(len(seg)):
for h in range(len(hook)):
def match(x): return path.basename(x)==seg[0:len(seg)-s]+'_'+hook[0:len(hook)-h]+'.py'
fn = filter(match, fns)[0]
fn = filter(match, fns)
if len(fn)>0:
return fn[0]
raise Exception('No source file corresponding to segment %s and hook %s'%(seg,hook))
raise RepositoryError('No source file corresponding to segment %s and hook %s'%(seg,hook))
def _fill_dict(self, lstseg):
""" Initialize all dictionnaries.
......@@ -90,10 +99,16 @@ class Repository:
## hooks
lsthook = self.get_hook_list(source)
self._hook[s] = {}
for h in lsthook:
fn= self._match_fn(fns, s, h)
source = self.get_code_source(fn)
self._hook[s][h] = compile(so, fn, "exec")
try:
fn= self._match_fn(fns, s, h)
source = self.get_code_source(fn)
except RepositoryError, e: # No source file
logger.warning(repr(e))
source=""
fn=""
self._hook[s][h] = compile(source, fn, "exec")
self._all_string[s] +=source
## deps
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment