diff --git a/hyperglass/configuration/main.py b/hyperglass/configuration/main.py index 1ee5542..050e1c9 100644 --- a/hyperglass/configuration/main.py +++ b/hyperglass/configuration/main.py @@ -54,7 +54,9 @@ CONFIG_FILES = ( def _check_config_files(directory: Path): """Verify config files exist and are readable.""" + files = () + for file in CONFIG_FILES: file_name, required = file file_path = directory / file_name @@ -70,7 +72,7 @@ def _check_config_files(directory: Path): + "Defaults will be used.", f=str(file_path), ) - files += (file_path,) + files += (checked,) return files @@ -97,8 +99,10 @@ def _config_required(config_path: Path) -> Dict: def _config_optional(config_path: Path) -> Dict: + config = {} + if config_path is None: - config = {} + return config else: try: diff --git a/hyperglass/util/__init__.py b/hyperglass/util/__init__.py index 1c3bd67..5171cc7 100644 --- a/hyperglass/util/__init__.py +++ b/hyperglass/util/__init__.py @@ -65,8 +65,9 @@ def check_path( else: raise FileNotFoundError(f"{str(path)} does not exist.") - with path.open(mode): - result = path + if path.exists(): + with path.open(mode): + result = path except Exception: result = None @@ -517,7 +518,7 @@ async def build_frontend( # noqa: C901 params: Dict, app_path: Path, force: bool = False, -): +) -> bool: """Perform full frontend UI build process. Securely creates temporary file, writes frontend configuration