Skip to content

Commit

Permalink
F #5917: Support for proxy in datastore drivers (#5977)
Browse files Browse the repository at this point in the history
  • Loading branch information
ONdboca authored Sep 26, 2022
1 parent 4ac2cd4 commit 2e953be
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ share/esx-fw-vnc/*.rpm
share/esx-fw-vnc/.vagrant*

*.vscode
*.code-workspace

share/context/*
!share/context/download_context.sh
Expand Down
9 changes: 8 additions & 1 deletion src/market_mad/one_market.rb
Original file line number Diff line number Diff line change
Expand Up @@ -317,12 +317,13 @@ def failure(asym, id, message)
[ '--threads', '-t', GetoptLong::OPTIONAL_ARGUMENT ],
[ '--market-types', '-m', GetoptLong::OPTIONAL_ARGUMENT ],
[ '--timeout', '-w', GetoptLong::OPTIONAL_ARGUMENT ],
[ '--proxy' , GetoptLong::OPTIONAL_ARGUMENT ]
[ '--proxy' '-p' , GetoptLong::OPTIONAL_ARGUMENT ]
)

mp_type = nil
threads = 15
timeout = nil
proxy = nil

begin
opts.each do |opt, arg|
Expand All @@ -333,12 +334,18 @@ def failure(asym, id, message)
mp_type = arg.split(',').map {|a| a.strip }
when '--timeout'
timeout = arg.to_i
when '--proxy'
timeout = arg.to_i
end
end
rescue Exception => e
exit(-1)
end

#Export proxy ip:port as env var for curl

ENV['http_proxy'] = File.read('/etc/one/oned.conf')[/(?<=--proxy\s)\S+/]

mp_driver = MarketPlaceDriver.new(mp_type,
:concurrency => threads,
:timeout => timeout)
Expand Down

0 comments on commit 2e953be

Please sign in to comment.