From 21a5f28a9eb40ab4b46a630c68491cd8fe0c0f63 Mon Sep 17 00:00:00 2001 From: hubertdeng123 Date: Tue, 25 Oct 2022 13:14:06 -0700 Subject: [PATCH] enforce error reporting --- install/_lib.sh | 7 -- install/error-handling.sh | 145 +++++++++++++------------------------- 2 files changed, 50 insertions(+), 102 deletions(-) diff --git a/install/_lib.sh b/install/_lib.sh index 070ddef00f..5ddbabd8b9 100644 --- a/install/_lib.sh +++ b/install/_lib.sh @@ -8,13 +8,6 @@ umask 002 log_file="sentry_install_log-$(date +'%Y-%m-%d_%H-%M-%S').txt" exec &> >(tee -a "$log_file") -# Thanks to https://tldp.org/LDP/abs/html/intandnonint.html -if [[ "$(tty)" == "not a tty" ]]; then - PROMPTABLE=0 -else - PROMPTABLE=1 -fi - # Work from /install/ for install.sh, project root otherwise if [[ "$(basename $0)" = "install.sh" ]]; then cd "$(dirname $0)/install/" diff --git a/install/error-handling.sh b/install/error-handling.sh index 322407cb25..62acefd519 100644 --- a/install/error-handling.sh +++ b/install/error-handling.sh @@ -41,103 +41,58 @@ send_event() { } if [[ -z "${REPORT_SELF_HOSTED_ISSUES:-}" ]]; then - if [[ $PROMPTABLE == "0" ]]; then - echo - echo "Hey, so ... we would love to automatically find out about issues with your" - echo "Sentry instance so that we can improve the product. Turns out there is an app" - echo "for that, called Sentry. Would you be willing to let us automatically send data" - echo "about your instance upstream to Sentry for development and debugging purposes?" - echo "If so, rerun with:" - echo - echo " ./install.sh --report-self-hosted-issues" - echo - echo " or" - echo - echo " REPORT_SELF_HOSTED_ISSUES=1 ./install.sh" - echo - echo "(Btw, we send this to our own self-hosted Sentry instance, not to Sentry SaaS," - echo "so that we can be in this together.)" - echo - echo "Here's the info we may collect:" - echo - echo " - OS username" - echo " - IP address" - echo " - install log" - echo " - runtime errors" - echo " - performance data" - echo - echo "Thirty (30) day retention. No marketing. Privacy policy at sentry.io/privacy." - echo - echo "For now we are defaulting to not reporting upstream, but our plan is to" - echo "hard-require a choice from you starting in version 22.10.0, because let's be" - echo "honest, none of you will act on this otherwise. To avoid disruption you can use" - echo "one of these flags:" - echo - echo " --report-self-hosted-issues" - echo " --no-report-self-hosted-issues" - echo - echo "or set the REPORT_SELF_HOSTED_ISSUES environment variable:" - echo - echo " REPORT_SELF_HOSTED_ISSUES=1 to send data" - echo " REPORT_SELF_HOSTED_ISSUES=0 to not send data" - echo - echo "Thanks for using Sentry." - echo - export REPORT_SELF_HOSTED_ISSUES=0 # opt-in for now - else - echo - echo "Hey, so ... we would love to automatically find out about issues with your" - echo "Sentry instance so that we can improve the product. Turns out there is an app" - echo "for that, called Sentry. Would you be willing to let us automatically send data" - echo "about your instance upstream to Sentry for development and debugging purposes?" - echo - echo " y / yes / 1" - echo " n / no / 0" - echo - echo "(Btw, we send this to our own self-hosted Sentry instance, not to Sentry SaaS," - echo "so that we can be in this together.)" - echo - echo "Here's the info we may collect:" - echo - echo " - OS username" - echo " - IP address" - echo " - install log" - echo " - runtime errors" - echo " - performance data" - echo - echo "Thirty (30) day retention. No marketing. Privacy policy at sentry.io/privacy." - echo + echo + echo "Hey, so ... we would love to automatically find out about issues with your" + echo "Sentry instance so that we can improve the product. Turns out there is an app" + echo "for that, called Sentry. Would you be willing to let us automatically send data" + echo "about your instance upstream to Sentry for development and debugging purposes?" + echo + echo " y / yes / 1" + echo " n / no / 0" + echo + echo "(Btw, we send this to our own self-hosted Sentry instance, not to Sentry SaaS," + echo "so that we can be in this together.)" + echo + echo "Here's the info we may collect:" + echo + echo " - OS username" + echo " - IP address" + echo " - install log" + echo " - runtime errors" + echo " - performance data" + echo + echo "Thirty (30) day retention. No marketing. Privacy policy at sentry.io/privacy." + echo - yn="" - until [ ! -z "$yn" ]; do - read -p "y or n? " yn - case $yn in - y | yes | 1) - export REPORT_SELF_HOSTED_ISSUES=1 - echo - echo -n "Thank you." - ;; - n | no | 0) - export REPORT_SELF_HOSTED_ISSUES=0 - echo - echo -n "Understood." - ;; - *) yn="" ;; - esac - done + yn="" + until [ ! -z "$yn" ]; do + read -p "y or n? " yn + case $yn in + y | yes | 1) + export REPORT_SELF_HOSTED_ISSUES=1 + echo + echo -n "Thank you." + ;; + n | no | 0) + export REPORT_SELF_HOSTED_ISSUES=0 + echo + echo -n "Understood." + ;; + *) yn="" ;; + esac + done - echo " To avoid this prompt in the future, use one of these flags:" - echo - echo " --report-self-hosted-issues" - echo " --no-report-self-hosted-issues" - echo - echo "or set the REPORT_SELF_HOSTED_ISSUES environment variable:" - echo - echo " REPORT_SELF_HOSTED_ISSUES=1 to send data" - echo " REPORT_SELF_HOSTED_ISSUES=0 to not send data" - echo - sleep 5 - fi + echo " To avoid this prompt in the future, use one of these flags:" + echo + echo " --report-self-hosted-issues" + echo " --no-report-self-hosted-issues" + echo + echo "or set the REPORT_SELF_HOSTED_ISSUES environment variable:" + echo + echo " REPORT_SELF_HOSTED_ISSUES=1 to send data" + echo " REPORT_SELF_HOSTED_ISSUES=0 to not send data" + echo + sleep 5 fi # Make sure we can use sentry-cli if we need it.