mirror of
https://github.com/ansible-collections/community.docker.git
synced 2026-04-11 20:29:57 +00:00
Polishing.
This commit is contained in:
parent
f39977573b
commit
423ad11d50
@ -119,16 +119,17 @@ class ContextAPI(object):
|
|||||||
If the server returns an error.
|
If the server returns an error.
|
||||||
"""
|
"""
|
||||||
names = []
|
names = []
|
||||||
for dirname, dirnames, fnames in os.walk(get_meta_dir()):
|
for dirname, dummy, fnames in os.walk(get_meta_dir()):
|
||||||
for filename in fnames + dirnames:
|
for filename in fnames:
|
||||||
if filename == METAFILE:
|
if filename == METAFILE:
|
||||||
|
filepath = os.path.join(dirname, filename)
|
||||||
try:
|
try:
|
||||||
data = json.load(
|
with open(filepath, "r") as f:
|
||||||
open(os.path.join(dirname, filename)))
|
data = json.load(f)
|
||||||
names.append(data["Name"])
|
names.append(data["Name"])
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise errors.ContextException(
|
raise errors.ContextException(
|
||||||
f"Failed to load metafile {filename}: {e}",
|
f"Failed to load metafile {filepath}: {e}",
|
||||||
) from e
|
) from e
|
||||||
|
|
||||||
contexts = [cls.DEFAULT_CONTEXT]
|
contexts = [cls.DEFAULT_CONTEXT]
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user