Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Bugfix reassign_commit_and_workdir() #134

Merged
merged 3 commits into from
May 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def read(fname):
# This call to setup() does all the work
setup(
name="ansible-deployer",
version="0.0.31",
version="0.0.32",
description="Wrapper around ansible-playbook allowing configurable tasks and permissions",
long_description=README,
long_description_content_type="text/markdown",
Expand Down
7 changes: 2 additions & 5 deletions source/modules/runners/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def reassign_commit_and_workdir(commit: str, workdir: str):
"""Change workdir if commit is a path (option --self-setup enabled in main)"""
if not commit:
commit = ""
elif os.sep in commit:
elif os.path.exists(os.path.abspath(commit)):
workdir = commit
commit = ""

Expand All @@ -35,13 +35,10 @@ def setup_ansible(self, setup_hooks: list, commit: str, workdir: str):
for hook in setup_hooks:
if hook["module"] == "script":
try:
hook_env = os.environ.copy()
hook_env["ANSIBLE_DEPLOY_WORKDIR"] = workdir
with subprocess.Popen([hook["opts"]["file"], commit],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
stdin=subprocess.PIPE,
env=hook_env) as proc:
stdin=subprocess.PIPE) as proc:
std_out, std_err = proc.communicate()
if proc.returncode != 0:
failed = True
Expand Down