Remove verbose logging

This commit is contained in:
2025-10-15 17:33:29 +01:00
parent b71ca508ea
commit 14b74e8ecd
6 changed files with 22 additions and 66 deletions

View File

@@ -58,7 +58,6 @@ DB_FILE_NAME_CONVERT='SHED','SCLONE'
- `-s <sourcehost>` - Source host name (use when there are multiple databases with the same name on different hosts) - `-s <sourcehost>` - Source host name (use when there are multiple databases with the same name on different hosts)
- `-t "YYYY-MM-DD HH:MM:SS"` - Recovery point timestamp (defaults to latest point-in-time) - `-t "YYYY-MM-DD HH:MM:SS"` - Recovery point timestamp (defaults to latest point-in-time)
- `-d` - Dry-run mode (shows mutation variables without executing) - `-d` - Dry-run mode (shows mutation variables without executing)
- `-v` or `--verbose` - Enable verbose logging (prints INFO lines and debug context)
- `-c <numChannels>` - Optional: configure number of RMAN channels for the clone; when provided the script adds `"numChannels": <numChannels>` to the `config` block in the GraphQL variables - `-c <numChannels>` - Optional: configure number of RMAN channels for the clone; when provided the script adds `"numChannels": <numChannels>` to the `config` block in the GraphQL variables
## Examples ## Examples
@@ -181,7 +180,7 @@ Security note: `rsc.json` is listed in `.gitignore`. Ensure the file permissions
- Basic dry-run with verbose output: - Basic dry-run with verbose output:
``` ```
./rsc_clone.sh -n SCLONE -o SHED_to_SCLONE.txt -h pve-ora19c-3 -d -v SHED ./rsc_clone.sh -n SCLONE -o SHED_to_SCLONE.txt -h pve-ora19c-3 -d SHED
``` ```
- Execute clone and request 4 RMAN channels: - Execute clone and request 4 RMAN channels:
@@ -193,7 +192,7 @@ Security note: `rsc.json` is listed in `.gitignore`. Ensure the file permissions
- Trigger an on-demand log backup with verbose logging: - Trigger an on-demand log backup with verbose logging:
``` ```
./rsc_log_backup.sh -v <dbName> ./rsc_log_backup.sh <dbName>
``` ```
1. **Parameter Validation** - Validates required parameters and options file 1. **Parameter Validation** - Validates required parameters and options file

View File

@@ -28,16 +28,6 @@ usage() { log_error "Usage: $0 -n <newname> -o <optionsfile> -h <targethost> [-s
MYDIR="$(dirname "$(realpath "$0")")" MYDIR="$(dirname "$(realpath "$0")")"
# Support long option --verbose by translating to -v before getopts
for arg in "$@"; do
case "$arg" in
--verbose)
set -- "${@/--verbose/-v}"
break
;;
esac
done
source $MYDIR/rsc_ops.sh source $MYDIR/rsc_ops.sh
while getopts "n:o:t:h:s:d:v:c:" o; do while getopts "n:o:t:h:s:d:v:c:" o; do
@@ -60,9 +50,6 @@ while getopts "n:o:t:h:s:d:v:c:" o; do
d) d)
dryrun=true dryrun=true
;; ;;
v)
VERBOSE=1
;;
c) c)
numChannels=${OPTARG} numChannels=${OPTARG}
# Validate numChannels is a positive integer # Validate numChannels is a positive integer

View File

@@ -10,7 +10,7 @@
# Options: # Options:
# <targethost> : Host to perform refresh job # <targethost> : Host to perform refresh job
usage() { log_error "Usage: $0 <host>"; exit 1; } usage() { echo "Usage: $0 <host>" >&2; exit 1; }
if [[ -z "$1" ]]; then if [[ -z "$1" ]]; then
usage usage
@@ -18,19 +18,7 @@ fi
MYDIR="$(dirname "$(realpath "$0")")" MYDIR="$(dirname "$(realpath "$0")")"
# Support -v/--verbose and strip it from positional args # No verbose flag: log_info prints by default
NEWARGS=()
for arg in "$@"; do
case "$arg" in
-v|--verbose)
VERBOSE=1
;;
*)
NEWARGS+=("$arg")
;;
esac
done
set -- "${NEWARGS[@]}"
source $MYDIR/rsc_ops.sh source $MYDIR/rsc_ops.sh

View File

@@ -7,22 +7,10 @@
# #
# usage: rsc_list_slas.sh [filter] # usage: rsc_list_slas.sh [filter]
usage() { log_error "Usage: $0 [filter]"; exit 1; } usage() { echo "Usage: $0 [filter]" >&2; exit 1; }
MYDIR="$(dirname "$(realpath "$0")")" MYDIR="$(dirname "$(realpath "$0")")"
# Support -v/--verbose and strip it from positional args so it doesn't become $1 # log_info prints by default now; no verbose flag
NEWARGS=()
for arg in "$@"; do
case "$arg" in
-v|--verbose)
VERBOSE=1
;;
*)
NEWARGS+=("$arg")
;;
esac
done
set -- "${NEWARGS[@]}"
# source $MYDIR/rbk_api.conf # source $MYDIR/rbk_api.conf
source $MYDIR/rsc_ops.sh source $MYDIR/rsc_ops.sh

View File

@@ -7,7 +7,7 @@
# #
# usage: rsc_log_backup.sh [filter] # usage: rsc_log_backup.sh [filter]
usage() { log_error "Usage: $0 [filter]"; exit 1; } usage() { echo "Usage: $0 [filter]" >&2; exit 1; }
if [[ -z "$1" ]]; then if [[ -z "$1" ]]; then
usage usage
@@ -15,19 +15,7 @@ fi
MYDIR="$(dirname "$(realpath "$0")")" MYDIR="$(dirname "$(realpath "$0")")"
# Support -v/--verbose and strip it from positional args # log_info prints by default now; no verbose flag
NEWARGS=()
for arg in "$@"; do
case "$arg" in
-v|--verbose)
VERBOSE=1
;;
*)
NEWARGS+=("$arg")
;;
esac
done
set -- "${NEWARGS[@]}"
# source $MYDIR/rbk_api.conf # source $MYDIR/rbk_api.conf
source $MYDIR/rsc_ops.sh source $MYDIR/rsc_ops.sh

View File

@@ -10,11 +10,8 @@
MYDIR="$(dirname "$(realpath "$0")")" MYDIR="$(dirname "$(realpath "$0")")"
# Logging helpers # Logging helpers
VERBOSE=${VERBOSE:-0}
log_info() { log_info() {
if [ "${VERBOSE}" -eq 1 ]; then
echo "INFO: $*" echo "INFO: $*"
fi
} }
log_warn() { log_warn() {
echo "WARN: $*" >&2 echo "WARN: $*" >&2
@@ -219,12 +216,21 @@ rsc_get_host_id() {
# Get all matching host IDs (portable, no mapfile) # Get all matching host IDs (portable, no mapfile)
host_ids=$(cat /tmp/rbkresponse.$$ | jq -r '.data.physicalHosts.nodes[] | .id') host_ids=$(cat /tmp/rbkresponse.$$ | jq -r '.data.physicalHosts.nodes[] | .id')
host_count=$(echo "$host_ids" | grep -c .) host_count=$(echo "$host_ids" | grep -c .)
if [[ $host_count -ne 1 ]]; then
log_error "Multiple hosts found for '$1':" if [[ $host_count -eq 0 ]]; then
cat /tmp/rbkresponse.$$ | jq -r '.data.physicalHosts.nodes[] | "\(.name) \(.id)"' log_error "Host '$RBK_HOST' not found by exact match (this script requires an exact host name)."
log_error "Please re-run with the exact host name as stored in RSC."
exit_with_error exit_with_error
fi fi
# Set the first match (or empty if none)
if [[ $host_count -gt 1 ]]; then
log_error "Multiple hosts found for '$RBK_HOST':"
cat /tmp/rbkresponse.$$ | jq -r '.data.physicalHosts.nodes[] | "\(.name) \(.id)"'
log_error "Please re-run with the exact host name to disambiguate."
exit_with_error
fi
# Exactly one match: set the first match
targetHostId=$(echo "$host_ids" | head -n 1) targetHostId=$(echo "$host_ids" | head -n 1)
#cat /tmp/rbkresponse.$$ | jq -r #cat /tmp/rbkresponse.$$ | jq -r