Skip to content

Commit

Permalink
chore: remove special casing of 'latest' string when loading schemas
Browse files Browse the repository at this point in the history
  • Loading branch information
james-garner-canonical committed Oct 28, 2024
1 parent 84ccfe8 commit b2f118b
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions juju/client/facade.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b2f118b

Please sign in to comment.