mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-15 10:43:55 +00:00
Merge pull request #4305 from pi-hole/tweak/debug_curl
Use --no-progress-meter instead of --silent so error reasons are printed
This commit is contained in:
commit
d48d3aba69
2 changed files with 24 additions and 15 deletions
|
@ -1338,10 +1338,15 @@ analyze_pihole_log() {
|
||||||
curl_to_tricorder() {
|
curl_to_tricorder() {
|
||||||
# Users can submit their debug logs using curl (encrypted)
|
# Users can submit their debug logs using curl (encrypted)
|
||||||
log_write " * Using ${COL_GREEN}curl${COL_NC} for transmission."
|
log_write " * Using ${COL_GREEN}curl${COL_NC} for transmission."
|
||||||
# transmit he log via TLS and store the token returned in a variable
|
# transmit the log via TLS and store the token returned in a variable
|
||||||
tricorder_token=$(curl --silent --upload-file ${PIHOLE_DEBUG_LOG} https://tricorder.pi-hole.net)
|
tricorder_token=$(curl --silent --fail --show-error --upload-file ${PIHOLE_DEBUG_LOG} https://tricorder.pi-hole.net 2>&1)
|
||||||
if [ -z "${tricorder_token}" ]; then
|
if [[ "${tricorder_token}" != "https://tricorder.pi-hole.net/"* ]]; then
|
||||||
log_write " * ${COL_GREEN}curl${COL_NC} failed, contact Pi-hole support for assistance."
|
log_write " * ${COL_GREEN}curl${COL_NC} failed, contact Pi-hole support for assistance."
|
||||||
|
# Log curl error (if available)
|
||||||
|
if [ -n "${tricorder_token}" ]; then
|
||||||
|
log_write " * Error message: ${COL_RED}${tricorder_token}${COL_NC}\\n"
|
||||||
|
tricorder_token=""
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1386,15 +1391,14 @@ upload_to_tricorder() {
|
||||||
# Again, try to make this visually striking so the user realizes they need to do something with this information
|
# Again, try to make this visually striking so the user realizes they need to do something with this information
|
||||||
# Namely, provide the Pi-hole devs with the token
|
# Namely, provide the Pi-hole devs with the token
|
||||||
log_write ""
|
log_write ""
|
||||||
log_write "${COL_PURPLE}***********************************${COL_NC}"
|
log_write "${COL_PURPLE}*****************************************************************${COL_NC}"
|
||||||
log_write "${COL_PURPLE}***********************************${COL_NC}"
|
log_write "${COL_PURPLE}*****************************************************************${COL_NC}\\n"
|
||||||
log_write "${TICK} Your debug token is: ${COL_GREEN}${tricorder_token}${COL_NC}"
|
log_write "${TICK} Your debug token is: ${COL_GREEN}${tricorder_token}${COL_NC}"
|
||||||
log_write "${INFO}${COL_RED} Logs are deleted 48 hours after upload.${COL_NC}"
|
log_write "${INFO}${COL_RED} Logs are deleted 48 hours after upload.${COL_NC}\\n"
|
||||||
log_write "${COL_PURPLE}***********************************${COL_NC}"
|
log_write "${COL_PURPLE}*****************************************************************${COL_NC}"
|
||||||
log_write "${COL_PURPLE}***********************************${COL_NC}"
|
log_write "${COL_PURPLE}*****************************************************************${COL_NC}"
|
||||||
log_write ""
|
log_write ""
|
||||||
log_write " * Provide the token above to the Pi-hole team for assistance at"
|
log_write " * Provide the token above to the Pi-hole team for assistance at ${FORUMS_URL}"
|
||||||
log_write " * ${FORUMS_URL}"
|
|
||||||
|
|
||||||
# If no token was generated
|
# If no token was generated
|
||||||
else
|
else
|
||||||
|
|
11
pihole
11
pihole
|
@ -405,12 +405,17 @@ tricorderFunc() {
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
tricorder_token="$(curl --no-progress-meter --upload-file "-" https://tricorder.pi-hole.net/upload < /dev/stdin)"
|
tricorder_token=$(curl --silent --fail --show-error --upload-file "-" https://tricorder.pi-hole.net/upload < /dev/stdin 2>&1)
|
||||||
if [ -z "${tricorder_token}" ]; then
|
if [[ "${tricorder_token}" != "https://tricorder.pi-hole.net/"* ]]; then
|
||||||
echo -e "${CROSS} uploading failed, contact Pi-hole support for assistance."
|
echo -e "${CROSS} uploading failed, contact Pi-hole support for assistance."
|
||||||
|
# Log curl error (if available)
|
||||||
|
if [ -n "${tricorder_token}" ]; then
|
||||||
|
echo -e "${INFO} Error message: ${COL_RED}${tricorder_token}${COL_NC}\\n"
|
||||||
|
tricorder_token=""
|
||||||
|
fi
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
echo "Upload successful, your token is: ${COL_BLUE}${tricorder_token}${COL_NC}"
|
echo "Upload successful, your token is: ${COL_GREEN}${tricorder_token}${COL_NC}"
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue