Change: Rename internal code for new branding
This commit is contained in:
parent
a2869d6e12
commit
d21e62e5eb
@ -9,8 +9,8 @@ import yaml
|
|||||||
import anyconfig
|
import anyconfig
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
from albero.query import Query
|
from kheops.query import Query
|
||||||
from albero.utils import schema_validate
|
from kheops.utils import schema_validate
|
||||||
import anyconfig
|
import anyconfig
|
||||||
|
|
||||||
# from box import Box
|
# from box import Box
|
||||||
@ -55,11 +55,11 @@ class App:
|
|||||||
"oneOf": [
|
"oneOf": [
|
||||||
{
|
{
|
||||||
"type": "null",
|
"type": "null",
|
||||||
"description": "Application current working directory is the `albero.yml` directory",
|
"description": "Application current working directory is the `kheops.yml` directory",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "Application working directory. If a relative path is used, it will be depending on `albero.yml` directory",
|
"description": "Application working directory. If a relative path is used, it will be depending on `kheops.yml` directory",
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -109,7 +109,7 @@ class App:
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self, config="albero.yml", namespace="default"):
|
def __init__(self, config="kheops.yml", namespace="default"):
|
||||||
conf2 = anyconfig.load(config)
|
conf2 = anyconfig.load(config)
|
||||||
self.run = {}
|
self.run = {}
|
||||||
|
|
||||||
@ -177,11 +177,11 @@ class App:
|
|||||||
def dump_schema(self):
|
def dump_schema(self):
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import albero.plugin as AlberoPlugins
|
import kheops.plugin as KheopsPlugins
|
||||||
from albero.managers import BackendsManager, RulesManager
|
from kheops.managers import BackendsManager, RulesManager
|
||||||
|
|
||||||
r1 = BackendsManager.get_schema(AlberoPlugins, mode='parts')
|
r1 = BackendsManager.get_schema(KheopsPlugins, mode='parts')
|
||||||
r2 = RulesManager.get_schema(AlberoPlugins)
|
r2 = RulesManager.get_schema(KheopsPlugins)
|
||||||
#pprint (r1)
|
#pprint (r1)
|
||||||
print(json.dumps(r1, indent=2))
|
print(json.dumps(r1, indent=2))
|
||||||
return
|
return
|
||||||
@ -196,8 +196,8 @@ class App:
|
|||||||
def gen_docs(self):
|
def gen_docs(self):
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import albero.plugin as AlberoPlugins
|
import kheops.plugin as KheopsPlugins
|
||||||
from albero.managers import BackendsManager, RulesManager
|
from kheops.managers import BackendsManager, RulesManager
|
||||||
print ("WIP")
|
print ("WIP")
|
||||||
|
|
||||||
#src = {
|
#src = {
|
||||||
@ -209,7 +209,7 @@ class App:
|
|||||||
# }
|
# }
|
||||||
# }
|
# }
|
||||||
#
|
#
|
||||||
#r1 = BackendsManager.get_schema(AlberoPlugins, mode='parts')
|
#r1 = BackendsManager.get_schema(KheopsPlugins, mode='parts')
|
||||||
|
|
||||||
|
|
||||||
#print (json.dumps(r1, indent=2))
|
#print (json.dumps(r1, indent=2))
|
||||||
|
|||||||
@ -16,7 +16,7 @@ import sys
|
|||||||
# Devel tmp
|
# Devel tmp
|
||||||
sys.path.append("/home/jez/prj/bell/training/tiger-ansible/ext/ansible-tree")
|
sys.path.append("/home/jez/prj/bell/training/tiger-ansible/ext/ansible-tree")
|
||||||
|
|
||||||
import albero.app as Albero
|
import kheops.app as Kheops
|
||||||
|
|
||||||
|
|
||||||
class CmdApp:
|
class CmdApp:
|
||||||
@ -26,7 +26,7 @@ class CmdApp:
|
|||||||
"""Start new App"""
|
"""Start new App"""
|
||||||
|
|
||||||
self.get_args()
|
self.get_args()
|
||||||
self.get_logger(verbose=self.args.verbose, logger_name="albero")
|
self.get_logger(verbose=self.args.verbose, logger_name="kheops")
|
||||||
self.cli()
|
self.cli()
|
||||||
|
|
||||||
def get_logger(self, logger_name=None, create_file=False, verbose=0):
|
def get_logger(self, logger_name=None, create_file=False, verbose=0):
|
||||||
@ -101,16 +101,20 @@ class CmdApp:
|
|||||||
|
|
||||||
# Manage main parser
|
# Manage main parser
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
description="Albero, to lookup hierarchical data"
|
description="Kheops, hierarchical data lookup tool",
|
||||||
|
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"-v", "--verbose", action="count", default=0, help="Increase verbosity"
|
"-v", "--verbose", action="count",
|
||||||
|
default=int(os.environ.get("KHEOPS_VERBOSE", "0")),
|
||||||
|
help="Increase verbosity"
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"-c", "--config", help="Albero configuration file",
|
"-c", "--config",
|
||||||
default="albero.yml",
|
default=os.environ.get("KHEOPS_CONFIG", "kheops.yml"),
|
||||||
|
help="Kheops configuration file",
|
||||||
)
|
)
|
||||||
parser.add_argument("help", action="count", default=0, help="Show usage")
|
parser.add_argument("help", help="Show usage")
|
||||||
subparsers = parser.add_subparsers(
|
subparsers = parser.add_subparsers(
|
||||||
title="subcommands", description="valid subcommands", dest="command"
|
title="subcommands", description="valid subcommands", dest="command"
|
||||||
)
|
)
|
||||||
@ -165,7 +169,6 @@ class CmdApp:
|
|||||||
def cli_lookup(self):
|
def cli_lookup(self):
|
||||||
"""Display how to use logging"""
|
"""Display how to use logging"""
|
||||||
|
|
||||||
config = "/home/jez/prj/bell/training/tiger-ansible/tree.yml"
|
|
||||||
|
|
||||||
# self.log.debug(f"Command line vars: {vars(self.args)}")
|
# self.log.debug(f"Command line vars: {vars(self.args)}")
|
||||||
keys = self.args.key or [None]
|
keys = self.args.key or [None]
|
||||||
@ -184,7 +187,7 @@ class CmdApp:
|
|||||||
|
|
||||||
self.log.info(f"CLI: {keys} with env: {new_params}")
|
self.log.info(f"CLI: {keys} with env: {new_params}")
|
||||||
|
|
||||||
app = Albero.App(config=self.args.config, namespace=self.args.namespace)
|
app = Kheops.App(config=self.args.config, namespace=self.args.namespace)
|
||||||
for key in keys:
|
for key in keys:
|
||||||
r = app.lookup(
|
r = app.lookup(
|
||||||
key=key,
|
key=key,
|
||||||
@ -197,17 +200,15 @@ class CmdApp:
|
|||||||
def cli_schema(self):
|
def cli_schema(self):
|
||||||
"""Display configuration schema"""
|
"""Display configuration schema"""
|
||||||
|
|
||||||
config = "/home/jez/prj/bell/training/tiger-ansible/tree.yml"
|
|
||||||
|
|
||||||
app = Albero.App(config=config) # , namespace=self.args.namespace)
|
app = Kheops.App(config=self.args.config) # , namespace=self.args.namespace)
|
||||||
app.dump_schema()
|
app.dump_schema()
|
||||||
|
|
||||||
|
|
||||||
def cli_gen_doc(self):
|
def cli_gen_doc(self):
|
||||||
"""Generate documentation"""
|
"""Generate documentation"""
|
||||||
|
|
||||||
config = "/home/jez/prj/bell/training/tiger-ansible/tree.yml"
|
app = Kheops.App(config=self.args.config) # , namespace=self.args.namespace)
|
||||||
app = Albero.App(config=config) # , namespace=self.args.namespace)
|
|
||||||
app.gen_docs()
|
app.gen_docs()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -4,8 +4,8 @@ import logging
|
|||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
|
|
||||||
from albero.utils import schema_validate
|
from kheops.utils import schema_validate
|
||||||
import albero.plugin as AlberoPlugins
|
import kheops.plugin as KheopsPlugins
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -151,7 +151,7 @@ class BackendsManager(Manager):
|
|||||||
self.config_app = app.conf2["config"]["app"]
|
self.config_app = app.conf2["config"]["app"]
|
||||||
self.config_main = app.conf2["config"]["tree"]
|
self.config_main = app.conf2["config"]["tree"]
|
||||||
self.config_items = list(app.conf2["tree"])
|
self.config_items = list(app.conf2["tree"])
|
||||||
# THIS MAKE A BUG !!!! self.plugin_loader = LoadPlugin(AlberoPlugins)
|
# THIS MAKE A BUG !!!! self.plugin_loader = LoadPlugin(KheopsPlugins)
|
||||||
|
|
||||||
self.plugins = [
|
self.plugins = [
|
||||||
"init",
|
"init",
|
||||||
@ -171,7 +171,7 @@ class BackendsManager(Manager):
|
|||||||
log.debug(f"Look for candidates for key '{key}' in backend: {self.backends}")
|
log.debug(f"Look for candidates for key '{key}' in backend: {self.backends}")
|
||||||
|
|
||||||
# Prepare plugins
|
# Prepare plugins
|
||||||
plugin_loader = LoadPlugin(AlberoPlugins)
|
plugin_loader = LoadPlugin(KheopsPlugins)
|
||||||
_run = {
|
_run = {
|
||||||
"key": key,
|
"key": key,
|
||||||
"scope": scope,
|
"scope": scope,
|
||||||
@ -201,7 +201,7 @@ class BackendsManager(Manager):
|
|||||||
def get_results(self, backends, trace=False):
|
def get_results(self, backends, trace=False):
|
||||||
|
|
||||||
# Prepare plugins
|
# Prepare plugins
|
||||||
plugin_loader = LoadPlugin(AlberoPlugins)
|
plugin_loader = LoadPlugin(KheopsPlugins)
|
||||||
|
|
||||||
new_results = []
|
new_results = []
|
||||||
for backend in backends:
|
for backend in backends:
|
||||||
@ -349,7 +349,7 @@ class RulesManager(Manager):
|
|||||||
|
|
||||||
# Load plugin
|
# Load plugin
|
||||||
log.debug(f"Run strategy: {strategy}")
|
log.debug(f"Run strategy: {strategy}")
|
||||||
plugin_loader = LoadPlugin(AlberoPlugins)
|
plugin_loader = LoadPlugin(KheopsPlugins)
|
||||||
strategy = plugin_loader.load(
|
strategy = plugin_loader.load(
|
||||||
"strategy",
|
"strategy",
|
||||||
strategy,
|
strategy,
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
from albero.plugin.common import PluginBackendClass
|
from kheops.plugin.common import PluginBackendClass
|
||||||
from albero.utils import path_assemble_hier
|
from kheops.utils import path_assemble_hier
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
import logging
|
import logging
|
||||||
import copy
|
import copy
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
from albero.plugin.common import PluginBackendClass
|
from kheops.plugin.common import PluginBackendClass
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import copy
|
import copy
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from albero.utils import render_template
|
from kheops.utils import render_template
|
||||||
from albero.plugin.common import PluginBackendClass
|
from kheops.plugin.common import PluginBackendClass
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|||||||
@ -11,7 +11,7 @@ import logging
|
|||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
from albero.utils import schema_validate
|
from kheops.utils import schema_validate
|
||||||
import copy
|
import copy
|
||||||
|
|
||||||
# Candidate Classes
|
# Candidate Classes
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from albero.utils import render_template, glob_files
|
from kheops.utils import render_template, glob_files
|
||||||
from albero.plugin.common import PluginEngineClass, PluginFileGlob #, Candidate
|
from kheops.plugin.common import PluginEngineClass, PluginFileGlob #, Candidate
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
@ -147,11 +147,17 @@ class Plugin(PluginEngineClass, PluginFileGlob):
|
|||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
# Assemble relative path
|
||||||
|
try:
|
||||||
|
rel_path = Path(path).resolve().relative_to(Path.cwd())
|
||||||
|
except ValueError:
|
||||||
|
rel_path = Path(path).resolve()
|
||||||
|
|
||||||
# Build result object
|
# Build result object
|
||||||
result = {}
|
result = {}
|
||||||
result["run"] = {
|
result["run"] = {
|
||||||
"path": path,
|
"path": path,
|
||||||
"rel_path": str(Path(path).relative_to(Path.cwd())),
|
"rel_path": str(rel_path),
|
||||||
}
|
}
|
||||||
result["parent"] = self.config
|
result["parent"] = self.config
|
||||||
result["data"] = data
|
result["data"] = data
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import logging
|
import logging
|
||||||
from albero.plugin.common import PluginStrategyClass
|
from kheops.plugin.common import PluginStrategyClass
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import logging
|
import logging
|
||||||
from albero.plugin.common import PluginStrategyClass
|
from kheops.plugin.common import PluginStrategyClass
|
||||||
from albero.utils import schema_validate, str_ellipsis
|
from kheops.utils import schema_validate, str_ellipsis
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|||||||
@ -9,8 +9,8 @@ import yaml
|
|||||||
import anyconfig
|
import anyconfig
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
from albero.managers import BackendsManager, RulesManager
|
from kheops.managers import BackendsManager, RulesManager
|
||||||
from albero.utils import schema_validate
|
from kheops.utils import schema_validate
|
||||||
import anyconfig
|
import anyconfig
|
||||||
|
|
||||||
# from box import Box
|
# from box import Box
|
||||||
|
|||||||
@ -55,6 +55,7 @@ def render_template(path, params):
|
|||||||
t = Template(path)
|
t = Template(path)
|
||||||
return t.render(**params)
|
return t.render(**params)
|
||||||
|
|
||||||
|
|
||||||
# Schema Methods
|
# Schema Methods
|
||||||
# =====================
|
# =====================
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user