From e150aef558be3c813ae440d52dc9307e0b608fb7 Mon Sep 17 00:00:00 2001 From: ronan lanore Date: Thu, 1 Dec 2016 09:45:23 +0100 Subject: [PATCH] Add proxy support --- lib/chef/provisioning/vsphere_driver/vsphere_helpers.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/chef/provisioning/vsphere_driver/vsphere_helpers.rb b/lib/chef/provisioning/vsphere_driver/vsphere_helpers.rb index 32f4173..ea30516 100644 --- a/lib/chef/provisioning/vsphere_driver/vsphere_helpers.rb +++ b/lib/chef/provisioning/vsphere_driver/vsphere_helpers.rb @@ -1,4 +1,5 @@ require 'rbvmomi' +require 'uri' module ChefProvisioningVsphere class VsphereHelper @@ -8,6 +9,12 @@ class VsphereHelper end def initialize(connect_options, datacenter_name) + if ENV['https_proxy'] + proxy_uri = URI.parse(ENV['https_proxy']) + #proxy_user, proxy_pass = uri.userinfo.split(/:/) if uri.userinfo + connect_options[:proxyHost] = proxy_uri.host + connect_options[:proxyPort] = proxy_uri.port + end @connect_options = connect_options @datacenter_name = datacenter_name end