From 4c715980494c3f26d1a10cc6cef8516b7b2ea395 Mon Sep 17 00:00:00 2001 From: Chris Schmidt Date: Wed, 7 Jan 2015 00:35:48 -0700 Subject: [PATCH] Fixed bug where passing a directory as dest failed --- lib/ansible/modules/extras/packaging/maven_artifact.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/ansible/modules/extras/packaging/maven_artifact.py b/lib/ansible/modules/extras/packaging/maven_artifact.py index f02ad166d2..bf4ca59f92 100755 --- a/lib/ansible/modules/extras/packaging/maven_artifact.py +++ b/lib/ansible/modules/extras/packaging/maven_artifact.py @@ -348,6 +348,9 @@ def main(): module.fail_json(msg=e.args[0]) prev_state = "absent" + if os.path.isdir(dest): + dest = dest + "/" + artifact_id + "-" + version + ".jar" + if os.path.lexists(dest): prev_state = "present" else: @@ -359,7 +362,7 @@ def main(): module.exit_json(dest=dest, state=state, changed=False) try: - if downloader.download(artifact, target): + if downloader.download(artifact, dest): module.exit_json(state=state, dest=dest, group_id=group_id, artifact_id=artifact_id, version=version, classifier=classifier, extension=extension, repository_url=repository_url, changed=True) else: module.fail_json(msg="Unable to download the artifact")