mirror of
https://github.com/containers/podman-compose.git
synced 2025-02-10 23:39:39 +01:00
Remove incorrect os.chdir call to fix folder error
Signed-off-by: notdian <dian@fishekqi.com>
This commit is contained in:
parent
51d180d2d0
commit
e03d675b9b
1
newsfragments/1125.bugfix
Normal file
1
newsfragments/1125.bugfix
Normal file
@ -0,0 +1 @@
|
||||
- Fix handling of relative includes and extends
|
@ -1925,9 +1925,6 @@ class PodmanCompose:
|
||||
dotenv_path = os.path.realpath(args.env_file)
|
||||
dotenv_dict.update(dotenv_to_dict(dotenv_path))
|
||||
|
||||
# TODO: remove next line
|
||||
os.chdir(dirname)
|
||||
|
||||
os.environ.update({
|
||||
key: value for key, value in dotenv_dict.items() if key.startswith("PODMAN_")
|
||||
})
|
||||
@ -1969,11 +1966,18 @@ class PodmanCompose:
|
||||
content = normalize(content)
|
||||
# log(filename, json.dumps(content, indent = 2))
|
||||
content = rec_subs(content, self.environ)
|
||||
if isinstance(services := content.get('services'), dict):
|
||||
for service in services.values():
|
||||
if 'extends' in service and (service_file := service['extends'].get('file')):
|
||||
service['extends']['file'] = os.path.join(
|
||||
os.path.dirname(filename), service_file
|
||||
)
|
||||
|
||||
rec_merge(compose, content)
|
||||
# If `include` is used, append included files to files
|
||||
include = compose.get("include")
|
||||
if include:
|
||||
files.extend(include)
|
||||
files.extend([os.path.join(os.path.dirname(filename), i) for i in include])
|
||||
# As compose obj is updated and tested with every loop, not deleting `include`
|
||||
# from it, results in it being tested again and again, original values for
|
||||
# `include` be appended to `files`, and, included files be processed for ever.
|
||||
|
Loading…
Reference in New Issue
Block a user