diff --git a/changelogs/fragments/828-compose-project_src.yml b/changelogs/fragments/828-compose-project_src.yml new file mode 100644 index 000000000..99736525b --- /dev/null +++ b/changelogs/fragments/828-compose-project_src.yml @@ -0,0 +1,2 @@ +bugfixes: + - "docker_compose_v2* - allow ``project_src`` to be a relative path, by converting it to an absolute path before using it (https://github.com/ansible-collections/community.docker/issues/827, https://github.com/ansible-collections/community.docker/pull/828)." diff --git a/plugins/module_utils/compose_v2.py b/plugins/module_utils/compose_v2.py index dfe4df47c..be7101a0e 100644 --- a/plugins/module_utils/compose_v2.py +++ b/plugins/module_utils/compose_v2.py @@ -507,7 +507,7 @@ def __init__(self, client, min_version=MINIMUM_COMPOSE_VERSION): self.check_mode = self.client.check_mode parameters = self.client.module.params - self.project_src = parameters['project_src'] + self.project_src = os.path.abspath(parameters['project_src']) self.project_name = parameters['project_name'] self.files = parameters['files'] self.env_files = parameters['env_files']