Change: Rename internal code for new branding
This commit is contained in:
parent
a2869d6e12
commit
d21e62e5eb
@ -9,8 +9,8 @@ import yaml
|
||||
import anyconfig
|
||||
from pprint import pprint
|
||||
|
||||
from albero.query import Query
|
||||
from albero.utils import schema_validate
|
||||
from kheops.query import Query
|
||||
from kheops.utils import schema_validate
|
||||
import anyconfig
|
||||
|
||||
# from box import Box
|
||||
@ -55,11 +55,11 @@ class App:
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "null",
|
||||
"description": "Application current working directory is the `albero.yml` directory",
|
||||
"description": "Application current working directory is the `kheops.yml` directory",
|
||||
},
|
||||
{
|
||||
"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)
|
||||
self.run = {}
|
||||
|
||||
@ -177,11 +177,11 @@ class App:
|
||||
def dump_schema(self):
|
||||
|
||||
import json
|
||||
import albero.plugin as AlberoPlugins
|
||||
from albero.managers import BackendsManager, RulesManager
|
||||
import kheops.plugin as KheopsPlugins
|
||||
from kheops.managers import BackendsManager, RulesManager
|
||||
|
||||
r1 = BackendsManager.get_schema(AlberoPlugins, mode='parts')
|
||||
r2 = RulesManager.get_schema(AlberoPlugins)
|
||||
r1 = BackendsManager.get_schema(KheopsPlugins, mode='parts')
|
||||
r2 = RulesManager.get_schema(KheopsPlugins)
|
||||
#pprint (r1)
|
||||
print(json.dumps(r1, indent=2))
|
||||
return
|
||||
@ -196,8 +196,8 @@ class App:
|
||||
def gen_docs(self):
|
||||
|
||||
import json
|
||||
import albero.plugin as AlberoPlugins
|
||||
from albero.managers import BackendsManager, RulesManager
|
||||
import kheops.plugin as KheopsPlugins
|
||||
from kheops.managers import BackendsManager, RulesManager
|
||||
print ("WIP")
|
||||
|
||||
#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))
|
||||
|
||||
@ -16,7 +16,7 @@ import sys
|
||||
# Devel tmp
|
||||
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:
|
||||
@ -26,7 +26,7 @@ class CmdApp:
|
||||
"""Start new App"""
|
||||
|
||||
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()
|
||||
|
||||
def get_logger(self, logger_name=None, create_file=False, verbose=0):
|
||||
@ -101,16 +101,20 @@ class CmdApp:
|
||||
|
||||
# Manage main parser
|
||||
parser = argparse.ArgumentParser(
|
||||
description="Albero, to lookup hierarchical data"
|
||||
description="Kheops, hierarchical data lookup tool",
|
||||
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
|
||||
)
|
||||
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(
|
||||
"-c", "--config", help="Albero configuration file",
|
||||
default="albero.yml",
|
||||
"-c", "--config",
|
||||
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(
|
||||
title="subcommands", description="valid subcommands", dest="command"
|
||||
)
|
||||
@ -165,7 +169,6 @@ class CmdApp:
|
||||
def cli_lookup(self):
|
||||
"""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)}")
|
||||
keys = self.args.key or [None]
|
||||
@ -184,7 +187,7 @@ class CmdApp:
|
||||
|
||||
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:
|
||||
r = app.lookup(
|
||||
key=key,
|
||||
@ -197,17 +200,15 @@ class CmdApp:
|
||||
def cli_schema(self):
|
||||
"""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()
|
||||
|
||||
|
||||
def cli_gen_doc(self):
|
||||
"""Generate documentation"""
|
||||
|
||||
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.gen_docs()
|
||||
|
||||
|
||||
|
||||
@ -4,8 +4,8 @@ import logging
|
||||
from pprint import pprint
|
||||
|
||||
|
||||
from albero.utils import schema_validate
|
||||
import albero.plugin as AlberoPlugins
|
||||
from kheops.utils import schema_validate
|
||||
import kheops.plugin as KheopsPlugins
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
@ -151,7 +151,7 @@ class BackendsManager(Manager):
|
||||
self.config_app = app.conf2["config"]["app"]
|
||||
self.config_main = app.conf2["config"]["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 = [
|
||||
"init",
|
||||
@ -171,7 +171,7 @@ class BackendsManager(Manager):
|
||||
log.debug(f"Look for candidates for key '{key}' in backend: {self.backends}")
|
||||
|
||||
# Prepare plugins
|
||||
plugin_loader = LoadPlugin(AlberoPlugins)
|
||||
plugin_loader = LoadPlugin(KheopsPlugins)
|
||||
_run = {
|
||||
"key": key,
|
||||
"scope": scope,
|
||||
@ -201,7 +201,7 @@ class BackendsManager(Manager):
|
||||
def get_results(self, backends, trace=False):
|
||||
|
||||
# Prepare plugins
|
||||
plugin_loader = LoadPlugin(AlberoPlugins)
|
||||
plugin_loader = LoadPlugin(KheopsPlugins)
|
||||
|
||||
new_results = []
|
||||
for backend in backends:
|
||||
@ -349,7 +349,7 @@ class RulesManager(Manager):
|
||||
|
||||
# Load plugin
|
||||
log.debug(f"Run strategy: {strategy}")
|
||||
plugin_loader = LoadPlugin(AlberoPlugins)
|
||||
plugin_loader = LoadPlugin(KheopsPlugins)
|
||||
strategy = plugin_loader.load(
|
||||
"strategy",
|
||||
strategy,
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
|
||||
from albero.plugin.common import PluginBackendClass
|
||||
from albero.utils import path_assemble_hier
|
||||
from kheops.plugin.common import PluginBackendClass
|
||||
from kheops.utils import path_assemble_hier
|
||||
from pprint import pprint
|
||||
import logging
|
||||
import copy
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
from albero.plugin.common import PluginBackendClass
|
||||
from kheops.plugin.common import PluginBackendClass
|
||||
from pprint import pprint
|
||||
import logging
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import copy
|
||||
from pathlib import Path
|
||||
from albero.utils import render_template
|
||||
from albero.plugin.common import PluginBackendClass
|
||||
from kheops.utils import render_template
|
||||
from kheops.plugin.common import PluginBackendClass
|
||||
from pprint import pprint
|
||||
|
||||
import logging
|
||||
|
||||
@ -11,7 +11,7 @@ import logging
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
from albero.utils import schema_validate
|
||||
from kheops.utils import schema_validate
|
||||
import copy
|
||||
|
||||
# Candidate Classes
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
from pathlib import Path
|
||||
from albero.utils import render_template, glob_files
|
||||
from albero.plugin.common import PluginEngineClass, PluginFileGlob #, Candidate
|
||||
from kheops.utils import render_template, glob_files
|
||||
from kheops.plugin.common import PluginEngineClass, PluginFileGlob #, Candidate
|
||||
from pprint import pprint
|
||||
|
||||
import logging
|
||||
@ -147,11 +147,17 @@ class Plugin(PluginEngineClass, PluginFileGlob):
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# Assemble relative path
|
||||
try:
|
||||
rel_path = Path(path).resolve().relative_to(Path.cwd())
|
||||
except ValueError:
|
||||
rel_path = Path(path).resolve()
|
||||
|
||||
# Build result object
|
||||
result = {}
|
||||
result["run"] = {
|
||||
"path": path,
|
||||
"rel_path": str(Path(path).relative_to(Path.cwd())),
|
||||
"rel_path": str(rel_path),
|
||||
}
|
||||
result["parent"] = self.config
|
||||
result["data"] = data
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import logging
|
||||
from albero.plugin.common import PluginStrategyClass
|
||||
from kheops.plugin.common import PluginStrategyClass
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import logging
|
||||
from albero.plugin.common import PluginStrategyClass
|
||||
from albero.utils import schema_validate, str_ellipsis
|
||||
from kheops.plugin.common import PluginStrategyClass
|
||||
from kheops.utils import schema_validate, str_ellipsis
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@ -9,8 +9,8 @@ import yaml
|
||||
import anyconfig
|
||||
from pprint import pprint
|
||||
|
||||
from albero.managers import BackendsManager, RulesManager
|
||||
from albero.utils import schema_validate
|
||||
from kheops.managers import BackendsManager, RulesManager
|
||||
from kheops.utils import schema_validate
|
||||
import anyconfig
|
||||
|
||||
# from box import Box
|
||||
|
||||
@ -55,6 +55,7 @@ def render_template(path, params):
|
||||
t = Template(path)
|
||||
return t.render(**params)
|
||||
|
||||
|
||||
# Schema Methods
|
||||
# =====================
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user