From b2f118b1d949b25ec5bf5070b7250f674f6ef4ca Mon Sep 17 00:00:00 2001 From: James Garner Date: Mon, 28 Oct 2024 11:13:11 +0100 Subject: [PATCH] chore: remove special casing of 'latest' string when loading schemas --- juju/client/facade.py | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/juju/client/facade.py b/juju/client/facade.py index e954c497..00e7f531 100644 --- a/juju/client/facade.py +++ b/juju/client/facade.py @@ -954,18 +954,13 @@ def generate_facades(schemas: Dict[str, List[Schema]]) -> Dict[str, Dict[int, co def load_schemas(options): schemas = {} - for p in sorted(glob(options.schema)): - if 'latest' in p: - juju_version = 'latest' - else: - try: - juju_version = re.search(JUJU_VERSION, p).group() - except AttributeError: - print("Cannot extract a juju version from {}".format(p)) - print("Schemas must include a juju version in the filename") - raise SystemExit(1) - + try: + juju_version = re.search(JUJU_VERSION, p).group() + except AttributeError: + print("Cannot extract a juju version from {}".format(p)) + print("Schemas must include a juju version in the filename") + raise SystemExit(1) new_schemas = json.loads(Path(p).read_text("utf-8")) schemas[juju_version] = [Schema(s) for s in new_schemas] return schemas