Fix: Minor bugs and log messages
This commit is contained in:
parent
07ecaa8085
commit
1f38ce7dba
@ -266,7 +266,7 @@ class QueryProcessor:
|
|||||||
lookup["path"] = new_path
|
lookup["path"] = new_path
|
||||||
new_lookups3.append(lookup)
|
new_lookups3.append(lookup)
|
||||||
else:
|
else:
|
||||||
log.info("Ignore because of missing scope vars: '%s'", path)
|
log.warning("Ignore lookup item because of missing scope vars: '%s'", path)
|
||||||
|
|
||||||
return new_lookups3
|
return new_lookups3
|
||||||
|
|
||||||
|
|||||||
@ -32,7 +32,7 @@ class Plugin(BackendPlugin):
|
|||||||
"description": "This backend will look for data inside a file hierarchy.",
|
"description": "This backend will look for data inside a file hierarchy.",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"format": {
|
"extensions": {
|
||||||
"title": "File formats",
|
"title": "File formats",
|
||||||
"description": """
|
"description": """
|
||||||
This object describe which parser is assigned to which extension.
|
This object describe which parser is assigned to which extension.
|
||||||
@ -124,19 +124,24 @@ class Plugin(BackendPlugin):
|
|||||||
|
|
||||||
raw_data = None
|
raw_data = None
|
||||||
status = "not_found"
|
status = "not_found"
|
||||||
for ext, parser in self.extensions.items():
|
extensions = self.config.get("extensions", self.extensions)
|
||||||
|
for ext, parser in extensions.items():
|
||||||
new_path = os.path.join(self.top_path, path + ext)
|
new_path = os.path.join(self.top_path, path + ext)
|
||||||
log.debug("Looking into %s", new_path)
|
|
||||||
if os.path.isfile(new_path):
|
if os.path.isfile(new_path):
|
||||||
status = "found"
|
status = "found"
|
||||||
try:
|
try:
|
||||||
|
log.info("Found file: %s", new_path)
|
||||||
raw_data = anyconfig.load(new_path, ac_parser=parser)
|
raw_data = anyconfig.load(new_path, ac_parser=parser)
|
||||||
except AnyConfigBaseError as err:
|
except AnyConfigBaseError as err:
|
||||||
status = "broken"
|
status = "broken"
|
||||||
raw_data = None
|
raw_data = None
|
||||||
log.warning("Could not parse file %s: %s", new_path, err)
|
log.warning("Could not parse file %s: %s", new_path, err)
|
||||||
|
|
||||||
|
# Stop the loop extension if we found a result.
|
||||||
break
|
break
|
||||||
|
|
||||||
|
log.debug("Skip absent file: %s", new_path)
|
||||||
|
|
||||||
ret = BackendCandidate(
|
ret = BackendCandidate(
|
||||||
path=new_path,
|
path=new_path,
|
||||||
status=status,
|
status=status,
|
||||||
|
|||||||
@ -35,7 +35,8 @@ class KheopsPlugin:
|
|||||||
self.config = self.ns.config["config"].get(config_key, {})
|
self.config = self.ns.config["config"].get(config_key, {})
|
||||||
self.config_key = config_key
|
self.config_key = config_key
|
||||||
|
|
||||||
log.debug("Looking for plugin configuration in config with key '%s', got: %s", config_key, self.config)
|
#if self.config:
|
||||||
|
# log.debug("Load plugin configuration in config with key '%s', got: %s", config_key, self.config)
|
||||||
self._init()
|
self._init()
|
||||||
|
|
||||||
def _init(self):
|
def _init(self):
|
||||||
|
|||||||
@ -12,7 +12,7 @@ log = logging.getLogger(__name__)
|
|||||||
class Plugin(ScopePlugin, ScopeExtLoop):
|
class Plugin(ScopePlugin, ScopeExtLoop):
|
||||||
"""Hierarchy plugin"""
|
"""Hierarchy plugin"""
|
||||||
|
|
||||||
_plugin_name = "hier"
|
plugin_name = "hier"
|
||||||
_schema_props_new = {
|
_schema_props_new = {
|
||||||
"hier": {
|
"hier": {
|
||||||
"default": None,
|
"default": None,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user