2
0
mirror of https://github.com/xcat2/confluent.git synced 2026-10-20 14:45:45 +00:00

Diseregard proxy for various confluent interactions

In some environments, http proxy is set for internet, but does not work internally.

Accommodate by suspending the proxy in confluent contexts.
This commit is contained in:
Jarrod Johnson
2026-08-06 12:15:44 -04:00
parent 91f1010e4c
commit cc898d5661
3 changed files with 13 additions and 6 deletions
@@ -24,6 +24,10 @@ except ImportError:
json = None
hmac = None
# Ignore proxy-based environment variables
for proxy_var in ['http_proxy', 'https_proxy', 'HTTP_PROXY', 'HTTPS_PROXY', 'ALL_PROXY', 'all_proxy', 'NO_PROXY', 'no_proxy']:
os.environ.pop(proxy_var, None)
class InvalidApiKey(Exception):
pass
@@ -4,7 +4,7 @@ function test_mgr() {
if [[ "$whost" == *:* ]] && [[ "$whost" != *[* ]] ; then
whost="[$whost]"
fi
if curl -gs https://${whost}/confluent-api/ > /dev/null; then
if curl -gs -x "" https://${whost}/confluent-api/ > /dev/null; then
return 0
fi
return 1
@@ -64,9 +64,9 @@ function set_confluent_vars() {
}
fetch_remote() {
curlargs=""
curlargs=(-x "")
if [ -f /etc/confluent/ca.pem ]; then
curlargs=" --cacert /etc/confluent/ca.pem"
curlargs=(-x "" --cacert /etc/confluent/ca.pem)
fi
set_confluent_vars
mkdir -p $(dirname $1)
@@ -74,7 +74,7 @@ fetch_remote() {
if [[ "$whost" == *:* ]] && [[ "$whost" != *[* ]] ; then
whost="[$whost]"
fi
curl -gf -sS $curlargs https://$whost/confluent-public/os/$confluent_profile/scripts/$1 > $1
curl -gf -sS "${curlargs[@]}" https://$whost/confluent-public/os/$confluent_profile/scripts/$1 > $1
if [ $? != 0 ]; then echo $1 failed to download; return 1; fi
}
@@ -175,8 +175,9 @@ run_remote() {
run_remote_python() {
echo
set_confluent_vars
curlargs=(-x "")
if [ -f /etc/confluent/ca.pem ]; then
curlargs=" --cacert /etc/confluent/ca.pem"
curlargs=(-x "" --cacert /etc/confluent/ca.pem)
fi
echo '---------------------------------------------------------------------------'
echo Running python script "'$*'" from https://$confluent_mgr/confluent-public/os/$confluent_profile/scripts/
@@ -189,7 +190,7 @@ run_remote_python() {
if [[ "$whost" == *:* ]] && [[ "$whost" != *[* ]] ; then
whost="[$whost]"
fi
curl -gf -sS $curlargs https://$whost/confluent-public/os/$confluent_profile/scripts/$1 > $1
curl -gf -sS "${curlargs[@]}" https://$whost/confluent-public/os/$confluent_profile/scripts/$1 > $1
if [ $? != 0 ]; then echo "'$*'" failed to download; return 1; fi
confluentpython $*
retcode=$?
@@ -2,6 +2,8 @@
[ -f /etc/confluent/functions ] && . /etc/confluent/functions
[ -f /opt/confluent/bin/apiclient ] && confapiclient=/opt/confluent/bin/apiclient
[ -f /etc/confluent/apiclient ] && confapiclient=/etc/confluent/apiclient
unset http_proxy
unset https_proxy
for pubkey in /etc/ssh/ssh_host*key.pub; do
if [ "$pubkey" = /etc/ssh/ssh_host_key.pub ]; then
continue