Skip to content
This repository has been archived by the owner on Sep 2, 2024. It is now read-only.

Fix sandboxctl destroy timeout #743

Merged
merged 7 commits into from
Jun 17, 2021
Merged
Show file tree
Hide file tree
Changes from 5 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
10 changes: 10 additions & 0 deletions sre-recipes/recipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,16 @@ def _run_command(command):
)
output, error = process.communicate()
return output, error

@staticmethod
def _run_command_interactive(command):
"""Runs the given interactive command that waits for user input and returns any output and error"""
process = subprocess.Popen(
command.split(), shell=True, stderr=subprocess.PIPE
Ayelet41 marked this conversation as resolved.
Show resolved Hide resolved
)
output, error = process.communicate()
return output, error


@staticmethod
def _get_project_id():
Expand Down
2 changes: 1 addition & 1 deletion sre-recipes/sandboxctl
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ def destroy():
"""Delete an existing sandbox"""
os.chdir(os.path.abspath(sys.path[0]))
destroy_command = "../terraform/destroy.sh"
Recipe._run_command(destroy_command)
Recipe._run_command_interactive(destroy_command)
Ayelet41 marked this conversation as resolved.
Show resolved Hide resolved


if __name__ == "__main__":
Expand Down
2 changes: 1 addition & 1 deletion terraform/destroy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ set -o errexit # Exit on error
#set -x

log() { echo "$1" >&2; }

echo 'Start shutting down resources and deleting the project, this should take about 20 mins. Please do not close the session.'
Ayelet41 marked this conversation as resolved.
Show resolved Hide resolved
IFS=$'\n'
acct=$(gcloud info --format="value(config.account)")

Expand Down