1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-15 18:50:09 +03:00

feature-4388: Enable access to marketplace behind HTTP proxy

This commit is contained in:
Jaime Melis 2016-09-06 11:06:04 +02:00
parent b440d082ab
commit f3d008a562
4 changed files with 29 additions and 3 deletions

View File

@ -379,7 +379,7 @@ IM_MAD = [
#
# type : driver type, supported drivers: xen, kvm, xml
#
# keep_snapshots: do not remove snapshots on power on/off cycles and live
# keep_snapshots: do not remove snapshots on power on/off cycles and live
# migrations if the hypervisor supports that.
#
# imported_vms_actions : comma-separated list of actions supported
@ -560,6 +560,7 @@ DATASTORE_MAD = [
# arguments : for the driver executable
# -t number of threads, i.e. number of repo operations at the same time
# -m marketplace mads separated by commas
# --proxy proxy address if required to access the internet
#*******************************************************************************
MARKET_MAD = [

View File

@ -58,6 +58,28 @@ function execute_mad
fi
}
function set_proxy
{
local proxy_found proxy arg
proxy_found=false
for arg in $*; do
echo "arg: |${arg}|" >> /tmp/proxy
if $proxy_found ; then
proxy=$arg
break
else
if [ "$arg" = "--proxy" ]; then
proxy_found=true
fi
fi
done
if [ -n "$proxy" ]; then
export http_proxy=$proxy
fi
}
# Set global environment
if [ -z "${ONE_LOCATION}" ]; then
@ -89,3 +111,5 @@ if [ $? = 0 ]; then
RUBYLIB="${RUBYLIB}$(echo $VENDOR/*/lib | tr ' ' ':')"
fi
# Set the proxy if defined
set_proxy "$@"

View File

@ -281,7 +281,8 @@ end
opts = GetoptLong.new(
[ '--threads', '-t', GetoptLong::OPTIONAL_ARGUMENT ],
[ '--market-types', '-m', GetoptLong::OPTIONAL_ARGUMENT ]
[ '--market-types', '-m', GetoptLong::OPTIONAL_ARGUMENT ],
[ '--proxy' , GetoptLong::OPTIONAL_ARGUMENT ]
)
mp_type = nil

View File

@ -38,7 +38,7 @@ class OneMarket
req['User-Agent'] = @agent
response = Net::HTTP.start(uri.hostname, uri.port) {|http|
response = Net::HTTP.start(uri.hostname, uri.port, :ENV) {|http|
http.request(req)
}