Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

bug: running commands on stacks from outside dir breaks #14

Closed
katcipis opened this issue Nov 5, 2021 · 0 comments · Fixed by #16
Closed

bug: running commands on stacks from outside dir breaks #14

katcipis opened this issue Nov 5, 2021 · 0 comments · Fixed by #16

Comments

@katcipis
Copy link
Contributor

katcipis commented Nov 5, 2021

Using:

terrastack run -b <full path> <command>

From outside the stack base dir breaks, while inside the stack base dir it works, here is a small script that reproduces the problem:

#!/bin/bash

set -o errexit
set -o nounset

stack_absolute_path=$(mktemp -d)

cd "${stack_absolute_path}"

mkdir stack1
touch stack1/terrastack

mkdir stack2
touch stack2/terrastack

# Running with absolute path basedir, inside stack, works:
terrastack run -b "${stack_absolute_path}" ls

# Running with absolute path basedir, outside stack, breaks:
cd ..
terrastack run -b "${stack_absolute_path}" ls

Running this script on a empty dir results in:

Running on all stacks:
[stack1] running /bin/ls
terrastack

[stack2] running /bin/ls
terrastack

Running on all stacks:
[stack1] running /bin/ls
2021/11/05 19:41:38 warn: failed to execute command: chdir stack1: no such file or directory

[stack2] running /bin/ls
2021/11/05 19:41:38 warn: failed to execute command: chdir stack2: no such file or directory

2021/11/05 19:41:38 warn: some (2) commands failed

Version:

terrastack version
0.0.1

Which I don't think is precise since we didn't release terrastack yet =P, so here is the git reference used to build (latest at the time I'm writing this): 489c57e2a40c6a0965424a762b4c8f78b4dc838a.

Kudos to @i4ki for finding the bug, I just reproduced/reported it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant