diff --git a/resources/bin/orchestrator-client b/resources/bin/orchestrator-client index 9ce3806e7..fe1b9a443 100755 --- a/resources/bin/orchestrator-client +++ b/resources/bin/orchestrator-client @@ -61,6 +61,7 @@ pool= hostname_flag= api_path= basic_auth="${ORCHESTRATOR_AUTH_USER:-}:${ORCHESTRATOR_AUTH_PASSWORD:-}" +headers_auth="${ORCHESTRATOR_AUTH_USER_HEADER}" binlog= instance_hostport= @@ -89,12 +90,13 @@ for arg in "$@"; do "-path"|"--path") set -- "$@" "-P" ;; "-query"|"--query") set -- "$@" "-q" ;; "-auth"|"--auth") set -- "$@" "-b" ;; + "-headers-auth"|"--headers-auth") set -- "$@" "-e" ;; "-binlog"|"--binlog") set -- "$@" "-n" ;; *) set -- "$@" "$arg" esac done -while getopts "c:i:d:s:a:D:U:o:r:u:R:t:l:H:P:q:b:n:h" OPTION +while getopts "c:i:d:s:a:D:U:o:r:u:R:t:l:H:P:q:b:e:n:h" OPTION do case $OPTION in h) command="help" ;; @@ -114,6 +116,7 @@ do U) [ ! -z "$OPTARG" ] && orchestrator_api="$OPTARG" ;; P) api_path="$OPTARG" ;; b) basic_auth="$OPTARG" ;; + e) headers_auth="$OPTARG" ;; n) binlog="$OPTARG" ;; q) query="$OPTARG" esac @@ -151,6 +154,10 @@ function get_curl_auth_params { requires_auth+=" --disallow-username-in-url" fi + if [[ -n "${headers_auth}" ]]; then + requires_auth="-H "${headers_auth}"" + fi + # Test API access curl "${requires_auth}" -s --head "${orchestrator_api}" 2>&1 | fgrep -q "$unauthorized_401" && \ echo "$unauthorized_401" && \ @@ -352,6 +359,8 @@ function prompt_help { With '-c api', indicate the specific API path you wish to call -b , --auth Specify when orchestrator uses basic HTTP auth. + -e , --headers-auth + Specify when orchestrator uses headers auth. -q , --query Indicate query for 'restart-replica-statements' command -l , --pool