Fix names of standalone pkgs
This commit is contained in:
parent
e5b23aa480
commit
97e5975297
1 changed files with 11 additions and 6 deletions
|
@ -119,13 +119,19 @@ def load_profile(root, name):
|
||||||
def load_packages(root: Path, roots) -> dict:
|
def load_packages(root: Path, roots) -> dict:
|
||||||
"""Load the configured packages."""
|
"""Load the configured packages."""
|
||||||
|
|
||||||
|
def _load_package(p):
|
||||||
|
name = str(p.relative_to(root)).replace(".toml", "")
|
||||||
|
try:
|
||||||
|
packages[name] = load_package(p, name)
|
||||||
|
except Exception as e:
|
||||||
|
log.exception(f"Unable to load {p} due to exception")
|
||||||
|
|
||||||
packages = {}
|
packages = {}
|
||||||
for r in roots.get("package", []):
|
for r in roots.get("package", []):
|
||||||
r = root / expandvars(r)
|
r = root / expandvars(r)
|
||||||
log.debug(f"Trying to load packages from {r}...")
|
log.debug(f"Trying to load packages from {r}...")
|
||||||
for p in r.glob("*"):
|
for p in r.glob("*"):
|
||||||
name = str(p.relative_to(root))
|
_load_package(p)
|
||||||
packages[name] = load_package(p, name)
|
|
||||||
|
|
||||||
for r in roots.get("profile", []):
|
for r in roots.get("profile", []):
|
||||||
# Add profiles, hosts which contain subpackages.
|
# Add profiles, hosts which contain subpackages.
|
||||||
|
@ -133,11 +139,10 @@ def load_packages(root: Path, roots) -> dict:
|
||||||
log.debug(f"Trying to load profiles from {r}...")
|
log.debug(f"Trying to load profiles from {r}...")
|
||||||
for mp_root in r.glob("*"):
|
for mp_root in r.glob("*"):
|
||||||
# First find all subpackages
|
# First find all subpackages
|
||||||
log.debug(f"Trying to load packages from {mp_root}...")
|
log.debug(f"Trying to load subpackages from {mp_root}...")
|
||||||
for p in mp_root.glob("*"):
|
for p in mp_root.glob("*"):
|
||||||
if p.is_dir():
|
if (p.is_dir() or (p.is_file() and p.suffix in ['.toml'])):
|
||||||
name = str(p.relative_to(root))
|
_load_package(p)
|
||||||
packages[name] = load_package(p, name)
|
|
||||||
|
|
||||||
# Register the metapackages themselves using the profile type
|
# Register the metapackages themselves using the profile type
|
||||||
mp_name = str(mp_root.relative_to(root))
|
mp_name = str(mp_root.relative_to(root))
|
||||||
|
|
Loading…
Reference in a new issue