Skip to content

Commit

Permalink
Fixes #37406 - drop upload functionality from foreman-debug
Browse files Browse the repository at this point in the history
  • Loading branch information
evgeni committed May 6, 2024
1 parent fe77720 commit aeb0ffa
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 69 deletions.
29 changes: 0 additions & 29 deletions config/foreman-debug.conf
Original file line number Diff line number Diff line change
Expand Up @@ -27,34 +27,5 @@
# Debug mode (0 or 1)
#DEBUG=0

# Upload tarball after each run (0 or 1)
#UPLOAD=0

# Permanently disable upload feature (0 or 1)
#UPLOAD_DISABLED=0

# URL of the upload location (string)
#UPLOAD_URL='rsync://rsync.theforeman.org/debug-incoming'

# The full upload command in strict quotes (string)
#UPLOAD_CMD='rsync "${TARBALL}" "${UPLOAD_URL}"'

# Additional help message for when uploads are not disabled (UPLOAD_DISABLED=0) (multi line string)
#UPLOAD_USAGE_MSG="\
#Add your custom message here."

# Message displayed at the end if neither UPLOAD nor UPLOAD_DISABLED is set (multi line string)
#UPLOAD_UNSET_MSG="\
#Add your custom message here."

# Message when an upload was successfull (multi line string)
# note: will be appended with "$(basename ${TARBALL})\n"
#UPLOAD_SUCCESS_MSG="\
#Add your custom message here."

# Message when an upload was not successfull (multi line string)
#UPLOAD_FAIL_MSG="\
#Add your custom message here."

# Tokens that are fileted out (shell array)
#FILTER_WORDS=(pass password token key)
40 changes: 0 additions & 40 deletions script/foreman-debug
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
export SCLNAME=tfm

usage() {
[[ $UPLOAD_DISABLED -ne 0 ]] && UPLOAD_INFO=" (feature disabled by configuration)"
cat <<USAGE
$0 - configuration and log data collector
Expand All @@ -26,11 +25,9 @@ OPTIONS:
-p Additionally print password patterns being filtered out
-q Quiet mode
-v Verbose mode
-u Upload tarball$UPLOAD_INFO
-h Shows this message
USAGE
[[ $UPLOAD_DISABLED -eq 0 ]] && echo "${UPLOAD_USAGE_MSG}"
}

# Filter for patterns like password=XYZ, -storepass XYZ or secret: XYZ
Expand Down Expand Up @@ -141,25 +138,6 @@ PRINTPASS=0
QUIET=0
VERBOSE=0
DEBUG=0
UPLOAD=0
UPLOAD_DISABLED=0
UPLOAD_URL='rsync://rsync.theforeman.org/debug-incoming'
UPLOAD_CMD='rsync "${TARBALL}" "${UPLOAD_URL}"'
UPLOAD_USAGE_MSG="\
You may want to upload the tarball (with -u) to our public server via rsync.
This is a write-only directory (readable only by Foreman core developers)
Please note that the rsync transmission is UNENCRYPTED."
UPLOAD_UNSET_MSG="\
To upload a tarball to our secure site, please use the -u option."
UPLOAD_SUCCESS_MSG="\
The tarball has been uploaded, please contact us on community.theforeman.org
or on IRC/Matrix (#theforeman), making sure you reference the following URL:
http://debugs.theforeman.org/"
UPLOAD_FAIL_MSG="\
The tarball could not be uploaded, please upload it to an alternate location
and contact us on community.theforeman.org or on IRC/Matrix (#theforeman),
making sure you reference that URL."

if type -p xz >/dev/null; then
COMPRESS="xz -1"
Expand Down Expand Up @@ -211,9 +189,6 @@ while getopts "d:gam:s:j:uqpvhx" opt; do
MAXSIZE="$OPTARG"
MAXSIZE=$((MAXSIZE*1024*1024))
;;
u)
UPLOAD=1
;;
x)
# this option is not docummented - use for extra output,
# skip slow items and to disable root check
Expand All @@ -233,8 +208,6 @@ done

[ $DEBUG -eq 0 -a $EUID -ne 0 ] && error "This script must be run as root" && exit 1

[ $UPLOAD -eq 1 -a $NOTAR -eq 1 ] && error "Options -u and -a cannot be used together" && exit 2

# some tasks take long time, print a banner (unless quiet mode was selected)
qprintf "Processing... (takes a while)\n"

Expand Down Expand Up @@ -425,19 +398,6 @@ else
qprintf "%s: %s\n\n" "A debug directory has been created" "$DIR"
fi

# upload if -u was passed in
if [ $UPLOAD_DISABLED -eq 0 -a $UPLOAD -eq 1 ]; then
qprintf "Uploading...\n"
if eval ${UPLOAD_CMD} ; then
qprintf "%s%s\n" "${UPLOAD_SUCCESS_MSG}" "$(basename ${TARBALL})"
else
error "${UPLOAD_FAIL_MSG}"
exit 3
fi
else
[[ $UPLOAD_DISABLED -eq 0 ]] && qprintf "%s\n" "${UPLOAD_UNSET_MSG}"
fi

printv "Finished in $SECONDS seconds"

exit 0

0 comments on commit aeb0ffa

Please sign in to comment.